Perf measurement & bottleneck fix #102
5 changed files with 225 additions and 147 deletions
303
Cargo.lock
generated
303
Cargo.lock
generated
|
@ -35,6 +35,8 @@ dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"aws-config",
|
"aws-config",
|
||||||
"aws-sdk-s3",
|
"aws-sdk-s3",
|
||||||
|
"aws-smithy-runtime",
|
||||||
|
"aws-smithy-runtime-api",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -45,6 +47,7 @@ dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"hyper-rustls",
|
"hyper-rustls",
|
||||||
|
"hyper-util",
|
||||||
"im",
|
"im",
|
||||||
"imap-codec",
|
"imap-codec",
|
||||||
"imap-flow",
|
"imap-flow",
|
||||||
|
@ -455,28 +458,27 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-config"
|
name = "aws-config"
|
||||||
version = "1.1.2"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7e64b72d4bdbb41a73d27709c65a25b6e4bfc8321bf70fa3a8b19ce7d4eb81b0"
|
checksum = "3182c19847238b50b62ae0383a6dbfc14514e552eb5e307e1ea83ccf5840b8a6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-http",
|
|
||||||
"aws-runtime",
|
"aws-runtime",
|
||||||
"aws-sdk-sso",
|
"aws-sdk-sso",
|
||||||
"aws-sdk-ssooidc",
|
"aws-sdk-ssooidc",
|
||||||
"aws-sdk-sts",
|
"aws-sdk-sts",
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"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.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"aws-types",
|
"aws-types",
|
||||||
"bytes",
|
"bytes",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"hex",
|
"hex",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"ring 0.17.7",
|
"ring 0.17.7",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -486,77 +488,62 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-credential-types"
|
name = "aws-credential-types"
|
||||||
version = "1.1.2"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a7cb3510b95492bd9014b60e2e3bee3e48bc516e220316f8e6b60df18b47331"
|
checksum = "e5635d8707f265c773282a22abe1ecd4fbe96a8eb2f0f14c0796f8016f11a41a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-runtime-api",
|
"aws-smithy-runtime-api",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "aws-http"
|
|
||||||
version = "0.60.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a95d41abe4e941399fdb4bc2f54713eac3c839d98151875948bb24e66ab658f2"
|
|
||||||
dependencies = [
|
|
||||||
"aws-smithy-runtime-api",
|
|
||||||
"aws-smithy-types 1.1.3",
|
|
||||||
"aws-types",
|
|
||||||
"bytes",
|
|
||||||
"http",
|
|
||||||
"http-body",
|
|
||||||
"pin-project-lite 0.2.13",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-runtime"
|
name = "aws-runtime"
|
||||||
version = "1.1.2"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "233cca219c6705d525ace011d6f9bc51aaf32fce5b4c41661d2d7ff22d9b4d49"
|
checksum = "6f82b9ae2adfd9d6582440d0eeb394c07f74d21b4c0cc72bdb73735c9e1a9c0e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-http",
|
"aws-sigv4 1.1.6",
|
||||||
"aws-sigv4 1.1.2",
|
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-eventstream",
|
"aws-smithy-eventstream",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"aws-smithy-runtime-api",
|
"aws-smithy-runtime-api",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"aws-types",
|
"aws-types",
|
||||||
|
"bytes",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
|
"http-body 0.4.6",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
"pin-project-lite 0.2.13",
|
||||||
"tracing",
|
"tracing",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-sdk-s3"
|
name = "aws-sdk-s3"
|
||||||
version = "1.12.0"
|
version = "1.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "634fbe5b6591ee2e281cd2ba8641e9bd752dbf5bf338924d6ad4bd5a3304fe31"
|
checksum = "5076637347e7d0218e61facae853110682ae58efabd2f4e2a9e530c203d5fa7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-http",
|
|
||||||
"aws-runtime",
|
"aws-runtime",
|
||||||
"aws-sigv4 1.1.2",
|
"aws-sigv4 1.1.6",
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-checksums",
|
"aws-smithy-checksums",
|
||||||
"aws-smithy-eventstream",
|
"aws-smithy-eventstream",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"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.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"aws-smithy-xml",
|
"aws-smithy-xml",
|
||||||
"aws-types",
|
"aws-types",
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"regex-lite",
|
"regex-lite",
|
||||||
|
@ -566,22 +553,21 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-sdk-sso"
|
name = "aws-sdk-sso"
|
||||||
version = "1.10.0"
|
version = "1.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee41005e0f3a19ae749c7953d9e1f1ef8d2183f76f64966e346fa41c1ba0ed44"
|
checksum = "ca7e8097448832fcd22faf6bb227e97d76b40e354509d1307653a885811c7151"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-http",
|
|
||||||
"aws-runtime",
|
"aws-runtime",
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"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.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"aws-types",
|
"aws-types",
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"regex-lite",
|
"regex-lite",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -589,22 +575,21 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-sdk-ssooidc"
|
name = "aws-sdk-ssooidc"
|
||||||
version = "1.10.0"
|
version = "1.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fa08168f8a27505e7b90f922c32a489feb1f2133878981a15138bebc849ac09c"
|
checksum = "a75073590e23d63044606771afae309fada8eb10ded54a1ce4598347221d3fef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-http",
|
|
||||||
"aws-runtime",
|
"aws-runtime",
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"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.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"aws-types",
|
"aws-types",
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"regex-lite",
|
"regex-lite",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -612,23 +597,22 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-sdk-sts"
|
name = "aws-sdk-sts"
|
||||||
version = "1.10.0"
|
version = "1.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29102eff04d50ef70f11a48823db33e33c6cc5f027bfb6ff4864efbd5f1f66f3"
|
checksum = "650e4aaae41547151dea4d8142f7ffcc8ab8ba76d5dccc8933936ef2102c3356"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-http",
|
|
||||||
"aws-runtime",
|
"aws-runtime",
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"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.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"aws-smithy-xml",
|
"aws-smithy-xml",
|
||||||
"aws-types",
|
"aws-types",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"regex-lite",
|
"regex-lite",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -644,7 +628,7 @@ dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"hex",
|
"hex",
|
||||||
"hmac",
|
"hmac",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -655,21 +639,22 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-sigv4"
|
name = "aws-sigv4"
|
||||||
version = "1.1.2"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b92384b39aedb258aa734fe0e7b2ffcd13f33e68227251a72cd2635e0acc8f1a"
|
checksum = "404c64a104188ac70dd1684718765cb5559795458e446480e41984e68e57d888"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-credential-types",
|
"aws-credential-types",
|
||||||
"aws-smithy-eventstream",
|
"aws-smithy-eventstream",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"aws-smithy-runtime-api",
|
"aws-smithy-runtime-api",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"crypto-bigint 0.5.5",
|
"crypto-bigint 0.5.5",
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"hex",
|
"hex",
|
||||||
"hmac",
|
"hmac",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
|
"http 1.0.0",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"p256",
|
"p256",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
@ -683,9 +668,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-async"
|
name = "aws-smithy-async"
|
||||||
version = "1.1.3"
|
version = "1.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2eac0bb78e9e2765699999a02d7bfb4e6ad8f13e0962ebb9f5202b1d8cd76006"
|
checksum = "fcf7f09a27286d84315dfb9346208abb3b0973a692454ae6d0bc8d803fcce3b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
|
@ -694,18 +679,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-checksums"
|
name = "aws-smithy-checksums"
|
||||||
version = "0.60.3"
|
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 = "535a2d5f1e459bc7709580a77152c8d493982db083236c2b1d1c51dc6217e8a3"
|
checksum = "0fd4b66f2a8e7c84d7e97bda2666273d41d2a2e25302605bcf906b7b2661ae5e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"crc32c",
|
"crc32c",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"hex",
|
"hex",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"md-5",
|
"md-5",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
"sha1",
|
"sha1",
|
||||||
|
@ -715,11 +700,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-eventstream"
|
name = "aws-smithy-eventstream"
|
||||||
version = "0.60.3"
|
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 = "682371561562d08ab437766903c6bc28f4f95d7ab2ecfb389bda7849dd98aefe"
|
checksum = "e6363078f927f612b970edf9d1903ef5cef9a64d1e8423525ebb1f0a1633c858"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
]
|
]
|
||||||
|
@ -734,9 +719,9 @@ dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"bytes-utils",
|
"bytes-utils",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
|
@ -746,18 +731,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-http"
|
name = "aws-smithy-http"
|
||||||
version = "0.60.3"
|
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 = "365ca49744b2bda2f1e2dc03b856da3fa5a28ca5b0a41e41d7ff5305a8fae190"
|
checksum = "b6ca214a6a26f1b7ebd63aa8d4f5e2194095643023f9608edf99a58247b9d80d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-eventstream",
|
"aws-smithy-eventstream",
|
||||||
"aws-smithy-runtime-api",
|
"aws-smithy-runtime-api",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"bytes-utils",
|
"bytes-utils",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
|
@ -767,39 +752,39 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-json"
|
name = "aws-smithy-json"
|
||||||
version = "0.60.3"
|
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 = "733ccdb727ac63370836aa3b3c483d75ad2ef7bc6507db3efe1d01e8d2e50367"
|
checksum = "1af80ecf3057fb25fe38d1687e94c4601a7817c6a1e87c1b0635f7ecb644ace5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-query"
|
name = "aws-smithy-query"
|
||||||
version = "0.60.3"
|
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 = "aff02ae2ee7968bbce2983ffb5ce529d24f4848532300f398347bde8c2196974"
|
checksum = "eb27084f72ea5fc20033efe180618677ff4a2f474b53d84695cfe310a6526cbc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"urlencoding",
|
"urlencoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-runtime"
|
name = "aws-smithy-runtime"
|
||||||
version = "1.1.3"
|
version = "1.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ab9cb6fee50680af8ceaa293ae79eba32095ca117161cb323f9ee30dd87d139"
|
checksum = "fbb5fca54a532a36ff927fbd7407a7c8eb9c3b4faf72792ba2965ea2cad8ed55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-http 0.60.3",
|
"aws-smithy-http 0.60.6",
|
||||||
"aws-smithy-runtime-api",
|
"aws-smithy-runtime-api",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"h2",
|
"h2",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"hyper-rustls",
|
"hyper-rustls",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
|
@ -811,14 +796,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-runtime-api"
|
name = "aws-smithy-runtime-api"
|
||||||
version = "1.1.3"
|
version = "1.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02ca2da7619517310bfead6d18abcdde90f1439224d887d608503cfacff46dff"
|
checksum = "22389cb6f7cac64f266fb9f137745a9349ced7b47e0d2ba503e9e40ede4f7060"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-smithy-async",
|
"aws-smithy-async",
|
||||||
"aws-smithy-types 1.1.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
|
"http 1.0.0",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -840,16 +826,16 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-types"
|
name = "aws-smithy-types"
|
||||||
version = "1.1.3"
|
version = "1.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d4bb944488536cd2fef43212d829bc7e9a8bfc4afa079d21170441e7be8d2d0"
|
checksum = "f081da5481210523d44ffd83d9f0740320050054006c719eae0232d411f024d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64-simd",
|
"base64-simd",
|
||||||
"bytes",
|
"bytes",
|
||||||
"bytes-utils",
|
"bytes-utils",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"itoa",
|
"itoa",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
|
@ -863,24 +849,24 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-smithy-xml"
|
name = "aws-smithy-xml"
|
||||||
version = "0.60.3"
|
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 = "ef796feaf894d7fd03869235237aeffe73ed1b29a3927cceeee2eecadf876eba"
|
checksum = "0fccd8f595d0ca839f9f2548e66b99514a85f92feb4c01cf2868d93eb4888a42"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"xmlparser",
|
"xmlparser",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-types"
|
name = "aws-types"
|
||||||
version = "1.1.2"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8549aa62c5b7db5c57ab915200ee214b4f5d8f19b29a4a8fa0b3ad3bca1380e3"
|
checksum = "8fbb5d48aae496f628e7aa2e41991dd4074f606d9e3ade1ce1059f293d40f9a2"
|
||||||
dependencies = [
|
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.3",
|
"aws-smithy-types 1.1.7",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
@ -896,9 +882,9 @@ dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"itoa",
|
"itoa",
|
||||||
"matchit",
|
"matchit",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
@ -922,8 +908,8 @@ dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"mime",
|
"mime",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
|
@ -1242,9 +1228,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32c"
|
name = "crc32c"
|
||||||
version = "0.6.4"
|
version = "0.6.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74"
|
checksum = "89254598aa9b9fa608de44b3ae54c810f0f06d755e24c50177f1f8f31ff50ce2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
]
|
]
|
||||||
|
@ -1743,7 +1729,7 @@ dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"indexmap 2.1.0",
|
"indexmap 2.1.0",
|
||||||
"slab",
|
"slab",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -1823,6 +1809,17 @@ dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"itoa",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-body"
|
name = "http-body"
|
||||||
version = "0.4.6"
|
version = "0.4.6"
|
||||||
|
@ -1830,10 +1827,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-body"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http 1.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httparse"
|
name = "httparse"
|
||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
|
@ -1863,19 +1870,34 @@ dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"h2",
|
"h2",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"httparse",
|
"httparse",
|
||||||
"httpdate",
|
"httpdate",
|
||||||
"itoa",
|
"itoa",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
"socket2 0.4.10",
|
"socket2 0.5.5",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
"want",
|
"want",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http 1.0.0",
|
||||||
|
"http-body 1.0.0",
|
||||||
|
"pin-project-lite 0.2.13",
|
||||||
|
"smallvec",
|
||||||
|
"tokio",
|
||||||
|
"want",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-rustls"
|
name = "hyper-rustls"
|
||||||
version = "0.24.2"
|
version = "0.24.2"
|
||||||
|
@ -1883,8 +1905,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
|
checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"log",
|
"log",
|
||||||
"rustls 0.21.10",
|
"rustls 0.21.10",
|
||||||
"rustls-native-certs",
|
"rustls-native-certs",
|
||||||
|
@ -1898,12 +1920,30 @@ version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
|
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-io-timeout",
|
"tokio-io-timeout",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-util"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-util",
|
||||||
|
"http 1.0.0",
|
||||||
|
"http-body 1.0.0",
|
||||||
|
"hyper 1.2.0",
|
||||||
|
"pin-project-lite 0.2.13",
|
||||||
|
"tower",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone"
|
name = "iana-time-zone"
|
||||||
version = "0.1.59"
|
version = "0.1.59"
|
||||||
|
@ -2083,8 +2123,8 @@ dependencies = [
|
||||||
"aws-sigv4 0.55.3",
|
"aws-sigv4 0.55.3",
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
"hex",
|
"hex",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"hyper-rustls",
|
"hyper-rustls",
|
||||||
"log",
|
"log",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
@ -3523,9 +3563,9 @@ dependencies = [
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
"h2",
|
"h2",
|
||||||
"http",
|
"http 0.2.11",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"hyper",
|
"hyper 0.14.28",
|
||||||
"hyper-timeout",
|
"hyper-timeout",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
|
@ -3576,6 +3616,7 @@ version = "0.1.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"log",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
"tracing-attributes",
|
"tracing-attributes",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
|
|
|
@ -49,6 +49,7 @@ 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.24", features = ["http2"] }
|
||||||
|
hyper-util = { version = "0.1", features = ["client"] }
|
||||||
rpassword = "7.0"
|
rpassword = "7.0"
|
||||||
|
|
||||||
# login
|
# login
|
||||||
|
@ -56,8 +57,10 @@ 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", tag = "v0.9.1" }
|
||||||
aws-config = { version = "1.1.1", features = ["behavior-version-latest"] }
|
aws-config = { version = "1", features = ["behavior-version-latest"] }
|
||||||
aws-sdk-s3 = "1.9.0"
|
aws-sdk-s3 = "1"
|
||||||
|
aws-smithy-runtime = "1"
|
||||||
|
aws-smithy-runtime-api = "1"
|
||||||
|
|
||||||
# email protocols
|
# email protocols
|
||||||
eml-codec = "0.1.2"
|
eml-codec = "0.1.2"
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub struct LdapLoginProvider {
|
||||||
|
|
||||||
storage_specific: StorageSpecific,
|
storage_specific: StorageSpecific,
|
||||||
in_memory_store: storage::in_memory::MemDb,
|
in_memory_store: storage::in_memory::MemDb,
|
||||||
|
garage_store: storage::garage::GarageRoot,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BucketSource {
|
enum BucketSource {
|
||||||
|
@ -91,7 +92,11 @@ impl LdapLoginProvider {
|
||||||
mail_attr: config.mail_attr,
|
mail_attr: config.mail_attr,
|
||||||
crypto_root_attr: config.crypto_root_attr,
|
crypto_root_attr: config.crypto_root_attr,
|
||||||
storage_specific: specific,
|
storage_specific: specific,
|
||||||
|
//@FIXME should be created outside of the login provider
|
||||||
|
//Login provider should return only a cryptoroot + a storage URI
|
||||||
|
//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(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +119,7 @@ impl LdapLoginProvider {
|
||||||
BucketSource::Attr(a) => get_attr(user, &a)?,
|
BucketSource::Attr(a) => get_attr(user, &a)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
storage::garage::GarageBuilder::new(storage::garage::GarageConf {
|
self.garage_store.user(storage::garage::GarageConf {
|
||||||
region: from_config.aws_region.clone(),
|
region: from_config.aws_region.clone(),
|
||||||
s3_endpoint: from_config.s3_endpoint.clone(),
|
s3_endpoint: from_config.s3_endpoint.clone(),
|
||||||
k2v_endpoint: from_config.k2v_endpoint.clone(),
|
k2v_endpoint: from_config.k2v_endpoint.clone(),
|
||||||
|
|
|
@ -25,6 +25,7 @@ pub struct UserDatabase {
|
||||||
pub struct StaticLoginProvider {
|
pub struct StaticLoginProvider {
|
||||||
user_db: watch::Receiver<UserDatabase>,
|
user_db: watch::Receiver<UserDatabase>,
|
||||||
in_memory_store: storage::in_memory::MemDb,
|
in_memory_store: storage::in_memory::MemDb,
|
||||||
|
garage_store: storage::garage::GarageRoot,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_user_list(config: PathBuf, up: watch::Sender<UserDatabase>) -> Result<()> {
|
pub async fn update_user_list(config: PathBuf, up: watch::Sender<UserDatabase>) -> Result<()> {
|
||||||
|
@ -84,6 +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(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +111,7 @@ impl LoginProvider for StaticLoginProvider {
|
||||||
let storage: storage::Builder = match &user.config.storage {
|
let storage: storage::Builder = match &user.config.storage {
|
||||||
StaticStorage::InMemory => self.in_memory_store.builder(username).await,
|
StaticStorage::InMemory => self.in_memory_store.builder(username).await,
|
||||||
StaticStorage::Garage(grgconf) => {
|
StaticStorage::Garage(grgconf) => {
|
||||||
storage::garage::GarageBuilder::new(storage::garage::GarageConf {
|
self.garage_store.user(storage::garage::GarageConf {
|
||||||
region: grgconf.aws_region.clone(),
|
region: grgconf.aws_region.clone(),
|
||||||
k2v_endpoint: grgconf.k2v_endpoint.clone(),
|
k2v_endpoint: grgconf.k2v_endpoint.clone(),
|
||||||
s3_endpoint: grgconf.s3_endpoint.clone(),
|
s3_endpoint: grgconf.s3_endpoint.clone(),
|
||||||
|
@ -140,7 +142,7 @@ impl LoginProvider for StaticLoginProvider {
|
||||||
let storage: storage::Builder = match &user.config.storage {
|
let storage: storage::Builder = match &user.config.storage {
|
||||||
StaticStorage::InMemory => self.in_memory_store.builder(&user.username).await,
|
StaticStorage::InMemory => self.in_memory_store.builder(&user.username).await,
|
||||||
StaticStorage::Garage(grgconf) => {
|
StaticStorage::Garage(grgconf) => {
|
||||||
storage::garage::GarageBuilder::new(storage::garage::GarageConf {
|
self.garage_store.user(storage::garage::GarageConf {
|
||||||
region: grgconf.aws_region.clone(),
|
region: grgconf.aws_region.clone(),
|
||||||
k2v_endpoint: grgconf.k2v_endpoint.clone(),
|
k2v_endpoint: grgconf.k2v_endpoint.clone(),
|
||||||
s3_endpoint: grgconf.s3_endpoint.clone(),
|
s3_endpoint: grgconf.s3_endpoint.clone(),
|
||||||
|
|
|
@ -1,7 +1,38 @@
|
||||||
use crate::storage::*;
|
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_api::client::http::SharedHttpClient;
|
||||||
|
//use hyper_rustls::HttpsConnector;
|
||||||
|
//use hyper_util::client::legacy::connect::HttpConnector;
|
||||||
|
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
pub struct GarageRoot {
|
||||||
|
aws_http: SharedHttpClient,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GarageRoot {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
/*let http = hyper_rustls::HttpsConnectorBuilder::new()
|
||||||
|
.https_or_http()
|
||||||
|
.with_native_roots()
|
||||||
|
.enable_http1()
|
||||||
|
.enable_http2()
|
||||||
|
.build();*/
|
||||||
|
let aws_http = HyperClientBuilder::new().build_https();
|
||||||
|
Self { aws_http }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn user(&self, conf: GarageConf) -> anyhow::Result<Arc<GarageUser>> {
|
||||||
|
let mut unicity: Vec<u8> = vec![];
|
||||||
|
unicity.extend_from_slice(file!().as_bytes());
|
||||||
|
unicity.append(&mut rmp_serde::to_vec(&conf)?);
|
||||||
|
|
||||||
|
Ok(Arc::new(GarageUser { conf, aws_http: self.aws_http.clone(), unicity }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
pub struct GarageConf {
|
pub struct GarageConf {
|
||||||
pub region: String,
|
pub region: String,
|
||||||
|
@ -12,23 +43,18 @@ pub struct GarageConf {
|
||||||
pub bucket: String,
|
pub bucket: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@FIXME we should get rid of this builder
|
||||||
|
//and allocate a S3 + K2V client only once per user
|
||||||
|
//(and using a shared HTTP client)
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct GarageBuilder {
|
pub struct GarageUser {
|
||||||
conf: GarageConf,
|
conf: GarageConf,
|
||||||
|
aws_http: SharedHttpClient,
|
||||||
unicity: Vec<u8>,
|
unicity: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GarageBuilder {
|
|
||||||
pub fn new(conf: GarageConf) -> anyhow::Result<Arc<Self>> {
|
|
||||||
let mut unicity: Vec<u8> = vec![];
|
|
||||||
unicity.extend_from_slice(file!().as_bytes());
|
|
||||||
unicity.append(&mut rmp_serde::to_vec(&conf)?);
|
|
||||||
Ok(Arc::new(Self { conf, unicity }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl IBuilder for GarageBuilder {
|
impl IBuilder for GarageUser {
|
||||||
async fn build(&self) -> Result<Store, StorageError> {
|
async fn build(&self) -> Result<Store, StorageError> {
|
||||||
let s3_creds = s3::config::Credentials::new(
|
let s3_creds = s3::config::Credentials::new(
|
||||||
self.conf.aws_access_key_id.clone(),
|
self.conf.aws_access_key_id.clone(),
|
||||||
|
@ -41,6 +67,7 @@ impl IBuilder for GarageBuilder {
|
||||||
let sdk_config = aws_config::from_env()
|
let sdk_config = aws_config::from_env()
|
||||||
.region(aws_config::Region::new(self.conf.region.clone()))
|
.region(aws_config::Region::new(self.conf.region.clone()))
|
||||||
.credentials_provider(s3_creds)
|
.credentials_provider(s3_creds)
|
||||||
|
.http_client(self.aws_http.clone())
|
||||||
.endpoint_url(self.conf.s3_endpoint.clone())
|
.endpoint_url(self.conf.s3_endpoint.clone())
|
||||||
.load()
|
.load()
|
||||||
.await;
|
.await;
|
||||||
|
|
Loading…
Reference in a new issue