aboutsummaryrefslogtreecommitdiff
path: root/src/garage/admin.rs
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/garage/admin.rs
parent30e393b439e733107755517a68ebe681dd64a2d5 (diff)
downloadgarage-5367f8adb2aab70a5478c43b93de7051a93d831b.tar.gz
garage-5367f8adb2aab70a5478c43b93de7051a93d831b.zip
Refactor bucket emptiness check and add k2v check
Diffstat (limited to 'src/garage/admin.rs')
-rw-r--r--src/garage/admin.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/garage/admin.rs b/src/garage/admin.rs
index c1ba297b..bc1f494a 100644
--- a/src/garage/admin.rs
+++ b/src/garage/admin.rs
@@ -22,7 +22,6 @@ use garage_model::helper::error::{Error, OkOrBadRequest};
use garage_model::key_table::*;
use garage_model::migrate::Migrate;
use garage_model::permission::*;
-use garage_model::s3::object_table::ObjectFilter;
use crate::cli::*;
use crate::repair::Repair;
@@ -213,18 +212,7 @@ impl AdminRpcHandler {
}
// Check bucket is empty
- let objects = self
- .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(Error::BadRequest(format!(
"Bucket {} is not empty",
query.name