aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/src/common.rs
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-01-17 15:25:46 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-01-17 15:25:46 +0200
commit98430c35eeb27b1bb3c7ac7a9e30a6918514358a (patch)
tree5a319c629d508d91ad4dcce325aa7b1956afdfad /log_db/src/common.rs
parent953f6d0b2a8c85f08ade5cc5526d4c44f2abcddd (diff)
Refactor DB into DB and Engine
Diffstat (limited to 'log_db/src/common.rs')
-rw-r--r--log_db/src/common.rs30
1 files changed, 1 insertions, 29 deletions
diff --git a/log_db/src/common.rs b/log_db/src/common.rs
index 5539689..09de2d7 100644
--- a/log_db/src/common.rs
+++ b/log_db/src/common.rs
@@ -3,7 +3,6 @@ use once_cell::sync::Lazy;
use rust_decimal::Decimal;
use std::cmp::Ordering;
use std::collections::HashSet;
-use std::fmt::Display;
use std::fs::{self, metadata, File};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::ops::{Bound, RangeBounds};
@@ -201,33 +200,6 @@ impl MetadataHeader {
}
}
-#[derive(Debug, Clone, Eq, PartialEq)]
-pub enum ReadConsistency {
- /// Reads by client A are guaranteed to see writes by themselves and any writes by other clients B
- /// that were done before last index refresh. You must call `refresh_indexes()` manually to refresh indexes.
- Eventual,
- /// Reads by client A are guaranteed to see all writes. This is slower: all reads must first
- /// refresh indexes.
- Strong,
-}
-
-#[derive(Debug, Clone, Eq, PartialEq)]
-pub enum WriteDurability {
- /// Changes are written to the OS write buffer but not immediately synced to disk.
- /// 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 immediately.
- /// Offers the best durability guarantees but is a lot slower.
- FlushSync,
-}
-
-impl Display for WriteDurability {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
- write!(f, "{:?}", self)?;
- Ok(())
- }
-}
-
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub enum IndexableValue {
Null,
@@ -680,8 +652,8 @@ pub fn ensure_active_metadata_is_valid(
const LOCK_WAIT_MAX_MS: u64 = 1000;
- let lock_request_path = data_dir.join(EXCL_LOCK_REQUEST_FILENAME);
pub fn is_exclusive_lock_requested(data_dir: &Path) -> DBResult<bool> {
+ let lock_request_path = data_dir.join(EXCL_LOCK_REQUEST_FILENAME);
let lock_request_file = fs::OpenOptions::new()
.create(true)
.write(true) // When requesting a lock, we need to have either read or write permissions