Track CAS providers
This commit is contained in:
parent
df70b81a1d
commit
c9803ea7f2
8 changed files with 161 additions and 11 deletions
|
|
@ -243,6 +243,9 @@ pub enum CasCommand {
|
|||
#[arg(long)]
|
||||
dry_run: bool,
|
||||
},
|
||||
Providers {
|
||||
hash: String,
|
||||
},
|
||||
List,
|
||||
Root {
|
||||
#[command(subcommand)]
|
||||
|
|
@ -593,6 +596,7 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
CasCommand::Pin { hash } => ControlRequest::CasPin { hash: hash.into() },
|
||||
CasCommand::Unpin { hash } => ControlRequest::CasUnpin { hash: hash.into() },
|
||||
CasCommand::Cleanup { dry_run } => ControlRequest::CasCleanup { dry_run },
|
||||
CasCommand::Providers { hash } => ControlRequest::CasProviders { hash: hash.into() },
|
||||
CasCommand::List => ControlRequest::CasList,
|
||||
CasCommand::Root { command } => match command {
|
||||
CasRootCommand::Add { name, path } => ControlRequest::CasRootAdd { name, path },
|
||||
|
|
@ -979,6 +983,16 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
println!("{}\t{} bytes\t{}", blob.hash, blob.size_bytes, pin);
|
||||
}
|
||||
}
|
||||
ControlResponse::CasProviders { hash, providers } => {
|
||||
println!("hash: {hash}");
|
||||
println!("providers: {}", providers.len());
|
||||
for provider in providers {
|
||||
println!(
|
||||
"{}\t{}\t{}",
|
||||
provider.peer_node_id, provider.endpoint_id, provider.last_seen_ms
|
||||
);
|
||||
}
|
||||
}
|
||||
ControlResponse::CasRootAdded { root } => {
|
||||
println!("added file root: {}", root.name);
|
||||
println!("id: {}", root.id);
|
||||
|
|
|
|||
Loading…
Reference in a new issue