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 <adam@westernsemico.com> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
parent
b52bb6e791
commit
32f2f8b618
1 changed files with 13 additions and 2 deletions
|
@ -2,6 +2,7 @@ use clap::Subcommand;
|
||||||
use data_encoding::BASE64;
|
use data_encoding::BASE64;
|
||||||
use futures::future::try_join_all;
|
use futures::future::try_join_all;
|
||||||
use nix_compat::store_path;
|
use nix_compat::store_path;
|
||||||
|
use nix_compat::store_path::StorePath;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
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::GRPCBlobServiceWrapper;
|
||||||
use tvix_store::proto::GRPCDirectoryServiceWrapper;
|
use tvix_store::proto::GRPCDirectoryServiceWrapper;
|
||||||
use tvix_store::proto::GRPCPathInfoServiceWrapper;
|
use tvix_store::proto::GRPCPathInfoServiceWrapper;
|
||||||
|
use tvix_store::proto::NamedNode;
|
||||||
use tvix_store::proto::NarInfo;
|
use tvix_store::proto::NarInfo;
|
||||||
use tvix_store::proto::PathInfo;
|
use tvix_store::proto::PathInfo;
|
||||||
use tvix_store::FUSE;
|
use tvix_store::FUSE;
|
||||||
|
@ -62,7 +64,7 @@ enum Commands {
|
||||||
#[arg(long, env, default_value = "sled:///var/lib/tvix-store/pathinfo.sled")]
|
#[arg(long, env, default_value = "sled:///var/lib/tvix-store/pathinfo.sled")]
|
||||||
path_info_service_addr: String,
|
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 {
|
Import {
|
||||||
#[clap(value_name = "PATH")]
|
#[clap(value_name = "PATH")]
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
|
@ -241,7 +243,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// from there (it might contain additional signatures).
|
// from there (it might contain additional signatures).
|
||||||
let path_info = path_info_service.put(path_info)?;
|
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(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue