Implement Garbage Collection

This commit is contained in:
Yuriy Dupyn 2024-02-05 01:34:16 +01:00
parent 1086b2fc5e
commit f3fc67cbbc
4 changed files with 43 additions and 20 deletions

View file

@ -100,6 +100,11 @@ where
Ok(())
}
pub async fn reset(&mut self, data: BTreeMap<K, HashSet<V>>) -> Result<()> {
self.data = data;
self.sync_to_disk().await
}
async fn append_to_file(&mut self, key: &K, value: &V) -> Result<()> {
let mut encoded = Vec::new();
encoded.extend(encode(key)?);