pub enum Durability {
Fast,
Atomic,
Durable,
}Expand description
Write-durability strategy for FileStorage.
Variants§
Fast
Overwrite the target file in place (open + truncate + write).
Fastest: after a key’s file exists, each save reuses the same inode/MFT entry with no file creation or rename. A crash mid-write leaves a record whose stored checksum no longer matches its data; such a record is detected on load and treated as absent, so the affected task simply re-runs (which fits the executor’s re-run-incomplete-work model).
Atomic
Write to a unique temp file, then atomically rename it over the target.
A crash never destroys the previous good record (you always read either the old or the new value), at the cost of a file create + rename per save. Bytes may still be sitting in the OS page cache, so this protects against process crashes but not necessarily power loss.
Durable
Like Durability::Atomic, but fsyncs the data to physical storage
before the rename and best-effort fsyncs the directory afterward.
The strongest guarantee — survives power loss / kernel panic — and the slowest (each save waits on disk flush). The directory sync is a no-op on platforms where it is not available (e.g. Windows, where NTFS journaling makes the rename durable in practice).
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§
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.