aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3/multipart.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-10-18 16:36:48 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-18 16:36:48 +0200
commit3d6ed63824ac2190ba0522d897ef9addb8823140 (patch)
tree0c2b1de11e1f6715976c11fee0484f62728ebb3e /src/api/s3/multipart.rs
parent45b0453d0f5b08f44dbd010c084daa87c2876945 (diff)
downloadgarage-3d6ed63824ac2190ba0522d897ef9addb8823140.tar.gz
garage-3d6ed63824ac2190ba0522d897ef9addb8823140.zip
check_quotas: avoid re-fetching object from object table
Diffstat (limited to 'src/api/s3/multipart.rs')
-rw-r--r--src/api/s3/multipart.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/s3/multipart.rs b/src/api/s3/multipart.rs
index 52ea8e78..b6001142 100644
--- a/src/api/s3/multipart.rs
+++ b/src/api/s3/multipart.rs
@@ -233,7 +233,7 @@ pub async fn handle_complete_multipart_upload(
// Get object and multipart upload
let key = key.to_string();
- let (_, mut object_version, mpu) = get_upload(&garage, &bucket.id, &key, &upload_id).await?;
+ let (object, mut object_version, mpu) = get_upload(&garage, &bucket.id, &key, &upload_id).await?;
if mpu.parts.is_empty() {
return Err(Error::bad_request("No data was uploaded"));
@@ -331,7 +331,7 @@ pub async fn handle_complete_multipart_upload(
// Calculate total size of final object
let total_size = parts.iter().map(|x| x.size.unwrap()).sum();
- if let Err(e) = check_quotas(&garage, bucket, &key, total_size).await {
+ if let Err(e) = check_quotas(&garage, bucket, &key, total_size, Some(&object)).await {
object_version.state = ObjectVersionState::Aborted;
let final_object = Object::new(bucket.id, key.clone(), vec![object_version]);
garage.object_table.insert(&final_object).await?;