Package org.rocksdb

Enum EncodingType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<EncodingType>

    public enum EncodingType
    extends java.lang.Enum<EncodingType>
    EncodingType

    The value will determine how to encode keys when writing to a new SST file.

    This value will be stored inside the SST file which will be used when reading from the file, which makes it possible for users to choose different encoding type when reopening a DB. Files with different encoding types can co-exist in the same DB and can be read.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      kPlain
      Always write full keys without any special encoding.
      kPrefix
      Find opportunity to write the same prefix once for multiple rows.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte getValue()
      Returns the byte value of the enumerations value
      static EncodingType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static EncodingType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • kPlain

        public static final EncodingType kPlain
        Always write full keys without any special encoding.
      • kPrefix

        public static final EncodingType kPrefix

        Find opportunity to write the same prefix once for multiple rows. In some cases, when a key follows a previous key with the same prefix, instead of writing out the full key, it just writes out the size of the shared prefix, as well as other bytes, to save some bytes.

        When using this option, the user is required to use the same prefix extractor to make sure the same prefix will be extracted from the same key. The Name() value of the prefix extractor will be stored in the file. When reopening the file, the name of the options.prefix_extractor given will be bitwise compared to the prefix extractors stored in the file. An error will be returned if the two don't match.

    • Method Detail

      • values

        public static EncodingType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (EncodingType c : EncodingType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static EncodingType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

        public byte getValue()
        Returns the byte value of the enumerations value
        Returns:
        byte representation