finish persistence

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2024-01-19 17:28:47 +08:00
parent 13ae8fe8fb
commit 6b24d6dfab
9 changed files with 219 additions and 50 deletions

View File

@@ -47,8 +47,14 @@ impl MemTable {
})
}
/// Create a memtable from WAL
pub fn recover_from_wal(id: usize, path: impl AsRef<Path>) -> Result<Self> {
unimplemented!()
let map = Arc::new(SkipMap::new());
Ok(Self {
id,
wal: Some(Wal::recover(path.as_ref(), &map)?),
map,
})
}
/// Get a value by key.