aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-18 10:09:51 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-18 10:09:51 +0200
commit5367f8adb2aab70a5478c43b93de7051a93d831b (patch)
tree5fdd7ba2d9047b6875d45088bd0792d0fe05cdf8 /src/api/admin
parent30e393b439e733107755517a68ebe681dd64a2d5 (diff)
downloadgarage-5367f8adb2aab70a5478c43b93de7051a93d831b.tar.gz
garage-5367f8adb2aab70a5478c43b93de7051a93d831b.zip
Refactor bucket emptiness check and add k2v check
Diffstat (limited to 'src/api/admin')
-rw-r--r--src/api/admin/bucket.rs13
1 files changed, 1 insertions, 12 deletions
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());
}