diff options
author | Alex Auvolat <alex@adnab.me> | 2022-06-10 11:27:58 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-06-10 11:27:58 +0200 |
commit | 180e7fef0a1bdd396865eff92ec6f1d7f0e7511e (patch) | |
tree | 46c5c358b12e2c86d56ad92a4a51640c428d93dd /src/api/admin | |
parent | c054de43dd3ccbf6a884f73a474b423bbab41d08 (diff) | |
download | garage-180e7fef0a1bdd396865eff92ec6f1d7f0e7511e.tar.gz garage-180e7fef0a1bdd396865eff92ec6f1d7f0e7511e.zip |
Actually distribute counters over nodes
Diffstat (limited to 'src/api/admin')
-rw-r--r-- | src/api/admin/bucket.rs | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index 2ceacdb5..ac8a8a40 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -33,28 +33,10 @@ pub async fn handle_list_buckets(garage: &Arc<Garage>) -> Result<Response<Body>, ) .await?; - let ring = garage.system.ring.borrow().clone(); - let counters = 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<_, _>>(); - let res = buckets .into_iter() .map(|b| { let state = b.state.as_option().unwrap(); - let empty_cnts = HashMap::new(); - let cnts = counters.get(&b.id).unwrap_or(&empty_cnts); ListBucketResultItem { id: hex::encode(b.id), global_aliases: state @@ -74,9 +56,6 @@ pub async fn handle_list_buckets(garage: &Arc<Garage>) -> Result<Response<Body>, alias: n.to_string(), }) .collect::<Vec<_>>(), - objects: cnts.get(OBJECTS).cloned().unwrap_or_default(), - bytes: cnts.get(BYTES).cloned().unwrap_or_default(), - unfinshed_uploads: cnts.get(UNFINISHED_UPLOADS).cloned().unwrap_or_default(), } }) .collect::<Vec<_>>(); @@ -90,9 +69,6 @@ struct ListBucketResultItem { id: String, global_aliases: Vec<String>, local_aliases: Vec<BucketLocalAlias>, - objects: i64, - bytes: i64, - unfinshed_uploads: i64, } #[derive(Serialize)] @@ -143,7 +119,7 @@ async fn bucket_info_results( let counters = garage .object_counter_table .table - .get(&EmptyKey, &bucket_id) + .get(&bucket_id, &EmptyKey) .await? .map(|x| x.filtered_values(&garage.system.ring.borrow())) .unwrap_or_default(); |