From 9f59bf5c621d36fb956ea8a8602b0c37ceaadfe6 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 5 Oct 2024 12:58:35 +0200 Subject: Make write durability configurable --- src/common.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/common.rs') diff --git a/src/common.rs b/src/common.rs index ea179ab..33e99e7 100644 --- a/src/common.rs +++ b/src/common.rs @@ -69,6 +69,20 @@ pub enum MemtableEvictPolicy { LeastReadOrWritten, } +#[derive(Debug, Clone, Eq, PartialEq)] +pub enum WriteDurability { + /// Changes are written to an application-level write buffer without flushing to the OS write buffer or syncing to disk. + /// Offers the lowest durability guarantees but is very fast. + AsyncWrite, + /// Changes are written to the OS write buffer but not synced to disk. + /// Offers better durability guarantees than AsyncWrite but is slower. + /// This is generally recommended. Most OSes will sync the write buffer to disk within a few seconds. + Flush, + /// Changes are written to the OS write buffer and synced to disk. + /// Offers the best durability guarantees but is the slowest. + SyncWrite, +} + #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] pub enum IndexableValue { Int(i64), -- cgit v1.3