aboutsummaryrefslogtreecommitdiff
path: root/src/garage/cli/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/cli/util.rs')
-rw-r--r--src/garage/cli/util.rs85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs
index acf7923e..a3a1480e 100644
--- a/src/garage/cli/util.rs
+++ b/src/garage/cli/util.rs
@@ -3,101 +3,16 @@ use std::time::Duration;
use format_table::format_table;
use garage_util::background::*;
-use garage_util::crdt::*;
use garage_util::data::*;
use garage_util::time::*;
use garage_block::manager::BlockResyncErrorInfo;
-use garage_model::bucket_table::*;
-use garage_model::key_table::*;
use garage_model::s3::mpu_table::MultipartUpload;
use garage_model::s3::version_table::*;
use crate::cli::structs::WorkerListOpt;
-pub fn print_key_list(kl: Vec<(String, String)>) {
- println!("List of keys:");
- let mut table = vec![];
- for key in kl {
- table.push(format!("\t{}\t{}", key.0, key.1));
- }
- format_table(table);
-}
-
-pub fn print_key_info(key: &Key, relevant_buckets: &HashMap<Uuid, Bucket>) {
- let bucket_global_aliases = |b: &Uuid| {
- if let Some(bucket) = relevant_buckets.get(b) {
- if let Some(p) = bucket.state.as_option() {
- return p
- .aliases
- .items()
- .iter()
- .filter(|(_, _, active)| *active)
- .map(|(a, _, _)| a.clone())
- .collect::<Vec<_>>()
- .join(", ");
- }
- }
-
- "".to_string()
- };
-
- match &key.state {
- Deletable::Present(p) => {
- println!("Key name: {}", p.name.get());
- println!("Key ID: {}", key.key_id);
- println!("Secret key: {}", p.secret_key);
- println!("Can create buckets: {}", p.allow_create_bucket.get());
- println!("\nKey-specific bucket aliases:");
- let mut table = vec![];
- for (alias_name, _, alias) in p.local_aliases.items().iter() {
- if let Some(bucket_id) = alias {
- table.push(format!(
- "\t{}\t{}\t{}",
- alias_name,
- bucket_global_aliases(bucket_id),
- hex::encode(bucket_id)
- ));
- }
- }
- format_table(table);
-
- println!("\nAuthorized buckets:");
- let mut table = vec![];
- for (bucket_id, perm) in p.authorized_buckets.items().iter() {
- if !perm.is_any() {
- continue;
- }
- let rflag = if perm.allow_read { "R" } else { " " };
- let wflag = if perm.allow_write { "W" } else { " " };
- let oflag = if perm.allow_owner { "O" } else { " " };
- let local_aliases = p
- .local_aliases
- .items()
- .iter()
- .filter(|(_, _, a)| *a == Some(*bucket_id))
- .map(|(a, _, _)| a.clone())
- .collect::<Vec<_>>()
- .join(", ");
- table.push(format!(
- "\t{}{}{}\t{}\t{}\t{:?}",
- rflag,
- wflag,
- oflag,
- bucket_global_aliases(bucket_id),
- local_aliases,
- bucket_id
- ));
- }
- format_table(table);
- }
- Deletable::Deleted => {
- println!("Key {} is deleted.", key.key_id);
- }
- }
-}
-
pub fn print_worker_list(wi: HashMap<usize, WorkerInfo>, wlo: WorkerListOpt) {
let mut wi = wi.into_iter().collect::<Vec<_>>();
wi.sort_by_key(|(tid, info)| {