refactor: move iterator trait to parent mod

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2022-12-24 18:25:41 -05:00
parent 7a571a7c7d
commit d8cc9b2cf8
22 changed files with 79 additions and 49 deletions

View File

@@ -45,24 +45,32 @@ impl LsmStorage {
})
}
/// Get a key from the storage. In day 7, this can be further optimized by using a bloom filter.
pub fn get(&self, key: &[u8]) -> Result<Option<Bytes>> {
unimplemented!()
}
/// Put a key-value pair into the storage by writing into the current memtable.
pub fn put(&self, key: &[u8], value: &[u8]) -> Result<()> {
assert!(!value.is_empty(), "value cannot be empty");
assert!(!key.is_empty(), "key cannot be empty");
unimplemented!()
}
/// Remove a key from the storage by writing an empty value.
pub fn delete(&self, _key: &[u8]) -> Result<()> {
unimplemented!()
}
/// Persist data to disk.
///
/// In day 3: flush the current memtable to disk as L0 SST.
/// In day 6: call `fsync` on WAL.
pub fn sync(&self) -> Result<()> {
unimplemented!()
}
/// Create an iterator over a range of keys.
pub fn scan(
&self,
_lower: Bound<&[u8]>,