|
|
|
@ -347,10 +347,81 @@ impl Options { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// If true, allow multi-writers to update mem tables in parallel.
|
|
|
|
|
/// Only some memtable_factory-s support concurrent writes; currently it
|
|
|
|
|
/// is implemented only for SkipListFactory. Concurrent memtable writes
|
|
|
|
|
/// are not compatible with inplace_update_support or filter_deletes.
|
|
|
|
|
/// It is strongly recommended to set enable_write_thread_adaptive_yield
|
|
|
|
|
/// if you are going to use this feature.
|
|
|
|
|
///
|
|
|
|
|
/// Default: true
|
|
|
|
|
///
|
|
|
|
|
/// # Example
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// use rocksdb::Options;
|
|
|
|
|
///
|
|
|
|
|
/// let mut opts = Options::default();
|
|
|
|
|
/// opts.set_allow_concurrent_memtable_write(false);
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn set_allow_concurrent_memtable_write(&mut self, allow: bool) { |
|
|
|
|
unsafe { ffi::rocksdb_options_set_allow_concurrent_memtable_write(self.inner, |
|
|
|
|
allow as c_uchar) } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn set_disable_data_sync(&mut self, disable: bool) { |
|
|
|
|
unsafe { ffi::rocksdb_options_set_disable_data_sync(self.inner, disable as c_int) } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Enable direct I/O mode for reading
|
|
|
|
|
/// they may or may not improve performance depending on the use case
|
|
|
|
|
///
|
|
|
|
|
/// Files will be opened in "direct I/O" mode
|
|
|
|
|
/// which means that data read from the disk will not be cached or
|
|
|
|
|
/// buffered. The hardware buffer of the devices may however still
|
|
|
|
|
/// be used. Memory mapped files are not impacted by these parameters.
|
|
|
|
|
///
|
|
|
|
|
/// Default: false
|
|
|
|
|
///
|
|
|
|
|
/// # Example
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// use rocksdb::Options;
|
|
|
|
|
///
|
|
|
|
|
/// let mut opts = Options::default();
|
|
|
|
|
/// opts.set_use_direct_reads(true);
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn set_use_direct_reads(&mut self, enabled: bool) { |
|
|
|
|
unsafe { |
|
|
|
|
ffi::rocksdb_options_set_use_direct_reads(self.inner, enabled as c_uchar); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Enable direct I/O mode for flush and compaction
|
|
|
|
|
///
|
|
|
|
|
/// Files will be opened in "direct I/O" mode
|
|
|
|
|
/// which means that data written to the disk will not be cached or
|
|
|
|
|
/// buffered. The hardware buffer of the devices may however still
|
|
|
|
|
/// be used. Memory mapped files are not impacted by these parameters.
|
|
|
|
|
/// they may or may not improve performance depending on the use case
|
|
|
|
|
///
|
|
|
|
|
/// Default: false
|
|
|
|
|
///
|
|
|
|
|
/// # Example
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// use rocksdb::Options;
|
|
|
|
|
///
|
|
|
|
|
/// let mut opts = Options::default();
|
|
|
|
|
/// opts.set_use_direct_io_for_flush_and_compaction(true);
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn set_use_direct_io_for_flush_and_compaction(&mut self, enabled: bool) { |
|
|
|
|
unsafe { |
|
|
|
|
ffi::rocksdb_options_set_use_direct_io_for_flush_and_compaction(self.inner, |
|
|
|
|
enabled as c_uchar); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Hints to the OS that it should not buffer disk I/O. Enabling this
|
|
|
|
|
/// parameter may improve performance but increases pressure on the
|
|
|
|
|
/// system cache.
|
|
|
|
@ -373,15 +444,16 @@ impl Options { |
|
|
|
|
/// # Example
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// #[allow(deprecated)]
|
|
|
|
|
/// use rocksdb::Options;
|
|
|
|
|
///
|
|
|
|
|
/// let mut opts = Options::default();
|
|
|
|
|
/// opts.set_allow_os_buffer(false);
|
|
|
|
|
/// ```
|
|
|
|
|
#[deprecated(since="0.7.0", note="replaced with set_use_direct_reads/set_use_direct_io_for_flush_and_compaction methods")] |
|
|
|
|
pub fn set_allow_os_buffer(&mut self, is_allow: bool) { |
|
|
|
|
unsafe { |
|
|
|
|
ffi::rocksdb_options_set_allow_os_buffer(self.inner, is_allow as c_uchar); |
|
|
|
|
} |
|
|
|
|
self.set_use_direct_reads(!is_allow); |
|
|
|
|
self.set_use_direct_io_for_flush_and_compaction(!is_allow); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Sets the number of shards used for table cache.
|
|
|
|
|