pub struct FlushOptions { /* private fields */ }Expand description
Optionally wait for the memtable flush to be performed.
§Examples
Manually flushing the memtable:
use rust_rocksdb::{DB, Options, FlushOptions};
let tempdir = tempfile::Builder::new()
.prefix("_path_for_rocksdb_storageY2")
.tempdir()
.expect("Failed to create temporary path for the _path_for_rocksdb_storageY2");
let path = tempdir.path();
{
let db = DB::open_default(path).unwrap();
let mut flush_options = FlushOptions::default();
flush_options.set_wait(true);
db.flush_opt(&flush_options);
}
let _ = DB::destroy(&Options::default(), path);Implementations§
Source§impl FlushOptions
impl FlushOptions
pub fn new() -> FlushOptions
Sourcepub fn set_wait(&mut self, wait: bool)
pub fn set_wait(&mut self, wait: bool)
Waits until the flush is done.
Default: true
§Examples
use rust_rocksdb::FlushOptions;
let mut options = FlushOptions::default();
options.set_wait(false);Sourcepub fn set_allow_write_stall(&mut self, val: bool)
pub fn set_allow_write_stall(&mut self, val: bool)
If true, the flush would proceed immediately even it means writes will stall for the duration of the flush; if false the operation will wait until it’s possible to do flush w/o causing stall or until required flush is performed by someone else (foreground call or background thread). Default: false
Sourcepub fn get_allow_write_stall(&self) -> bool
pub fn get_allow_write_stall(&self) -> bool
Returns the value of the allow_write_stall option.
Sourcepub fn set_force_atomic_flush(&mut self, val: bool)
pub fn set_force_atomic_flush(&mut self, val: bool)
If true, use atomic flush to flush all column families atomically, regardless of the DBOptions::atomic_flush setting. When used with DB::Flush() or internally via GetLiveFilesStorageInfo(), this forces all column families to be flushed in a single atomic operation. Default: false (uses DBOptions::atomic_flush setting).
Sourcepub fn get_force_atomic_flush(&self) -> bool
pub fn get_force_atomic_flush(&self) -> bool
Returns the value of the force_atomic_flush option.
Sourcepub fn set_listener_wait(&mut self, val: bool)
pub fn set_listener_wait(&mut self, val: bool)
If true (and wait is also true), Flush() will not return until the registered
EventListener::OnFlushCompleted callbacks for the flushed memtables have finished
running. By default (false), Flush(wait=true) may return as soon as the flush result
is committed, which can be before (or while) the OnFlushCompleted callbacks execute on
the background flush thread. Set this to true when the caller needs to observe the
effects of its OnFlushCompleted listener(s) immediately after Flush() returns. Has no
effect when wait == false. Default: false
Sourcepub fn get_listener_wait(&self) -> bool
pub fn get_listener_wait(&self) -> bool
Returns the value of the listener_wait option.
Sourcepub fn get_wait(&self) -> bool
pub fn get_wait(&self) -> bool
Returns the current wait setting.
See Self::set_wait for what this controls.