pub enum Durability {
SyncEachWrite,
Disabled,
}Expand description
WAL durability mode for the write engine.
Controls whether write and write_async append to and fsync the
write-ahead log on every call. The default (SyncEachWrite) matches the
pre-existing behavior and is the only safe choice for production
workloads — a process crash between a successful write and a later
flush will lose mutations written with Disabled.
§When to use Disabled
- Bulk-load / import pipelines where the source data is replayable and you are willing to re-run the load on failure.
- Benchmarking where you want to isolate CPU-bound write throughput from
fsync latency. The companion
write/ingest_wal_offCriterion bench uses this variant (seecqlite-core/benches/write.rs).
In both cases, call WriteEngine::flush (and, optionally,
WriteEngine::close) when the load is finished so the data is durably
persisted to SSTables.
§WAL replay on restart
When Disabled, no WAL entries are written. Reopening the engine on the
same wal_dir after a crash will replay zero mutations, even if
flush was never called. If you need crash-safe recovery, use
SyncEachWrite.
§Example
use cqlite_core::storage::write_engine::{Durability, WriteEngineConfig};
// Production (default)
let config = WriteEngineConfig::new(data, wal, schema);
// Bulk-load / benchmarking
let config = WriteEngineConfig::new(data, wal, schema)
.with_durability(Durability::Disabled);Variants§
SyncEachWrite
Append to the WAL and call fsync on every write / write_async
call. A successful return guarantees the mutation is durable on disk.
This is the default and the safe choice for all production workloads.
Disabled
Skip WAL append and fsync on every write / write_async call.
Mutations are buffered in the memtable only. Data is durable only
after a successful WriteEngine::flush.
Use only for bulk-load pipelines and benchmarks where durability can be traded for throughput.
Trait Implementations§
Source§impl Clone for Durability
impl Clone for Durability
Source§fn clone(&self) -> Durability
fn clone(&self) -> Durability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Durability
Source§impl Debug for Durability
impl Debug for Durability
Source§impl Default for Durability
impl Default for Durability
Source§fn default() -> Durability
fn default() -> Durability
impl Eq for Durability
Source§impl PartialEq for Durability
impl PartialEq for Durability
Source§fn eq(&self, other: &Durability) -> bool
fn eq(&self, other: &Durability) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Durability
Auto Trait Implementations§
impl Freeze for Durability
impl RefUnwindSafe for Durability
impl Send for Durability
impl Sync for Durability
impl Unpin for Durability
impl UnsafeUnpin for Durability
impl UnwindSafe for Durability
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.