diff options
author | V <v@unfathomable.blue> | 2022-04-18 03:03:21 +0200 |
---|---|---|
committer | V <v@unfathomable.blue> | 2022-04-18 03:03:21 +0200 |
commit | 42bf591ee5b0a397408f4e47d1ed5f702b3fec27 (patch) | |
tree | f0a35c7d1ec29f9bc01996fc0b3f7f847eb1c09b /ripple | |
parent | 41bc547fba13a2289c6c57ca432ad2f3e6e7b4e0 (diff) | |
download | unf-legacy-42bf591ee5b0a397408f4e47d1ed5f702b3fec27.tar.zst |
ripple/fossil: use blake3::CHUNK_LEN as chunk size
This will pave the way for BLAKE3 verified streaming, so we won't have to read objects into memory in their entirety. Change-Id: Ic68dee2ad81448db4969b8c423f0876f0e0272e0
Diffstat (limited to 'ripple')
-rw-r--r-- | ripple/fossil/src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ripple/fossil/src/lib.rs b/ripple/fossil/src/lib.rs index 8ed5410..37df3bd 100644 --- a/ripple/fossil/src/lib.rs +++ b/ripple/fossil/src/lib.rs @@ -11,6 +11,7 @@ pub mod store { include!(concat!(env!("OUT_DIR"), "/fossil.store.rs")); } +const CHUNK_BYTES: usize = blake3::CHUNK_LEN; const DIGEST_BYTES: usize = blake3::OUT_LEN; const OFFSET_BYTES: usize = 4; @@ -86,7 +87,7 @@ impl Store { self.db .transaction::<_, _, sled::Error>(|db| { - for (n, chunk) in data.chunks(4096).enumerate() { + for (n, chunk) in data.chunks(CHUNK_BYTES).enumerate() { let mut key = [0u8; DIGEST_BYTES + OFFSET_BYTES]; key[..DIGEST_BYTES].copy_from_slice(&digest); BigEndian::write_u32(&mut key[DIGEST_BYTES..], n as u32); |