Package org.rocksdb

Class OptionsUtil


  • public class OptionsUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getLatestOptionsFileName​(java.lang.String dbPath, Env env)
      Returns the latest options file name under the specified RocksDB path.
      static void loadLatestOptions​(java.lang.String dbPath, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs)
      A static method to construct the DBOptions and ColumnFamilyDescriptors by loading the latest RocksDB options file stored in the specified rocksdb database.
      static void loadLatestOptions​(java.lang.String dbPath, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs, boolean ignoreUnknownOptions)  
      static void loadLatestOptions​(ConfigOptions configOptions, java.lang.String dbPath, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs)
      Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file.
      static void loadOptionsFromFile​(java.lang.String optionsFileName, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs)
      Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file.
      static void loadOptionsFromFile​(java.lang.String optionsFileName, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs, boolean ignoreUnknownOptions)  
      static void loadOptionsFromFile​(ConfigOptions configOptions, java.lang.String optionsFileName, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs)
      Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • loadLatestOptions

        public static void loadLatestOptions​(java.lang.String dbPath,
                                             Env env,
                                             DBOptions dbOptions,
                                             java.util.List<ColumnFamilyDescriptor> cfDescs)
                                      throws RocksDBException
        A static method to construct the DBOptions and ColumnFamilyDescriptors by loading the latest RocksDB options file stored in the specified rocksdb database. Note that the all the pointer options (except table_factory, which will be described in more details below) will be initialized with the default values. Developers can further initialize them after this function call. Below is an example list of pointer options which will be initialized. - env - memtable_factory - compaction_filter_factory - prefix_extractor - comparator - merge_operator - compaction_filter For table_factory, this function further supports deserializing BlockBasedTableFactory and its BlockBasedTableOptions except the pointer options of BlockBasedTableOptions (flush_block_policy_factory, block_cache, and block_cache_compressed), which will be initialized with default values. Developers can further specify these three options by casting the return value of TableFactoroy::GetOptions() to BlockBasedTableOptions and making necessary changes.
        Parameters:
        dbPath - the path to the RocksDB.
        env - Env instance.
        dbOptions - DBOptions instance. This will be filled and returned.
        cfDescs - A list of ColumnFamilyDescriptor's be returned.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.
      • loadLatestOptions

        public static void loadLatestOptions​(java.lang.String dbPath,
                                             Env env,
                                             DBOptions dbOptions,
                                             java.util.List<ColumnFamilyDescriptor> cfDescs,
                                             boolean ignoreUnknownOptions)
                                      throws RocksDBException
        Parameters:
        dbPath - the path to the RocksDB.
        env - Env instance.
        dbOptions - DBOptions instance. This will be filled and returned.
        cfDescs - A list of ColumnFamilyDescriptor's be returned.
        ignoreUnknownOptions - this flag can be set to true if you want to ignore options that are from a newer version of the db, essentially for forward compatibility.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.
      • loadLatestOptions

        public static void loadLatestOptions​(ConfigOptions configOptions,
                                             java.lang.String dbPath,
                                             DBOptions dbOptions,
                                             java.util.List<ColumnFamilyDescriptor> cfDescs)
                                      throws RocksDBException
        Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file. See LoadLatestOptions above.
        Parameters:
        dbPath - the path to the RocksDB.
        configOptions - ConfigOptions instance.
        dbOptions - DBOptions instance. This will be filled and returned.
        cfDescs - A list of ColumnFamilyDescriptor's be returned.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.
      • loadOptionsFromFile

        public static void loadOptionsFromFile​(java.lang.String optionsFileName,
                                               Env env,
                                               DBOptions dbOptions,
                                               java.util.List<ColumnFamilyDescriptor> cfDescs)
                                        throws RocksDBException
        Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file. See LoadLatestOptions above.
        Parameters:
        optionsFileName - the RocksDB options file path.
        env - Env instance.
        dbOptions - DBOptions instance. This will be filled and returned.
        cfDescs - A list of ColumnFamilyDescriptor's be returned.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.
      • loadOptionsFromFile

        public static void loadOptionsFromFile​(java.lang.String optionsFileName,
                                               Env env,
                                               DBOptions dbOptions,
                                               java.util.List<ColumnFamilyDescriptor> cfDescs,
                                               boolean ignoreUnknownOptions)
                                        throws RocksDBException
        Parameters:
        optionsFileName - the RocksDB options file path.
        env - Env instance.
        dbOptions - DBOptions instance. This will be filled and returned.
        cfDescs - A list of ColumnFamilyDescriptor's be returned.
        ignoreUnknownOptions - this flag can be set to true if you want to ignore options that are from a newer version of the db, esentially for forward compatibility.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.
      • loadOptionsFromFile

        public static void loadOptionsFromFile​(ConfigOptions configOptions,
                                               java.lang.String optionsFileName,
                                               DBOptions dbOptions,
                                               java.util.List<ColumnFamilyDescriptor> cfDescs)
                                        throws RocksDBException
        Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file. See LoadLatestOptions above.
        Parameters:
        optionsFileName - the RocksDB options file path.
        configOptions - ConfigOptions instance.
        dbOptions - DBOptions instance. This will be filled and returned.
        cfDescs - A list of ColumnFamilyDescriptor's be returned.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.
      • getLatestOptionsFileName

        public static java.lang.String getLatestOptionsFileName​(java.lang.String dbPath,
                                                                Env env)
                                                         throws RocksDBException
        Returns the latest options file name under the specified RocksDB path.
        Parameters:
        dbPath - the path to the RocksDB.
        env - Env instance.
        Returns:
        the latest options file name under the db path.
        Throws:
        RocksDBException - thrown if error happens in underlying native library.