diff options
author | Alex <alex@adnab.me> | 2024-03-04 14:51:05 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-03-04 14:51:05 +0000 |
commit | 3168bb34a0082480660e945f7390a5ecab26c665 (patch) | |
tree | 2b9d53b65c41f074b772c2123f0a27893e33859a /src/api/helpers.rs | |
parent | 512933a036be97ab01b8b2627b727d599b962715 (diff) | |
parent | fb55682c66092921f766f82c16eb9e046f1bbb41 (diff) | |
download | garage-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/helpers.rs')
-rw-r--r-- | src/api/helpers.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/api/helpers.rs b/src/api/helpers.rs index 5f488912..cf60005d 100644 --- a/src/api/helpers.rs +++ b/src/api/helpers.rs @@ -1,4 +1,5 @@ use std::convert::Infallible; +use std::sync::Arc; use futures::{Stream, StreamExt, TryStreamExt}; @@ -10,6 +11,10 @@ use hyper::{ use idna::domain_to_unicode; use serde::{Deserialize, Serialize}; +use garage_model::bucket_table::BucketParams; +use garage_model::garage::Garage; +use garage_model::key_table::Key; +use garage_util::data::Uuid; use garage_util::error::Error as GarageError; use crate::common_error::{CommonError as Error, *}; @@ -27,6 +32,15 @@ pub enum Authorization { Owner, } +/// The values which are known for each request related to a bucket +pub struct ReqCtx { + pub garage: Arc<Garage>, + pub bucket_id: Uuid, + pub bucket_name: String, + pub bucket_params: BucketParams, + pub api_key: Key, +} + /// Host to bucket /// /// Convert a host, like "bucket.garage-site.tld" to the corresponding bucket "bucket", |