Class OptionsUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetLatestOptionsFileName(String dbPath, Env env) Returns the latest options file name under the specified RocksDB path.static voidloadLatestOptions(ConfigOptions configOptions, String dbPath, DBOptions dbOptions, 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 voidloadOptionsFromFile(ConfigOptions configOptions, String optionsFileName, DBOptions dbOptions, List<ColumnFamilyDescriptor> cfDescs) Similar to LoadLatestOptions, this function constructs the DBOptions and ColumnFamilyDescriptors based on the specified RocksDB Options file.
-
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-ConfigOptionsinstance.dbPath- the path to the RocksDB.dbOptions-DBOptionsinstance. This will be filled and returned.cfDescs- A list ofColumnFamilyDescriptor'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-ConfigOptionsinstance.optionsFileName- the RocksDB options file path.dbOptions-DBOptionsinstance. This will be filled and returned.cfDescs- A list ofColumnFamilyDescriptor's be returned.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
getLatestOptionsFileName
Returns the latest options file name under the specified RocksDB path.- Parameters:
dbPath- the path to the RocksDB.env-Envinstance.- Returns:
- the latest options file name under the db path.
- Throws:
RocksDBException- thrown if error happens in underlying native library.
-