Struct ckb_rocksdb::WriteOptions
source · pub struct WriteOptions { /* private fields */ }
Expand description
Optionally disable WAL or sync for this write.
Examples
Making an unsafe write of a batch:
use ckb_rocksdb::{DB, Options, WriteBatch, WriteOptions, prelude::*};
let path = "_path_for_rocksdb_storageZ";
{
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§
source§impl WriteOptions
impl WriteOptions
pub fn new() -> WriteOptions
sourcepub fn set_sync(&mut self, sync: bool)
pub fn set_sync(&mut self, sync: bool)
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
sourcepub fn disable_wal(&mut self, disable: bool)
pub fn disable_wal(&mut self, disable: bool)
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
Trait Implementations§
source§impl Clone for WriteOptions
impl Clone for WriteOptions
source§fn clone(&self) -> WriteOptions
fn clone(&self) -> WriteOptions
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for WriteOptions
impl Default for WriteOptions
source§fn default() -> WriteOptions
fn default() -> WriteOptions
Returns the “default value” for a type. Read more
source§impl DeleteCF<WriteOptions> for TransactionDB
impl DeleteCF<WriteOptions> for TransactionDB
fn delete_cf_full<K>( &self, cf: Option<&ColumnFamily>, key: K, writeopts: Option<&WriteOptions> ) -> Result<(), Error>where K: AsRef<[u8]>,
fn delete_cf<K>(&self, cf: &ColumnFamily, key: K) -> Result<(), Error>where K: AsRef<[u8]>,
fn put_cf_opt<K>( &self, cf: &ColumnFamily, key: K, writeopts: &W ) -> Result<(), Error>where K: AsRef<[u8]>,
source§impl Drop for WriteOptions
impl Drop for WriteOptions
source§impl Handle<rocksdb_writeoptions_t> for WriteOptions
impl Handle<rocksdb_writeoptions_t> for WriteOptions
fn handle(&self) -> *mut rocksdb_writeoptions_t
source§impl MergeCF<WriteOptions> for TransactionDB
impl MergeCF<WriteOptions> for TransactionDB
fn merge_cf_full<K, V>( &self, cf: Option<&ColumnFamily>, key: K, value: V, writeopts: Option<&WriteOptions> ) -> Result<(), Error>where K: AsRef<[u8]>, V: AsRef<[u8]>,
fn merge_cf<K, V>( &self, cf: &ColumnFamily, key: K, value: V ) -> Result<(), Error>where K: AsRef<[u8]>, V: AsRef<[u8]>,
fn merge_cf_opt<K, V>( &self, cf: &ColumnFamily, key: K, value: V, writeopts: &W ) -> Result<(), Error>where K: AsRef<[u8]>, V: AsRef<[u8]>,
source§impl PutCF<WriteOptions> for TransactionDB
impl PutCF<WriteOptions> for TransactionDB
fn put_cf_full<K, V>( &self, cf: Option<&ColumnFamily>, key: K, value: V, writeopts: Option<&WriteOptions> ) -> Result<(), Error>where K: AsRef<[u8]>, V: AsRef<[u8]>,
fn put_cf<K, V>(&self, cf: &ColumnFamily, key: K, value: V) -> Result<(), Error>where K: AsRef<[u8]>, V: AsRef<[u8]>,
fn put_cf_opt<K, V>( &self, cf: &ColumnFamily, key: K, value: V, writeopts: &W ) -> Result<(), Error>where K: AsRef<[u8]>, V: AsRef<[u8]>,
impl Send for WriteOptions
impl Sync for WriteOptions
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more