From 42bf591ee5b0a397408f4e47d1ed5f702b3fec27 Mon Sep 17 00:00:00 2001 From: V Date: Mon, 18 Apr 2022 03:03:21 +0200 Subject: 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 --- ripple/fossil/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ripple/fossil/src') 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); -- cgit 1.4.1