about summary refs log tree commit diff
path: root/tvix/store/src
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-09-15T12·48+0200
committerflokli <flokli@flokli.de>2023-09-15T21·00+0000
commit32f2f8b6182c5eec15acb59ced371e0adfa41db2 (patch)
treedbffccddea314e0f993a2dc1e57084477980823c /tvix/store/src
parentb52bb6e7915c6f2cb481a90918ce6483f0a43ad4 (diff)
feat(tvix/store/import): print store path to stdout r/6595
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 <adam@westernsemico.com>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/store/src')
-rw-r--r--tvix/store/src/bin/tvix-store.rs15
1 files changed, 13 insertions, 2 deletions
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<PathBuf>,
@@ -241,7 +243,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
                         // 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(())
                     });