|
|
|
@ -270,6 +270,49 @@ impl Options { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Maximum size of dictionaries used to prime the compression library.
|
|
|
|
|
/// Enabling dictionary can improve compression ratios when there are
|
|
|
|
|
/// repetitions across data blocks.
|
|
|
|
|
///
|
|
|
|
|
/// The dictionary is created by sampling the SST file data. If
|
|
|
|
|
/// `zstd_max_train_bytes` is nonzero, the samples are passed through zstd's
|
|
|
|
|
/// dictionary generator. Otherwise, the random samples are used directly as
|
|
|
|
|
/// the dictionary.
|
|
|
|
|
///
|
|
|
|
|
/// When compression dictionary is disabled, we compress and write each block
|
|
|
|
|
/// before buffering data for the next one. When compression dictionary is
|
|
|
|
|
/// enabled, we buffer all SST file data in-memory so we can sample it, as data
|
|
|
|
|
/// can only be compressed and written after the dictionary has been finalized.
|
|
|
|
|
/// So users of this feature may see increased memory usage.
|
|
|
|
|
///
|
|
|
|
|
/// Default: `0`
|
|
|
|
|
///
|
|
|
|
|
/// # Example
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// use rocksdb::Options;
|
|
|
|
|
///
|
|
|
|
|
/// let mut opts = Options::default();
|
|
|
|
|
/// opts.set_compression_options(4, 5, 6, 7);
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn set_compression_options( |
|
|
|
|
&mut self, |
|
|
|
|
w_bits: c_int, |
|
|
|
|
level: c_int, |
|
|
|
|
strategy: c_int, |
|
|
|
|
max_dict_bytes: c_int, |
|
|
|
|
) { |
|
|
|
|
unsafe { |
|
|
|
|
ffi::rocksdb_options_set_compression_options( |
|
|
|
|
self.inner, |
|
|
|
|
w_bits, |
|
|
|
|
level, |
|
|
|
|
strategy, |
|
|
|
|
max_dict_bytes, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// If non-zero, we perform bigger reads when doing compaction. If you're
|
|
|
|
|
/// running RocksDB on spinning disks, you should set this to at least 2MB.
|
|
|
|
|
/// That way RocksDB's compaction is doing sequential instead of random reads.
|
|
|
|
@ -391,6 +434,27 @@ impl Options { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Sets the optimize_filters_for_hits flag
|
|
|
|
|
///
|
|
|
|
|
/// Default: `false`
|
|
|
|
|
///
|
|
|
|
|
/// # Example
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// use rocksdb::Options;
|
|
|
|
|
///
|
|
|
|
|
/// let mut opts = Options::default();
|
|
|
|
|
/// opts.set_optimize_filters_for_hits(true);
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn set_optimize_filters_for_hits(&mut self, optimize_for_hits: bool) { |
|
|
|
|
unsafe { |
|
|
|
|
ffi::rocksdb_options_set_optimize_filters_for_hits( |
|
|
|
|
self.inner, |
|
|
|
|
optimize_for_hits as c_int, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Sets the number of open files that can be used by the DB. You may need to
|
|
|
|
|
/// increase this if your database has a large working set. Value `-1` means
|
|
|
|
|
/// files opened are always kept open. You can estimate number of files based
|
|
|
|
|