pub enum DurabilityMode {
Flushed,
Synced,
Grouped {
every: u32,
},
}Expand description
How far a single-record write is pushed before it returns.
This is a contract, not a tuning knob: it decides what a successful
mutation means. Nothing here makes a claim about surviving power loss —
see DurabilityMode::guarantee for what each mode does and does not
establish.
Variants§
Flushed
Write and flush to the operating system. The default.
The bytes leave the process before the call returns, so a committed write survives the process dying. They are not forced to the device.
Synced
Write, flush, and fsync before returning.
Issues a stable-storage barrier per mutation. Whether that barrier actually reaches the platter depends on the filesystem, the mount options and the drive’s write cache — none of which this database can observe, so this mode buys a barrier, not a proof.
Grouped
Flush every write, and fsync once every every writes.
Amortises the barrier. The cost is an explicit window: up to every - 1
acknowledged writes may not yet have been through one.
Implementations§
Source§impl DurabilityMode
impl DurabilityMode
Sourcepub fn guarantee(&self) -> &'static str
pub fn guarantee(&self) -> &'static str
What a successful mutation guarantees under this mode, stated so that a caller can read the contract rather than infer it from an API name.
Sourcepub fn unbarriered_window(&self) -> Option<u32>
pub fn unbarriered_window(&self) -> Option<u32>
How many acknowledged writes may not yet have been through a barrier.
None where no barrier is issued at all.