aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3
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/s3
parent30e393b439e733107755517a68ebe681dd64a2d5 (diff)
downloadgarage-5367f8adb2aab70a5478c43b93de7051a93d831b.tar.gz
garage-5367f8adb2aab70a5478c43b93de7051a93d831b.zip
Refactor bucket emptiness check and add k2v check
Diffstat (limited to 'src/api/s3')
-rw-r--r--src/api/s3/bucket.rs13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/api/s3/bucket.rs b/src/api/s3/bucket.rs
index 1304cc07..2071fe55 100644
--- a/src/api/s3/bucket.rs
+++ b/src/api/s3/bucket.rs
@@ -8,7 +8,6 @@ use garage_model::bucket_table::Bucket;
use garage_model::garage::Garage;
use garage_model::key_table::Key;
use garage_model::permission::BucketKeyPerm;
-use garage_model::s3::object_table::ObjectFilter;
use garage_table::util::*;
use garage_util::crdt::*;
use garage_util::data::*;
@@ -229,17 +228,7 @@ pub async fn handle_delete_bucket(
// Delete bucket
// 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 !garage.bucket_helper().is_bucket_empty(bucket_id).await? {
return Err(CommonError::BucketNotEmpty.into());
}