pub enum Durability {
Full,
NormalMayLoseRecentCommits,
Unsafe,
}Expand description
Durability contract for a DurableConnection (Task 4 — Explicit Durability
Contract + Safe Default).
The variant name states the guarantee, so a misread default can never
silently cost data. This makes illegal interpretations unrepresentable: you
cannot select a lossy mode without naming the loss. Formally this encodes the
durability/latency Pareto frontier — expected loss on crash is
E[loss] = λ_commit · Δ_unsynced, which is zero only under Durability::Full.
Variants§
Full
fsync on every commit: commit returns ⇒ data is on stable storage
(ACID durability). This is the safe default and the guarantee the
DurableConnection name promises. Pair with group commit (enabled by
default) to amortize the fsync across concurrent commits.
NormalMayLoseRecentCommits
fsync deferred to checkpoints (SQLite NORMAL equivalent). Faster, but a
power failure can lose the most recent committed transactions. The long
name spells out the risk on purpose.
Unsafe
No fsync at all. ANY committed data can be lost on crash. Testing only.
Implementations§
Source§impl Durability
impl Durability
Sourcepub fn is_crash_durable(self) -> bool
pub fn is_crash_durable(self) -> bool
true iff commit returning implies the data is durably on stable
storage (i.e. survives a power failure).
Source§impl Durability
impl Durability
Sourcepub const Off: Durability = Durability::Unsafe
pub const Off: Durability = Durability::Unsafe
Compatibility alias for the former SyncModeClient::Off.
Prefer Durability::Unsafe — the name states the risk.
Sourcepub const Normal: Durability = Durability::NormalMayLoseRecentCommits
pub const Normal: Durability = Durability::NormalMayLoseRecentCommits
Compatibility alias for the former SyncModeClient::Normal.
Prefer Durability::NormalMayLoseRecentCommits.
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
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more