pub struct WriteOptions {
pub durability: DurabilityMode,
}Expand description
Per-write options passed to commit operations.
WriteOptions lets a single write or batch request a durability level
different from the database default. The options are evaluated when the
write is accepted; changing a WriteOptions value later has no effect on an
already committed write.
§Examples
use trine_kv::{Db, WriteOptions};
let db = Db::open_sync(trine_kv::DbOptions::memory())?;
let commit = db.put_with_options_sync(b"k", b"v", WriteOptions::sync_all())?;
assert!(commit.sequence().get() > 0);Fields§
§durability: DurabilityModeDurability requested for this write.
Implementations§
Source§impl WriteOptions
impl WriteOptions
Sourcepub const fn new(durability: DurabilityMode) -> Self
pub const fn new(durability: DurabilityMode) -> Self
Creates write options with an explicit durability mode.
§Parameters
durability: durability requested for the write or batch.
Sourcepub const fn buffered() -> Self
pub const fn buffered() -> Self
Creates buffered write options.
The write may return after bytes are accepted by the storage backend but before a flush or sync is requested. This is the lowest-latency and weakest durability mode.
Sourcepub const fn flush() -> Self
pub const fn flush() -> Self
Creates flush write options.
The write requests a backend flush for accepted WAL bytes. Exact meaning depends on the selected backend capabilities.
Trait Implementations§
Source§impl Clone for WriteOptions
impl Clone for WriteOptions
Source§fn clone(&self) -> WriteOptions
fn clone(&self) -> WriteOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WriteOptions
Source§impl Debug for WriteOptions
impl Debug for WriteOptions
Source§impl Default for WriteOptions
impl Default for WriteOptions
Source§fn default() -> WriteOptions
fn default() -> WriteOptions
Returns the “default value” for a type. Read more
impl Eq for WriteOptions
Source§impl PartialEq for WriteOptions
impl PartialEq for WriteOptions
Source§fn eq(&self, other: &WriteOptions) -> bool
fn eq(&self, other: &WriteOptions) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for WriteOptions
Auto Trait Implementations§
impl Freeze for WriteOptions
impl RefUnwindSafe for WriteOptions
impl Send for WriteOptions
impl Sync for WriteOptions
impl Unpin for WriteOptions
impl UnsafeUnpin for WriteOptions
impl UnwindSafe for WriteOptions
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