From 5367f8adb2aab70a5478c43b93de7051a93d831b Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 18 May 2022 10:09:51 +0200 Subject: Refactor bucket emptiness check and add k2v check --- src/api/admin/bucket.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/api/admin') diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index 3ad2c735..30dc3436 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -14,7 +14,6 @@ use garage_model::bucket_alias_table::*; use garage_model::bucket_table::*; use garage_model::garage::Garage; use garage_model::permission::*; -use garage_model::s3::object_table::ObjectFilter; use crate::admin::error::*; use crate::admin::key::ApiBucketKeyPerm; @@ -327,17 +326,7 @@ pub async fn handle_delete_bucket( let state = bucket.state.as_option().unwrap(); // Check bucket is empty - let objects = garage - .object_table - .get_range( - &bucket_id, - None, - Some(ObjectFilter::IsData), - 10, - EnumerationOrder::Forward, - ) - .await?; - if !objects.is_empty() { + if !helper.is_bucket_empty(bucket_id).await? { return Err(CommonError::BucketNotEmpty.into()); } -- cgit v1.2.3