summaryrefslogtreecommitdiff
path: root/src/indexedstore.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-05-24 08:55:14 +0300
committerLars Wirzenius <liw@liw.fi>2021-05-29 11:41:15 +0300
commit6de230c382a4329df00bc11cc1ffb90390b13159 (patch)
treed4f0668be0d5cd07ea32af2b0978696658532122 /src/indexedstore.rs
parent566dd94d2e46c489b50d84a1fd24683460e5cfdc (diff)
downloadobnam2-6de230c382a4329df00bc11cc1ffb90390b13159.tar.gz
refactor: make metadata be part of datachunk
This makes it harder to lose the metadata for a chunk, or to use unrelated metadata and chunk. Also, soon I will refactor things for encrypting chunks, which will need metadata embedded in the encrypted chunk. Sponsored-by: author
Diffstat (limited to 'src/indexedstore.rs')
-rw-r--r--src/indexedstore.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/indexedstore.rs b/src/indexedstore.rs
index 7f67a1f..982e2d9 100644
--- a/src/indexedstore.rs
+++ b/src/indexedstore.rs
@@ -40,10 +40,10 @@ impl IndexedStore {
Ok(Self { store, index })
}
- pub fn save(&mut self, meta: &ChunkMeta, chunk: &DataChunk) -> IndexedResult<ChunkId> {
+ pub fn save(&mut self, chunk: &DataChunk) -> IndexedResult<ChunkId> {
let id = ChunkId::new();
- self.store.save(&id, meta, chunk)?;
- self.insert_meta(&id, meta)?;
+ self.store.save(&id, chunk)?;
+ self.insert_meta(&id, chunk.meta())?;
Ok(id)
}