pub enum SyncMode {
Off = 0,
Normal = 1,
Full = 2,
}Expand description
WAL sync mode - matches SQLite’s PRAGMA synchronous semantics
| SochDB | SQLite | Description |
|---|---|---|
| Off | OFF (0) | No fsync, risk of data loss on crash |
| Normal | NORMAL (1) | Fsync at checkpoints, not every commit |
| Full | FULL (2) | Fsync every commit (safest, slowest) |
§Performance vs Durability Trade-offs
- Off: ~10x faster than Full, but may lose last ~100ms of data on crash
- Normal: ~5x faster than Full, durable at checkpoint boundaries
- Full: Every commit is fsync’d, no data loss possible
§SQLite Compatibility
-- SQLite equivalent settings
PRAGMA synchronous = OFF; -- SyncMode::Off
PRAGMA synchronous = NORMAL; -- SyncMode::Normal
PRAGMA synchronous = FULL; -- SyncMode::FullVariants§
Off = 0
No fsync (equivalent to SQLite PRAGMA synchronous = OFF)
Writes buffered in OS, may lose data on power failure. Use for non-critical data or bulk loading.
Normal = 1
Fsync at checkpoints (equivalent to SQLite PRAGMA synchronous = NORMAL)
Default mode. Syncs WAL at checkpoint boundaries. Good balance of performance and durability.
Full = 2
Fsync every commit (equivalent to SQLite PRAGMA synchronous = FULL)
Safest mode. Every commit is immediately durable. Required for financial/critical data.
Implementations§
Trait Implementations§
impl Copy for SyncMode
impl Eq for SyncMode
impl StructuralPartialEq for SyncMode
Auto Trait Implementations§
impl Freeze for SyncMode
impl RefUnwindSafe for SyncMode
impl Send for SyncMode
impl Sync for SyncMode
impl Unpin for SyncMode
impl UnsafeUnpin for SyncMode
impl UnwindSafe for SyncMode
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
Mutably borrows from an owned value. Read more
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
Compare self to
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>
Converts
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>
Converts
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