feat(tvix/store/nar): add read_nar method

This adds a function that can ingest a NAR file into a given
blob_service and directory_service, returning the root node.

Passing around the directory_putter is a bit annoying, but at least for
this linear "reading through a NAR" case, we don't need it to be clone
or sync.

Change-Id: Ia26d596f5dffc6dbd69aa39a82b59bba41685a9c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9915
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-11-04 13:33:31 +02:00 committed by flokli
parent 6d7e619b8f
commit cbd72b56b2
2 changed files with 338 additions and 0 deletions

View file

@ -1,7 +1,9 @@
use data_encoding::BASE64;
use tvix_castore::{B3Digest, Error};
mod import;
mod renderer;
pub use import::read_nar;
pub use renderer::calculate_size_and_sha256;
pub use renderer::write_nar;