summaryrefslogtreecommitdiff
path: root/src/store.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-09-19 08:12:54 +0300
committerLars Wirzenius <liw@liw.fi>2020-09-19 10:13:49 +0300
commit70b8d232c2b7e2892a117f61e3a9892bf4994ea4 (patch)
tree691804e9e8a63d1f5bb6750a20a0d3c0cd6fa6f7 /src/store.rs
parente1c4683b73ec2a207321377636f4ed722d0674dc (diff)
downloadobnam2-70b8d232c2b7e2892a117f61e3a9892bf4994ea4.tar.gz
feat: search, delete chunks on chunk server
Also heavily refactor the now-long scenario by splitting out a happy path and some unhappy paths.
Diffstat (limited to 'src/store.rs')
-rw-r--r--src/store.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/store.rs b/src/store.rs
index 0c15f02..873b8f2 100644
--- a/src/store.rs
+++ b/src/store.rs
@@ -44,4 +44,11 @@ impl Store {
let data = std::fs::read(&self.filename(id, "data"))?;
Ok(Chunk::new(meta, data))
}
+
+ /// Delete a chunk from a store.
+ pub fn delete(&self, id: &ChunkId) -> anyhow::Result<()> {
+ std::fs::remove_file(&self.filename(id, "meta"))?;
+ std::fs::remove_file(&self.filename(id, "data"))?;
+ Ok(())
+ }
}