From 0db73cb2bd94ce2449571b5707de35b283da0091 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 29 Jan 2023 20:48:23 +0100 Subject: feat(tvix/store): add write_nar function This adds a function that consumes a [proto::node::Node] pointing to the root of a (store) path, and writes the contents in NAR serialization to the passed [std::io::Write]. We need this in various places: - tvix-store's calculate_nar() RPC method needs to render a NAR stream to get the nar hash, which is necessary to give things imported in the store a "NAR-based" store path. - communication with (remote) Nix (via daemon protocol) needs a NAR representation. - Things like nar-bridge, exposing a NAR/NARInfo HTTP interface need a NAR representation. Change-Id: I7fb2e0bf01814a1c09094c0e35394d9d6b3e43b6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7956 Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/store/src/client.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tvix/store/src/client.rs (limited to 'tvix/store/src/client.rs') diff --git a/tvix/store/src/client.rs b/tvix/store/src/client.rs new file mode 100644 index 000000000000..3b282eacdd70 --- /dev/null +++ b/tvix/store/src/client.rs @@ -0,0 +1,10 @@ +use crate::proto::Directory; + +pub trait StoreClient { + fn open_blob(&self, digest: Vec) -> std::io::Result>; + + // TODO: stat_blob, put_blob? + fn get_directory(&self, digest: Vec) -> std::io::Result>; + + // TODO: put_directory +} -- cgit 1.4.1