aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/src
diff options
context:
space:
mode:
Diffstat (limited to 'log_db/src')
-rw-r--r--log_db/src/common.rs2
-rw-r--r--log_db/src/lib.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/log_db/src/common.rs b/log_db/src/common.rs
index 4f5751d..8bdcd9a 100644
--- a/log_db/src/common.rs
+++ b/log_db/src/common.rs
@@ -216,7 +216,7 @@ 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.
+ /// 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.
diff --git a/log_db/src/lib.rs b/log_db/src/lib.rs
index e9a25c1..4d9b82f 100644
--- a/log_db/src/lib.rs
+++ b/log_db/src/lib.rs
@@ -247,7 +247,9 @@ impl<R: Recordable> DB<R> {
Ok(db)
}
- fn refresh_indexes(&mut self) -> Result<(), DBError> {
+ /// Refresh the in-memory indexes from the log files.
+ /// This needs to only be called if the read consistency is set to `ReadConsistency::Eventual`.
+ pub fn refresh_indexes(&mut self) -> Result<(), DBError> {
let active_symlink_path = self.data_dir.join(ACTIVE_SYMLINK_FILENAME);
let active_target = fs::read_link(active_symlink_path)?;
let active_metadata_path = self.data_dir.join(active_target);
@@ -796,8 +798,6 @@ impl<R: Recordable> DB<R> {
self.active_metadata_file.unlock()?;
- self.refresh_indexes()?;
-
Ok(())
}