Package org.rocksdb

Class CompressionOptions

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class CompressionOptions
    extends RocksObject
    Options for Compression
    • Constructor Detail

      • CompressionOptions

        public CompressionOptions()
    • Method Detail

      • windowBits

        public int windowBits()
      • level

        public int level()
      • strategy

        public int strategy()
      • setMaxDictBytes

        public CompressionOptions setMaxDictBytes​(int maxDictBytes)
        Maximum size of dictionary used to prime the compression library. Currently this dictionary will be constructed by sampling the first output file in a subcompaction when the target level is bottommost. This dictionary will be loaded into the compression library before compressing/uncompressing each data block of subsequent files in the subcompaction. Effectively, this improves compression ratios when there are repetitions across data blocks. A value of 0 indicates the feature is disabled. Default: 0.
        Parameters:
        maxDictBytes - Maximum bytes to use for the dictionary
        Returns:
        the reference to the current options
      • maxDictBytes

        public int maxDictBytes()
        Maximum size of dictionary used to prime the compression library.
        Returns:
        The maximum bytes to use for the dictionary
      • setZStdMaxTrainBytes

        public CompressionOptions setZStdMaxTrainBytes​(int zstdMaxTrainBytes)
        Maximum size of training data passed to zstd's dictionary trainer. Using zstd's dictionary trainer can achieve even better compression ratio improvements than using setMaxDictBytes(int) alone. The training data will be used to generate a dictionary of maxDictBytes(). Default: 0.
        Parameters:
        zstdMaxTrainBytes - Maximum bytes to use for training ZStd.
        Returns:
        the reference to the current options
      • zstdMaxTrainBytes

        public int zstdMaxTrainBytes()
        Maximum size of training data passed to zstd's dictionary trainer.
        Returns:
        Maximum bytes to use for training ZStd
      • setEnabled

        public CompressionOptions setEnabled​(boolean enabled)
        When the compression options are set by the user, it will be set to "true". For bottommost_compression_opts, to enable it, user must set enabled=true. Otherwise, bottommost compression will use compression_opts as default compression options. For compression_opts, if compression_opts.enabled=false, it is still used as compression options for compression process. Default: false.
        Parameters:
        enabled - true to use these compression options for the bottommost_compression_opts, false otherwise
        Returns:
        the reference to the current options
      • enabled

        public boolean enabled()
        Determine whether these compression options are used for the bottommost_compression_opts.
        Returns:
        true if these compression options are used for the bottommost_compression_opts, false otherwise