aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3/list.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-03-04 14:51:05 +0000
committerAlex <alex@adnab.me>2024-03-04 14:51:05 +0000
commit3168bb34a0082480660e945f7390a5ecab26c665 (patch)
tree2b9d53b65c41f074b772c2123f0a27893e33859a /src/api/s3/list.rs
parent512933a036be97ab01b8b2627b727d599b962715 (diff)
parentfb55682c66092921f766f82c16eb9e046f1bbb41 (diff)
downloadgarage-3168bb34a0082480660e945f7390a5ecab26c665.tar.gz
garage-3168bb34a0082480660e945f7390a5ecab26c665.zip
Merge pull request 'add request context helper' (#751) from yuka/garage:req-ctx into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/751
Diffstat (limited to 'src/api/s3/list.rs')
-rw-r--r--src/api/s3/list.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/api/s3/list.rs b/src/api/s3/list.rs
index b832a4f4..302c03f4 100644
--- a/src/api/s3/list.rs
+++ b/src/api/s3/list.rs
@@ -1,6 +1,5 @@
use std::collections::{BTreeMap, BTreeSet};
use std::iter::{Iterator, Peekable};
-use std::sync::Arc;
use base64::prelude::*;
use hyper::Response;
@@ -9,7 +8,6 @@ use garage_util::data::*;
use garage_util::error::Error as GarageError;
use garage_util::time::*;
-use garage_model::garage::Garage;
use garage_model::s3::mpu_table::*;
use garage_model::s3::object_table::*;
@@ -62,9 +60,10 @@ pub struct ListPartsQuery {
}
pub async fn handle_list(
- garage: Arc<Garage>,
+ ctx: ReqCtx,
query: &ListObjectsQuery,
) -> Result<Response<ResBody>, Error> {
+ let ReqCtx { garage, .. } = &ctx;
let io = |bucket, key, count| {
let t = &garage.object_table;
async move {
@@ -167,9 +166,11 @@ pub async fn handle_list(
}
pub async fn handle_list_multipart_upload(
- garage: Arc<Garage>,
+ ctx: ReqCtx,
query: &ListMultipartUploadsQuery,
) -> Result<Response<ResBody>, Error> {
+ let ReqCtx { garage, .. } = &ctx;
+
let io = |bucket, key, count| {
let t = &garage.object_table;
async move {
@@ -269,15 +270,14 @@ pub async fn handle_list_multipart_upload(
}
pub async fn handle_list_parts(
- garage: Arc<Garage>,
+ ctx: ReqCtx,
query: &ListPartsQuery,
) -> Result<Response<ResBody>, Error> {
debug!("ListParts {:?}", query);
let upload_id = s3_multipart::decode_upload_id(&query.upload_id)?;
- let (_, _, mpu) =
- s3_multipart::get_upload(&garage, &query.bucket_id, &query.key, &upload_id).await?;
+ let (_, _, mpu) = s3_multipart::get_upload(&ctx, &query.key, &upload_id).await?;
let (info, next) = fetch_part_info(query, &mpu)?;