Package org.rocksdb

Class OptionsUtil

java.lang.Object
org.rocksdb.OptionsUtil

public class OptionsUtil extends Object
  • Method Details

    • loadLatestOptions

      public static void loadLatestOptions(ConfigOptions configOptions, String dbPath, DBOptions dbOptions, 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, and block_cache), 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:
      configOptions - ConfigOptions instance.
      dbPath - the path to the RocksDB.
      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(ConfigOptions configOptions, String optionsFileName, DBOptions dbOptions, 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:
      configOptions - ConfigOptions instance.
      optionsFileName - the RocksDB options file path.
      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 String getLatestOptionsFileName(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.