Perf measurement & bottleneck fix #102

Merged
quentin merged 16 commits from perf/cpu-ram-bottleneck into main 2024-02-23 17:32:39 +00:00
5 changed files with 164 additions and 111 deletions
Showing only changes of commit 2a084df300 - Show all commits

227
Cargo.lock generated
View file

@ -46,7 +46,7 @@ dependencies = [
"eml-codec", "eml-codec",
"futures", "futures",
"hex", "hex",
"hyper-rustls", "hyper-rustls 0.26.0",
"hyper-util", "hyper-util",
"im", "im",
"imap-codec", "imap-codec",
@ -468,11 +468,11 @@ dependencies = [
"aws-sdk-ssooidc", "aws-sdk-ssooidc",
"aws-sdk-sts", "aws-sdk-sts",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-json", "aws-smithy-json",
"aws-smithy-runtime", "aws-smithy-runtime",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"aws-types", "aws-types",
"bytes", "bytes",
"fastrand 2.0.1", "fastrand 2.0.1",
@ -494,7 +494,7 @@ checksum = "e5635d8707f265c773282a22abe1ecd4fbe96a8eb2f0f14c0796f8016f11a41a"
dependencies = [ dependencies = [
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"zeroize", "zeroize",
] ]
@ -505,12 +505,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f82b9ae2adfd9d6582440d0eeb394c07f74d21b4c0cc72bdb73735c9e1a9c0e" checksum = "6f82b9ae2adfd9d6582440d0eeb394c07f74d21b4c0cc72bdb73735c9e1a9c0e"
dependencies = [ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-sigv4 1.1.6", "aws-sigv4",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-eventstream", "aws-smithy-eventstream",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"aws-types", "aws-types",
"bytes", "bytes",
"fastrand 2.0.1", "fastrand 2.0.1",
@ -522,6 +522,28 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "aws-sdk-config"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cb71960e3e197c3f512f3bf0f47f444acd708db59733416107ec2ff161ff5c4"
dependencies = [
"aws-credential-types",
"aws-runtime",
"aws-smithy-async",
"aws-smithy-http",
"aws-smithy-json",
"aws-smithy-runtime",
"aws-smithy-runtime-api",
"aws-smithy-types",
"aws-types",
"bytes",
"http 0.2.11",
"once_cell",
"regex-lite",
"tracing",
]
[[package]] [[package]]
name = "aws-sdk-s3" name = "aws-sdk-s3"
version = "1.16.0" version = "1.16.0"
@ -530,15 +552,15 @@ checksum = "5076637347e7d0218e61facae853110682ae58efabd2f4e2a9e530c203d5fa7b"
dependencies = [ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-runtime", "aws-runtime",
"aws-sigv4 1.1.6", "aws-sigv4",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-checksums", "aws-smithy-checksums",
"aws-smithy-eventstream", "aws-smithy-eventstream",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-json", "aws-smithy-json",
"aws-smithy-runtime", "aws-smithy-runtime",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"aws-smithy-xml", "aws-smithy-xml",
"aws-types", "aws-types",
"bytes", "bytes",
@ -560,11 +582,11 @@ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-runtime", "aws-runtime",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-json", "aws-smithy-json",
"aws-smithy-runtime", "aws-smithy-runtime",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"aws-types", "aws-types",
"bytes", "bytes",
"http 0.2.11", "http 0.2.11",
@ -582,11 +604,11 @@ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-runtime", "aws-runtime",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-json", "aws-smithy-json",
"aws-smithy-runtime", "aws-smithy-runtime",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"aws-types", "aws-types",
"bytes", "bytes",
"http 0.2.11", "http 0.2.11",
@ -604,12 +626,12 @@ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-runtime", "aws-runtime",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-json", "aws-smithy-json",
"aws-smithy-query", "aws-smithy-query",
"aws-smithy-runtime", "aws-smithy-runtime",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"aws-smithy-xml", "aws-smithy-xml",
"aws-types", "aws-types",
"http 0.2.11", "http 0.2.11",
@ -618,25 +640,6 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "aws-sigv4"
version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c"
dependencies = [
"aws-smithy-http 0.55.3",
"form_urlencoded",
"hex",
"hmac",
"http 0.2.11",
"once_cell",
"percent-encoding",
"regex",
"sha2",
"time",
"tracing",
]
[[package]] [[package]]
name = "aws-sigv4" name = "aws-sigv4"
version = "1.1.6" version = "1.1.6"
@ -645,9 +648,9 @@ checksum = "404c64a104188ac70dd1684718765cb5559795458e446480e41984e68e57d888"
dependencies = [ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-smithy-eventstream", "aws-smithy-eventstream",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"bytes", "bytes",
"crypto-bigint 0.5.5", "crypto-bigint 0.5.5",
"form_urlencoded", "form_urlencoded",
@ -683,8 +686,8 @@ version = "0.60.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fd4b66f2a8e7c84d7e97bda2666273d41d2a2e25302605bcf906b7b2661ae5e" checksum = "0fd4b66f2a8e7c84d7e97bda2666273d41d2a2e25302605bcf906b7b2661ae5e"
dependencies = [ dependencies = [
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"bytes", "bytes",
"crc32c", "crc32c",
"crc32fast", "crc32fast",
@ -704,31 +707,11 @@ version = "0.60.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6363078f927f612b970edf9d1903ef5cef9a64d1e8423525ebb1f0a1633c858" checksum = "e6363078f927f612b970edf9d1903ef5cef9a64d1e8423525ebb1f0a1633c858"
dependencies = [ dependencies = [
"aws-smithy-types 1.1.7", "aws-smithy-types",
"bytes", "bytes",
"crc32fast", "crc32fast",
] ]
[[package]]
name = "aws-smithy-http"
version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28"
dependencies = [
"aws-smithy-types 0.55.3",
"bytes",
"bytes-utils",
"futures-core",
"http 0.2.11",
"http-body 0.4.6",
"hyper 0.14.28",
"once_cell",
"percent-encoding",
"pin-project-lite 0.2.13",
"pin-utils",
"tracing",
]
[[package]] [[package]]
name = "aws-smithy-http" name = "aws-smithy-http"
version = "0.60.6" version = "0.60.6"
@ -737,7 +720,7 @@ checksum = "b6ca214a6a26f1b7ebd63aa8d4f5e2194095643023f9608edf99a58247b9d80d"
dependencies = [ dependencies = [
"aws-smithy-eventstream", "aws-smithy-eventstream",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"bytes", "bytes",
"bytes-utils", "bytes-utils",
"futures-core", "futures-core",
@ -756,7 +739,7 @@ version = "0.60.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1af80ecf3057fb25fe38d1687e94c4601a7817c6a1e87c1b0635f7ecb644ace5" checksum = "1af80ecf3057fb25fe38d1687e94c4601a7817c6a1e87c1b0635f7ecb644ace5"
dependencies = [ dependencies = [
"aws-smithy-types 1.1.7", "aws-smithy-types",
] ]
[[package]] [[package]]
@ -765,7 +748,7 @@ version = "0.60.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb27084f72ea5fc20033efe180618677ff4a2f474b53d84695cfe310a6526cbc" checksum = "eb27084f72ea5fc20033efe180618677ff4a2f474b53d84695cfe310a6526cbc"
dependencies = [ dependencies = [
"aws-smithy-types 1.1.7", "aws-smithy-types",
"urlencoding", "urlencoding",
] ]
@ -776,16 +759,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbb5fca54a532a36ff927fbd7407a7c8eb9c3b4faf72792ba2965ea2cad8ed55" checksum = "fbb5fca54a532a36ff927fbd7407a7c8eb9c3b4faf72792ba2965ea2cad8ed55"
dependencies = [ dependencies = [
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-http 0.60.6", "aws-smithy-http",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"bytes", "bytes",
"fastrand 2.0.1", "fastrand 2.0.1",
"h2", "h2 0.3.24",
"http 0.2.11", "http 0.2.11",
"http-body 0.4.6", "http-body 0.4.6",
"hyper 0.14.28", "hyper 0.14.28",
"hyper-rustls", "hyper-rustls 0.24.2",
"once_cell", "once_cell",
"pin-project-lite 0.2.13", "pin-project-lite 0.2.13",
"pin-utils", "pin-utils",
@ -801,7 +784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22389cb6f7cac64f266fb9f137745a9349ced7b47e0d2ba503e9e40ede4f7060" checksum = "22389cb6f7cac64f266fb9f137745a9349ced7b47e0d2ba503e9e40ede4f7060"
dependencies = [ dependencies = [
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"bytes", "bytes",
"http 0.2.11", "http 0.2.11",
"http 1.0.0", "http 1.0.0",
@ -811,19 +794,6 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "aws-smithy-types"
version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16a3d0bf4f324f4ef9793b86a1701d9700fbcdbd12a846da45eed104c634c6e8"
dependencies = [
"base64-simd",
"itoa",
"num-integer",
"ryu",
"time",
]
[[package]] [[package]]
name = "aws-smithy-types" name = "aws-smithy-types"
version = "1.1.7" version = "1.1.7"
@ -865,7 +835,7 @@ dependencies = [
"aws-credential-types", "aws-credential-types",
"aws-smithy-async", "aws-smithy-async",
"aws-smithy-runtime-api", "aws-smithy-runtime-api",
"aws-smithy-types 1.1.7", "aws-smithy-types",
"http 0.2.11", "http 0.2.11",
"rustc_version", "rustc_version",
"tracing", "tracing",
@ -1737,6 +1707,25 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "h2"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943"
dependencies = [
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http 1.0.0",
"indexmap 2.1.0",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.12.3" version = "0.12.3"
@ -1841,6 +1830,19 @@ dependencies = [
"http 1.0.0", "http 1.0.0",
] ]
[[package]]
name = "http-body-util"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840"
dependencies = [
"bytes",
"futures-util",
"http 1.0.0",
"http-body 1.0.0",
"pin-project-lite 0.2.13",
]
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.8.0" version = "1.8.0"
@ -1869,7 +1871,7 @@ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
"h2", "h2 0.3.24",
"http 0.2.11", "http 0.2.11",
"http-body 0.4.6", "http-body 0.4.6",
"httparse", "httparse",
@ -1890,8 +1892,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel",
"futures-util",
"h2 0.4.2",
"http 1.0.0", "http 1.0.0",
"http-body 1.0.0", "http-body 1.0.0",
"httparse",
"httpdate",
"itoa",
"pin-project-lite 0.2.13", "pin-project-lite 0.2.13",
"smallvec", "smallvec",
"tokio", "tokio",
@ -1909,11 +1917,30 @@ dependencies = [
"hyper 0.14.28", "hyper 0.14.28",
"log", "log",
"rustls 0.21.10", "rustls 0.21.10",
"rustls-native-certs", "rustls-native-certs 0.6.3",
"tokio", "tokio",
"tokio-rustls 0.24.1", "tokio-rustls 0.24.1",
] ]
[[package]]
name = "hyper-rustls"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c"
dependencies = [
"futures-util",
"http 1.0.0",
"hyper 1.2.0",
"hyper-util",
"log",
"rustls 0.22.2",
"rustls-native-certs 0.7.0",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.25.0",
"tower-service",
]
[[package]] [[package]]
name = "hyper-timeout" name = "hyper-timeout"
version = "0.4.1" version = "0.4.1"
@ -1939,6 +1966,8 @@ dependencies = [
"http-body 1.0.0", "http-body 1.0.0",
"hyper 1.2.0", "hyper 1.2.0",
"pin-project-lite 0.2.13", "pin-project-lite 0.2.13",
"socket2 0.5.5",
"tokio",
"tower", "tower",
"tower-service", "tower-service",
"tracing", "tracing",
@ -2118,14 +2147,17 @@ dependencies = [
[[package]] [[package]]
name = "k2v-client" name = "k2v-client"
version = "0.0.4" version = "0.0.4"
source = "git+https://git.deuxfleurs.fr/Deuxfleurs/garage.git?tag=v0.9.1#ee57dd922b9c396298473b41e4046c8d00ee77d5" source = "git+https://git.deuxfleurs.fr/Deuxfleurs/garage.git?branch=k2v/shared_http_client#8b35a946d9f6b31b26b9783acbfab984316051f4"
dependencies = [ dependencies = [
"aws-sigv4 0.55.3", "aws-sdk-config",
"aws-sigv4",
"base64 0.21.7", "base64 0.21.7",
"hex", "hex",
"http 0.2.11", "http 1.0.0",
"hyper 0.14.28", "http-body-util",
"hyper-rustls", "hyper 1.2.0",
"hyper-rustls 0.26.0",
"hyper-util",
"log", "log",
"percent-encoding", "percent-encoding",
"serde", "serde",
@ -2178,7 +2210,7 @@ dependencies = [
"percent-encoding", "percent-encoding",
"ring 0.16.20", "ring 0.16.20",
"rustls 0.20.9", "rustls 0.20.9",
"rustls-native-certs", "rustls-native-certs 0.6.3",
"thiserror", "thiserror",
"tokio", "tokio",
"tokio-rustls 0.23.4", "tokio-rustls 0.23.4",
@ -2947,6 +2979,19 @@ dependencies = [
"security-framework", "security-framework",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792"
dependencies = [
"openssl-probe",
"rustls-pemfile 2.0.0",
"rustls-pki-types",
"schannel",
"security-framework",
]
[[package]] [[package]]
name = "rustls-pemfile" name = "rustls-pemfile"
version = "1.0.4" version = "1.0.4"
@ -3562,7 +3607,7 @@ dependencies = [
"axum", "axum",
"base64 0.21.7", "base64 0.21.7",
"bytes", "bytes",
"h2", "h2 0.3.24",
"http 0.2.11", "http 0.2.11",
"http-body 0.4.6", "http-body 0.4.6",
"hyper 0.14.28", "hyper 0.14.28",

View file

@ -48,15 +48,15 @@ rand = "0.8.5"
rustls = "0.22" rustls = "0.22"
rustls-pemfile = "2.0" rustls-pemfile = "2.0"
tokio-rustls = "0.25" tokio-rustls = "0.25"
hyper-rustls = { version = "0.24", features = ["http2"] } hyper-rustls = { version = "0.26", features = ["http2"] }
hyper-util = { version = "0.1", features = ["client"] } hyper-util = { version = "0.1", features = ["full"] }
rpassword = "7.0" rpassword = "7.0"
# login # login
ldap3 = { version = "0.10", default-features = false, features = ["tls-rustls"] } ldap3 = { version = "0.10", default-features = false, features = ["tls-rustls"] }
# storage # storage
k2v-client = { git = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git", tag = "v0.9.1" } k2v-client = { git = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git", branch = "k2v/shared_http_client" }
aws-config = { version = "1", features = ["behavior-version-latest"] } aws-config = { version = "1", features = ["behavior-version-latest"] }
aws-sdk-s3 = "1" aws-sdk-s3 = "1"
aws-smithy-runtime = "1" aws-smithy-runtime = "1"

View file

@ -96,7 +96,7 @@ impl LdapLoginProvider {
//Login provider should return only a cryptoroot + a storage URI //Login provider should return only a cryptoroot + a storage URI
//storage URI that should be resolved outside... //storage URI that should be resolved outside...
in_memory_store: storage::in_memory::MemDb::new(), in_memory_store: storage::in_memory::MemDb::new(),
garage_store: storage::garage::GarageRoot::new(), garage_store: storage::garage::GarageRoot::new()?,
}) })
} }

View file

@ -85,7 +85,7 @@ impl StaticLoginProvider {
Ok(Self { Ok(Self {
user_db: rx, user_db: rx,
in_memory_store: storage::in_memory::MemDb::new(), in_memory_store: storage::in_memory::MemDb::new(),
garage_store: storage::garage::GarageRoot::new(), garage_store: storage::garage::GarageRoot::new()?,
}) })
} }
} }

View file

@ -1,27 +1,29 @@
use crate::storage::*;
use aws_sdk_s3::{self as s3, error::SdkError, operation::get_object::GetObjectError}; use aws_sdk_s3::{self as s3, error::SdkError, operation::get_object::GetObjectError};
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder; use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
use aws_smithy_runtime_api::client::http::SharedHttpClient; use aws_smithy_runtime_api::client::http::SharedHttpClient;
//use hyper_rustls::HttpsConnector; use hyper_rustls::HttpsConnector;
//use hyper_util::client::legacy::connect::HttpConnector; use hyper_util::rt::TokioExecutor;
use hyper_util::client::legacy::{connect::HttpConnector, Client as HttpClient};
use serde::Serialize; use serde::Serialize;
use crate::storage::*;
pub struct GarageRoot { pub struct GarageRoot {
k2v_http: HttpClient<HttpsConnector<HttpConnector>, k2v_client::Body>,
aws_http: SharedHttpClient, aws_http: SharedHttpClient,
} }
impl GarageRoot { impl GarageRoot {
pub fn new() -> Self { pub fn new() -> anyhow::Result<Self> {
/*let http = hyper_rustls::HttpsConnectorBuilder::new() let connector = hyper_rustls::HttpsConnectorBuilder::new()
.https_or_http() .with_native_roots()?
.with_native_roots() .https_or_http()
.enable_http1() .enable_http1()
.enable_http2() .enable_http2()
.build();*/ .build();
let k2v_http = HttpClient::builder(TokioExecutor::new()).build(connector);
let aws_http = HyperClientBuilder::new().build_https(); let aws_http = HyperClientBuilder::new().build_https();
Self { aws_http } Ok(Self { k2v_http, aws_http })
} }
pub fn user(&self, conf: GarageConf) -> anyhow::Result<Arc<GarageUser>> { pub fn user(&self, conf: GarageConf) -> anyhow::Result<Arc<GarageUser>> {
@ -29,7 +31,12 @@ impl GarageRoot {
unicity.extend_from_slice(file!().as_bytes()); unicity.extend_from_slice(file!().as_bytes());
unicity.append(&mut rmp_serde::to_vec(&conf)?); unicity.append(&mut rmp_serde::to_vec(&conf)?);
Ok(Arc::new(GarageUser { conf, aws_http: self.aws_http.clone(), unicity })) Ok(Arc::new(GarageUser {
conf,
aws_http: self.aws_http.clone(),
k2v_http: self.k2v_http.clone(),
unicity
}))
} }
} }
@ -50,6 +57,7 @@ pub struct GarageConf {
pub struct GarageUser { pub struct GarageUser {
conf: GarageConf, conf: GarageConf,
aws_http: SharedHttpClient, aws_http: SharedHttpClient,
k2v_http: HttpClient<HttpsConnector<HttpConnector>, k2v_client::Body>,
unicity: Vec<u8>, unicity: Vec<u8>,
} }
@ -87,7 +95,7 @@ impl IBuilder for GarageUser {
user_agent: None, user_agent: None,
}; };
let k2v_client = match k2v_client::K2vClient::new(k2v_config) { let k2v_client = match k2v_client::K2vClient::new_with_client(k2v_config, self.k2v_http.clone()) {
Err(e) => { Err(e) => {
tracing::error!("unable to build k2v client: {}", e); tracing::error!("unable to build k2v client: {}", e);
return Err(StorageError::Internal); return Err(StorageError::Internal);