mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-12 15:26:52 +00:00
wip: split garage_api into garage_api_{common,s3,k2v,admin}
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
[package]
|
||||
name = "garage_api_k2v"
|
||||
version = "1.0.1"
|
||||
authors = ["Alex Auvolat <alex@adnab.me>"]
|
||||
edition = "2018"
|
||||
license = "AGPL-3.0"
|
||||
description = "S3 API server crate for the Garage object store"
|
||||
repository = "https://git.deuxfleurs.fr/Deuxfleurs/garage"
|
||||
readme = "../../README.md"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
garage_model.workspace = true
|
||||
garage_table.workspace = true
|
||||
garage_block.workspace = true
|
||||
garage_net.workspace = true
|
||||
garage_util.workspace = true
|
||||
garage_rpc.workspace = true
|
||||
garage_api_common.workspace = true
|
||||
garage_api_s3.workspace = true
|
||||
|
||||
aes-gcm.workspace = true
|
||||
argon2.workspace = true
|
||||
async-compression.workspace = true
|
||||
async-trait.workspace = true
|
||||
base64.workspace = true
|
||||
bytes.workspace = true
|
||||
chrono.workspace = true
|
||||
crc32fast.workspace = true
|
||||
crc32c.workspace = true
|
||||
crypto-common.workspace = true
|
||||
err-derive.workspace = true
|
||||
hex.workspace = true
|
||||
hmac.workspace = true
|
||||
idna.workspace = true
|
||||
tracing.workspace = true
|
||||
md-5.workspace = true
|
||||
nom.workspace = true
|
||||
pin-project.workspace = true
|
||||
sha1.workspace = true
|
||||
sha2.workspace = true
|
||||
|
||||
futures.workspace = true
|
||||
futures-util.workspace = true
|
||||
tokio.workspace = true
|
||||
tokio-stream.workspace = true
|
||||
tokio-util.workspace = true
|
||||
|
||||
form_urlencoded.workspace = true
|
||||
http.workspace = true
|
||||
httpdate.workspace = true
|
||||
http-range.workspace = true
|
||||
http-body-util.workspace = true
|
||||
hyper = { workspace = true, default-features = false, features = ["server", "http1"] }
|
||||
hyper-util.workspace = true
|
||||
multer.workspace = true
|
||||
percent-encoding.workspace = true
|
||||
roxmltree.workspace = true
|
||||
url.workspace = true
|
||||
|
||||
serde.workspace = true
|
||||
serde_bytes.workspace = true
|
||||
serde_json.workspace = true
|
||||
quick-xml.workspace = true
|
||||
|
||||
opentelemetry.workspace = true
|
||||
opentelemetry-prometheus = { workspace = true, optional = true }
|
||||
prometheus = { workspace = true, optional = true }
|
||||
|
||||
[features]
|
||||
default = [ "garage_util/k2v", "garage_model/k2v" ]
|
||||
+10
-10
@@ -12,19 +12,19 @@ use garage_util::socket_address::UnixOrTCPSocketAddress;
|
||||
|
||||
use garage_model::garage::Garage;
|
||||
|
||||
use crate::generic_server::*;
|
||||
use crate::k2v::error::*;
|
||||
use crate::error::*;
|
||||
use garage_api_common::generic_server::*;
|
||||
|
||||
use crate::signature::verify_request;
|
||||
use garage_api_common::signature::verify_request;
|
||||
|
||||
use crate::helpers::*;
|
||||
use crate::k2v::batch::*;
|
||||
use crate::k2v::index::*;
|
||||
use crate::k2v::item::*;
|
||||
use crate::k2v::router::Endpoint;
|
||||
use crate::s3::cors::*;
|
||||
use crate::batch::*;
|
||||
use crate::index::*;
|
||||
use crate::item::*;
|
||||
use crate::router::Endpoint;
|
||||
use garage_api_common::helpers::*;
|
||||
use garage_api_s3::cors::*;
|
||||
|
||||
pub use crate::signature::streaming::ReqBody;
|
||||
pub use garage_api_common::signature::streaming::ReqBody;
|
||||
pub type ResBody = BoxBody<Error>;
|
||||
|
||||
pub struct K2VApiServer {
|
||||
|
||||
@@ -6,11 +6,11 @@ use garage_table::{EnumerationOrder, TableSchema};
|
||||
|
||||
use garage_model::k2v::item_table::*;
|
||||
|
||||
use crate::helpers::*;
|
||||
use crate::k2v::api_server::{ReqBody, ResBody};
|
||||
use crate::k2v::error::*;
|
||||
use crate::k2v::item::parse_causality_token;
|
||||
use crate::k2v::range::read_range;
|
||||
use garage_api_common::helpers::*;
|
||||
|
||||
pub async fn handle_insert_batch(
|
||||
ctx: ReqCtx,
|
||||
|
||||
@@ -2,12 +2,14 @@ use err_derive::Error;
|
||||
use hyper::header::HeaderValue;
|
||||
use hyper::{HeaderMap, StatusCode};
|
||||
|
||||
use crate::common_error::CommonError;
|
||||
pub(crate) use crate::common_error::{helper_error_as_internal, pass_helper_error};
|
||||
pub use crate::common_error::{CommonErrorDerivative, OkOrBadRequest, OkOrInternalError};
|
||||
use crate::generic_server::ApiError;
|
||||
use crate::helpers::*;
|
||||
use crate::signature::error::Error as SignatureError;
|
||||
use garage_api_common::common_error::CommonError;
|
||||
pub(crate) use garage_api_common::common_error::{helper_error_as_internal, pass_helper_error};
|
||||
pub use garage_api_common::common_error::{
|
||||
CommonErrorDerivative, OkOrBadRequest, OkOrInternalError,
|
||||
};
|
||||
use garage_api_common::generic_server::ApiError;
|
||||
use garage_api_common::helpers::*;
|
||||
use garage_api_common::signature::error::Error as SignatureError;
|
||||
|
||||
/// Errors of this crate
|
||||
#[derive(Debug, Error)]
|
||||
|
||||
@@ -5,10 +5,10 @@ use garage_table::util::*;
|
||||
|
||||
use garage_model::k2v::item_table::{BYTES, CONFLICTS, ENTRIES, VALUES};
|
||||
|
||||
use crate::helpers::*;
|
||||
use crate::k2v::api_server::ResBody;
|
||||
use crate::k2v::error::*;
|
||||
use crate::k2v::range::read_range;
|
||||
use crate::api_server::ResBody;
|
||||
use crate::error::*;
|
||||
use crate::range::read_range;
|
||||
use garage_api_common::helpers::*;
|
||||
|
||||
pub async fn handle_read_index(
|
||||
ctx: ReqCtx,
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ use hyper::{Request, Response, StatusCode};
|
||||
use garage_model::k2v::causality::*;
|
||||
use garage_model::k2v::item_table::*;
|
||||
|
||||
use crate::helpers::*;
|
||||
use crate::k2v::api_server::{ReqBody, ResBody};
|
||||
use crate::k2v::error::*;
|
||||
use crate::api_server::{ReqBody, ResBody};
|
||||
use crate::error::*;
|
||||
use garage_api_common::helpers::*;
|
||||
|
||||
pub const X_GARAGE_CAUSALITY_TOKEN: &str = "X-Garage-Causality-Token";
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
pub mod api_server;
|
||||
mod error;
|
||||
mod router;
|
||||
@@ -7,8 +7,8 @@ use std::sync::Arc;
|
||||
use garage_table::replication::TableShardedReplication;
|
||||
use garage_table::*;
|
||||
|
||||
use crate::helpers::key_after_prefix;
|
||||
use crate::k2v::error::*;
|
||||
use crate::error::*;
|
||||
use garage_api_common::helpers::key_after_prefix;
|
||||
|
||||
/// Read range in a Garage table.
|
||||
/// Returns (entries, more?, nextStart)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::k2v::error::*;
|
||||
use crate::error::*;
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use hyper::{Method, Request};
|
||||
|
||||
use crate::helpers::Authorization;
|
||||
use crate::router_macros::{generateQueryParameters, router_match};
|
||||
use garage_api_common::helpers::Authorization;
|
||||
use garage_api_common::router_macros::{generateQueryParameters, router_match};
|
||||
|
||||
router_match! {@func
|
||||
|
||||
|
||||
Reference in New Issue
Block a user