Skip to main content

FlushOptions

Struct FlushOptions 

Source
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

Source

pub fn new() -> FlushOptions

Source

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);
Source

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

Source

pub fn get_allow_write_stall(&self) -> bool

Returns the value of the allow_write_stall option.

Source

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).

Source

pub fn get_force_atomic_flush(&self) -> bool

Returns the value of the force_atomic_flush option.

Source

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

Source

pub fn get_listener_wait(&self) -> bool

Returns the value of the listener_wait option.

Source

pub fn get_wait(&self) -> bool

Returns the current wait setting.

See Self::set_wait for what this controls.

Trait Implementations§

Source§

impl Default for FlushOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for FlushOptions

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for FlushOptions

Source§

impl Sync for FlushOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.