pub enum SyncMode {
FastThenSafe,
Safe,
Fast,
}
Expand description
Disk synchronization mode.
This controls how/when the database syncs its data to disk.
Regardless of the variant chosen, dropping Env
will always cause it to fully sync to disk.
Variants§
FastThenSafe
Use SyncMode::Fast
until fully synced,
then use SyncMode::Safe
.
§TODO
This is not implemented internally and has the same behavior as SyncMode::Fast
.
Safe
Fully sync to disk per transaction.
Every database transaction commit will fully sync all data to disk, synchronously, so the database (writer) halts until synced.
This is expected to be very slow.
This maps to:
- LMDB without any special sync flags
redb::Durability::Immediate
Fast
Only flush at database shutdown.
This is the fastest, yet unsafest option.
It will cause the database to never actively sync, letting the OS decide when to flush data to disk1.
This maps to:
§Default
This is the default SyncMode
.
use cuprate_database::config::SyncMode;
assert_eq!(SyncMode::default(), SyncMode::Fast);
§Corruption
In the case of a system crash, the database may become corrupted when using this option.
Semantically, this variant would actually map to
redb::Durability::None
, however due to#149
, this is not possible. As such, when using theredb
backend, transaction writes “should be persistent some time afterWriteTransaction::commit
returns.” ↩
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SyncMode
impl<'de> Deserialize<'de> for SyncMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for SyncMode
impl Ord for SyncMode
Source§impl PartialOrd for SyncMode
impl PartialOrd for SyncMode
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 UnwindSafe for SyncMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
FastThenSafe
: 0 bytesSafe
: 0 bytesFast
: 0 bytes