aboutsummaryrefslogtreecommitdiff
path: root/src/garage/admin/key.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-02-22 12:05:19 +0000
committerAlex <alex@adnab.me>2024-02-22 12:05:19 +0000
commit74d0c47f21ae2f9998a7dcbca3a27e3cc51e70b6 (patch)
treef7747f950672246c1ecc079e50222a07d23bc635 /src/garage/admin/key.rs
parent7e212e20e02b9cdced52ce23111214c6285a095a (diff)
parentcff702a951cb5bb193c7a891ababfd1d962ae9ed (diff)
downloadgarage-74d0c47f21ae2f9998a7dcbca3a27e3cc51e70b6.tar.gz
garage-74d0c47f21ae2f9998a7dcbca3a27e3cc51e70b6.zip
Merge pull request 'Add node-global lock for bucket/key operations (fix #723)' (#728) from lock-createbucket into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/728
Diffstat (limited to 'src/garage/admin/key.rs')
-rw-r--r--src/garage/admin/key.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/garage/admin/key.rs b/src/garage/admin/key.rs
index 1c92670c..bd010d2c 100644
--- a/src/garage/admin/key.rs
+++ b/src/garage/admin/key.rs
@@ -76,9 +76,10 @@ impl AdminRpcHandler {
}
async fn handle_delete_key(&self, query: &KeyDeleteOpt) -> Result<AdminRpc, Error> {
- let key_helper = self.garage.key_helper();
+ let helper = self.garage.locked_helper().await;
- let mut key = key_helper
+ let mut key = helper
+ .key()
.get_existing_matching_key(&query.key_pattern)
.await?;
@@ -88,7 +89,7 @@ impl AdminRpcHandler {
));
}
- key_helper.delete_key(&mut key).await?;
+ helper.delete_key(&mut key).await?;
Ok(AdminRpc::Ok(format!(
"Key {} was deleted successfully.",