feat(tvix/castore): add HashingReader, B3HashingReader

HashingReader wraps an existing AsyncRead, and allows querying for the
digest of all data read "through" it.
The hash function is configurable by type parameter, and we define
B3HashingReader.

Change-Id: Ic08142077566fc08836662218f5ec8c3aff80be5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11087
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-03-03 14:46:54 +02:00 committed by clbot
parent 8383e9e02e
commit 4b4443240e
2 changed files with 90 additions and 0 deletions

View file

@ -1,5 +1,6 @@
mod digests;
mod errors;
mod hashing_reader;
pub mod blobservice;
pub mod directoryservice;
@ -15,6 +16,7 @@ pub mod utils;
pub use digests::{B3Digest, B3_LEN};
pub use errors::Error;
pub use hashing_reader::{B3HashingReader, HashingReader};
#[cfg(test)]
mod tests;