Struct rocksdb::WriteOptions[][src]

pub struct WriteOptions { /* fields omitted */ }

Optionally disable WAL or sync for this write.

Examples

Making an unsafe write of a batch:

use rocksdb::{DB, Options, WriteBatch, WriteOptions};

let path = "_path_for_rocksdb_storageY1";
{
    let db = DB::open_default(path).unwrap();
    let mut batch = WriteBatch::default();
    batch.put(b"my key", b"my value");
    batch.put(b"key2", b"value2");
    batch.put(b"key3", b"value3");

    let mut write_options = WriteOptions::default();
    write_options.set_sync(false);
    write_options.disable_wal(true);

    db.write_opt(batch, &write_options);
}
let _ = DB::destroy(&Options::default(), path);

Implementations

impl WriteOptions[src]

pub fn new() -> WriteOptions[src]

pub fn set_sync(&mut self, sync: bool)[src]

Sets the sync mode. If true, the write will be flushed from the operating system buffer cache before the write is considered complete. If this flag is true, writes will be slower.

Default: false

pub fn disable_wal(&mut self, disable: bool)[src]

Sets whether WAL should be active or not. If true, writes will not first go to the write ahead log, and the write may got lost after a crash.

Default: false

pub fn set_ignore_missing_column_families(&mut self, ignore: bool)[src]

If true and if user is trying to write to column families that don’t exist (they were dropped), ignore the write (don’t return an error). If there are multiple writes in a WriteBatch, other writes will succeed.

Default: false

pub fn set_no_slowdown(&mut self, no_slowdown: bool)[src]

If true and we need to wait or sleep for the write request, fails immediately with Status::Incomplete().

Default: false

pub fn set_low_pri(&mut self, v: bool)[src]

If true, this write request is of lower priority if compaction is behind. In this case, no_slowdown = true, the request will be cancelled immediately with Status::Incomplete() returned. Otherwise, it will be slowed down. The slowdown value is determined by RocksDB to guarantee it introduces minimum impacts to high priority writes.

Default: false

pub fn set_memtable_insert_hint_per_batch(&mut self, v: bool)[src]

If true, writebatch will maintain the last insert positions of each memtable as hints in concurrent write. It can improve write performance in concurrent writes if keys in one writebatch are sequential. In non-concurrent writes (when concurrent_memtable_writes is false) this option will be ignored.

Default: false

Trait Implementations

impl Default for WriteOptions[src]

impl Drop for WriteOptions[src]

impl Send for WriteOptions[src]

impl Sync for WriteOptions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.