refactor(tvix/store/nar/import): add ingest_nar_and_hash

This wraps ingest_nar, but also keeps track of the number of bytes read,
and calculates the sha256 digest of it.

Make use of it in the NixHTTPPathInfoService, where this code is coming
from.

Change-Id: I9c54e93d3ec8ed9ede87aed43e04d114fb06897b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11787
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-06-11 15:46:52 +03:00 committed by clbot
parent beb7f57c73
commit ff40332864
3 changed files with 46 additions and 23 deletions

View file

@ -4,6 +4,7 @@ use tvix_castore::B3Digest;
mod import;
mod renderer;
pub use import::ingest_nar;
pub use import::ingest_nar_and_hash;
pub use renderer::calculate_size_and_sha256;
pub use renderer::write_nar;
pub use renderer::SimpleRenderer;