Package org.rocksdb
Class OptionsUtil
- java.lang.Object
-
- org.rocksdb.OptionsUtil
-
public class OptionsUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetLatestOptionsFileName(java.lang.String dbPath, Env env)Returns the latest options file name under the specified RocksDB path.static voidloadLatestOptions(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 voidloadLatestOptions(java.lang.String dbPath, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs, boolean ignoreUnknownOptions)static voidloadLatestOptions(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 voidloadOptionsFromFile(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 voidloadOptionsFromFile(java.lang.String optionsFileName, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs, boolean ignoreUnknownOptions)static voidloadOptionsFromFile(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.
-
-
-
Method Detail
-
loadLatestOptions
public static void loadLatestOptions(java.lang.String dbPath, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs) throws RocksDBExceptionA 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-Envinstance.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.
-
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-Envinstance.dbOptions-DBOptionsinstance. This will be filled and returned.cfDescs- A list ofColumnFamilyDescriptor'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-ConfigOptionsinstance.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(java.lang.String optionsFileName, Env env, DBOptions dbOptions, java.util.List<ColumnFamilyDescriptor> cfDescs) throws RocksDBExceptionSimilar 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-Envinstance.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(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-Envinstance.dbOptions-DBOptionsinstance. This will be filled and returned.cfDescs- A list ofColumnFamilyDescriptor'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-ConfigOptionsinstance.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
public static java.lang.String getLatestOptionsFileName(java.lang.String dbPath, Env env) throws RocksDBExceptionReturns 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.
-
-