diff options
author | edef <edef@unfathomable.blue> | 2022-04-28 12:58:11 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-04-28 12:58:11 +0000 |
commit | a9ca2be90b9a927d16d5ae64c09cf664cc73536d (patch) | |
tree | d9bb74c6d40e50b73ae8119b13c39256ff6e40be /ripple/fossil | |
parent | 4ed3d1fec4f1d0f00b03f6a0a86dca999694db5e (diff) | |
download | unf-legacy-a9ca2be90b9a927d16d5ae64c09cf664cc73536d.tar.zst |
ripple/fossil: outline write_blob_inner
Change-Id: I1c4a5d16cf10c464f9835c961481da221aa0d12e
Diffstat (limited to 'ripple/fossil')
-rw-r--r-- | ripple/fossil/src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ripple/fossil/src/lib.rs b/ripple/fossil/src/lib.rs index b51fc27..3b2b3f8 100644 --- a/ripple/fossil/src/lib.rs +++ b/ripple/fossil/src/lib.rs @@ -116,11 +116,14 @@ impl Store { encoder.finalize().unwrap() }; - if self.blobs.contains_key(&*ident.as_bytes()).unwrap() { - // key already exists - return ident; + if !self.blobs.contains_key(&*ident.as_bytes()).unwrap() { + self.write_blob_inner(&ident, outboard, data); } + ident + } + + fn write_blob_inner(&self, ident: &Digest, outboard: Vec<u8>, data: &[u8]) { let mut chunks_file = self.chunks.borrow_mut(); let offset = self.chunks_tail.get(); @@ -149,8 +152,6 @@ impl Store { }) .unwrap(); self.chunks_tail.set(chunks_tail); - - ident.into() } pub fn read_blob(&self, ident: Digest) -> Vec<u8> { |