diff options
Diffstat (limited to 'src/api/admin/bucket.rs')
-rw-r--r-- | src/api/admin/bucket.rs | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index 2c21edee..2124f2c2 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -103,18 +103,18 @@ pub async fn handle_get_bucket_info( } }; - let bucket = garage - .bucket_helper() - .get_existing_bucket(bucket_id) - .await?; - - bucket_info_results(garage, bucket).await + bucket_info_results(garage, bucket_id).await } async fn bucket_info_results( garage: &Arc<Garage>, - bucket: Bucket, + bucket_id: Uuid, ) -> Result<Response<Body>, Error> { + let bucket = garage + .bucket_helper() + .get_existing_bucket(bucket_id) + .await?; + let mut relevant_keys = HashMap::new(); for (k, _) in bucket .state @@ -299,12 +299,7 @@ pub async fn handle_create_bucket( } } - let bucket = garage - .bucket_table - .get(&EmptyKey, &bucket.id) - .await? - .ok_or_internal_error("Bucket should now exist but doesn't")?; - bucket_info_results(garage, bucket).await + bucket_info_results(garage, bucket.id).await } #[derive(Deserialize)] @@ -425,12 +420,7 @@ pub async fn handle_bucket_change_key_perm( .set_bucket_key_permissions(bucket.id, &key.key_id, perm) .await?; - let bucket = garage - .bucket_table - .get(&EmptyKey, &bucket.id) - .await? - .ok_or_internal_error("Bucket should now exist but doesn't")?; - bucket_info_results(garage, bucket).await + bucket_info_results(garage, bucket.id).await } #[derive(Deserialize)] |