From 32f2f8b6182c5eec15acb59ced371e0adfa41db2 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 15 Sep 2023 14:48:36 +0200 Subject: feat(tvix/store/import): print store path to stdout This allows comparing the output in an integration test. Change-Id: I8bb2254e18e90005a4f1b30fd47ef69642e3732e Reviewed-on: https://cl.tvl.fyi/c/depot/+/9337 Tested-by: BuildkiteCI Reviewed-by: Adam Joseph Reviewed-by: raitobezarius Autosubmit: flokli Reviewed-by: Connor Brewster --- tvix/store/src/bin/tvix-store.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tvix/store/src/bin') diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index 7f6766d00ef2..f69c2f7fab15 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -2,6 +2,7 @@ use clap::Subcommand; use data_encoding::BASE64; use futures::future::try_join_all; use nix_compat::store_path; +use nix_compat::store_path::StorePath; use std::io; use std::path::Path; use std::path::PathBuf; @@ -17,6 +18,7 @@ use tvix_store::proto::path_info_service_server::PathInfoServiceServer; use tvix_store::proto::GRPCBlobServiceWrapper; use tvix_store::proto::GRPCDirectoryServiceWrapper; use tvix_store::proto::GRPCPathInfoServiceWrapper; +use tvix_store::proto::NamedNode; use tvix_store::proto::NarInfo; use tvix_store::proto::PathInfo; use tvix_store::FUSE; @@ -62,7 +64,7 @@ enum Commands { #[arg(long, env, default_value = "sled:///var/lib/tvix-store/pathinfo.sled")] path_info_service_addr: String, }, - /// Imports a list of paths into the store. + /// Imports a list of paths into the store, print the store path for each of them. Import { #[clap(value_name = "PATH")] paths: Vec, @@ -241,7 +243,16 @@ async fn main() -> Result<(), Box> { // from there (it might contain additional signatures). let path_info = path_info_service.put(path_info)?; - log_node(&path_info.node.unwrap().node.unwrap(), &path); + let node = path_info.node.unwrap().node.unwrap(); + + log_node(&node, &path); + + println!( + "{}", + StorePath::from_bytes(node.get_name()) + .unwrap() + .to_absolute_path() + ); Ok(()) }); -- cgit 1.4.1