diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2024-11-09 22:30:51 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2024-11-10 00:02:32 +0200 |
| commit | bfa8fab553eab1b0daa062010fb2ccf5d365d21f (patch) | |
| tree | ebbb5575dcf361c176dc721a4d1c2b4183de90fa /log_db/src/memtable_primary.rs | |
| parent | 2975980717626b12eb959c1ecd93038b5be1d7c6 (diff) | |
Refresh indexes on read or at maintenance
Diffstat (limited to 'log_db/src/memtable_primary.rs')
| -rw-r--r-- | log_db/src/memtable_primary.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/log_db/src/memtable_primary.rs b/log_db/src/memtable_primary.rs index 9d7e1e8..8340cdd 100644 --- a/log_db/src/memtable_primary.rs +++ b/log_db/src/memtable_primary.rs @@ -2,14 +2,9 @@ use super::common::*; use std::collections::BTreeMap; pub struct PrimaryMemtable { - /// Map of records indexed by key. Used as a shared heap of records - /// for all secondary memtables also. Secondary memtables store an - /// IndexableValue as their record value, which is used to get - /// the actual record from the primary memtable `records` map. - /// - /// Note: it must be invariant that all memtables (primary and secondary) - /// contain the same keys. - records: BTreeMap<IndexableValue, Record>, + /// Map of record locations indexed by key. Use the `LogKey` values to look up + /// the actual records in the log files. + records: BTreeMap<IndexableValue, LogKey>, } impl PrimaryMemtable { @@ -19,15 +14,11 @@ impl PrimaryMemtable { } } - pub fn set(&mut self, key: &IndexableValue, value: &Record) { + pub fn set(&mut self, key: &IndexableValue, value: &LogKey) { self.records.insert(key.clone(), value.clone()); } - pub fn get(&mut self, key: &IndexableValue) -> Option<&Record> { - self.records.get(key) - } - - pub fn get_without_update(&self, key: &IndexableValue) -> Option<&Record> { + pub fn get(&self, key: &IndexableValue) -> Option<&LogKey> { self.records.get(key) } } |
