diff options
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/admin.rs | 26 | ||||
-rw-r--r-- | src/garage/cli/cmd.rs | 4 | ||||
-rw-r--r-- | src/garage/cli/util.rs | 13 |
3 files changed, 8 insertions, 35 deletions
diff --git a/src/garage/admin.rs b/src/garage/admin.rs index 6630ae16..48914655 100644 --- a/src/garage/admin.rs +++ b/src/garage/admin.rs @@ -39,10 +39,7 @@ pub enum AdminRpc { // Replies Ok(String), - BucketList { - buckets: Vec<Bucket>, - counters: HashMap<Uuid, HashMap<String, i64>>, - }, + BucketList(Vec<Bucket>), BucketInfo { bucket: Bucket, relevant_keys: HashMap<String, Key>, @@ -97,24 +94,7 @@ impl AdminRpcHandler { ) .await?; - let ring = self.garage.system.ring.borrow().clone(); - let counters = self - .garage - .object_counter_table - .table - .get_range( - &EmptyKey, - None, - Some((DeletedFilter::NotDeleted, ring.layout.node_id_vec.clone())), - 15000, - EnumerationOrder::Forward, - ) - .await? - .iter() - .map(|x| (x.sk, x.filtered_values(&ring))) - .collect::<HashMap<_, _>>(); - - Ok(AdminRpc::BucketList { buckets, counters }) + Ok(AdminRpc::BucketList(buckets)) } async fn handle_bucket_info(&self, query: &BucketOpt) -> Result<AdminRpc, Error> { @@ -135,7 +115,7 @@ impl AdminRpcHandler { .garage .object_counter_table .table - .get(&EmptyKey, &bucket_id) + .get(&bucket_id, &EmptyKey) .await? .map(|x| x.filtered_values(&self.garage.system.ring.borrow())) .unwrap_or_default(); diff --git a/src/garage/cli/cmd.rs b/src/garage/cli/cmd.rs index e8e834e8..3a0bd956 100644 --- a/src/garage/cli/cmd.rs +++ b/src/garage/cli/cmd.rs @@ -166,8 +166,8 @@ pub async fn cmd_admin( AdminRpc::Ok(msg) => { println!("{}", msg); } - AdminRpc::BucketList { buckets, counters } => { - print_bucket_list(buckets, counters); + AdminRpc::BucketList(bl) => { + print_bucket_list(bl); } AdminRpc::BucketInfo { bucket, diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs index 28a34daa..329e8a3e 100644 --- a/src/garage/cli/util.rs +++ b/src/garage/cli/util.rs @@ -9,11 +9,11 @@ use garage_model::bucket_table::*; use garage_model::key_table::*; use garage_model::s3::object_table::{BYTES, OBJECTS, UNFINISHED_UPLOADS}; -pub fn print_bucket_list(buckets: Vec<Bucket>, counters: HashMap<Uuid, HashMap<String, i64>>) { +pub fn print_bucket_list(bl: Vec<Bucket>) { println!("List of buckets:"); let mut table = vec![]; - for bucket in buckets { + for bucket in bl { let aliases = bucket .aliases() .iter() @@ -31,18 +31,11 @@ pub fn print_bucket_list(buckets: Vec<Bucket>, counters: HashMap<Uuid, HashMap<S s => format!("[{} local aliases]", s.len()), }; - let empty_counters = HashMap::new(); - let cnt = counters.get(&bucket.id).unwrap_or(&empty_counters); - table.push(format!( - "\t{}\t{}\t{}\t{}\t{}\t{}", + "\t{}\t{}\t{}", aliases.join(","), local_aliases_n, hex::encode(bucket.id), - bytesize::ByteSize::b(cnt.get(BYTES).cloned().unwrap_or_default() as u64) - .to_string_as(true), - cnt.get(OBJECTS).cloned().unwrap_or_default(), - cnt.get(UNFINISHED_UPLOADS).cloned().unwrap_or_default(), )); } format_table(table); |