Merge remote-tracking branch 'origin/main' into bool-api

This commit is contained in:
weisd
2024-11-12 16:18:11 +08:00
22 changed files with 568 additions and 164 deletions
+3
View File
@@ -28,7 +28,10 @@ jobs:
- name: Build binaries - name: Build binaries
run: | run: |
touch rustfs/build.rs
cargo build -p rustfs --bins cargo build -p rustfs --bins
touch rustfs/build.rs
cargo build -p rustfs --bins --release cargo build -p rustfs --bins --release
mkdir -p target/artifacts mkdir -p target/artifacts
Generated
+296 -63
View File
@@ -53,10 +53,19 @@ dependencies = [
] ]
[[package]] [[package]]
name = "anstream" name = "android_system_properties"
version = "0.6.15" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "anstream"
version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
@@ -69,43 +78,43 @@ dependencies = [
[[package]] [[package]]
name = "anstyle" name = "anstyle"
version = "1.0.8" version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
[[package]] [[package]]
name = "anstyle-parse" name = "anstyle-parse"
version = "0.2.5" version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
dependencies = [ dependencies = [
"utf8parse", "utf8parse",
] ]
[[package]] [[package]]
name = "anstyle-query" name = "anstyle-query"
version = "1.1.1" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
name = "anstyle-wincon" name = "anstyle-wincon"
version = "3.0.4" version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.89" version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
@@ -296,9 +305,9 @@ dependencies = [
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.11.0-rc.2" version = "0.11.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "939c0e62efa052fb0b2db2c0f7c479ad32e364c192c3aab605a7641de265a1a7" checksum = "3fd016a0ddc7cb13661bf5576073ce07330a693f8608a1320b4e20561cc12cdc"
dependencies = [ dependencies = [
"hybrid-array", "hybrid-array",
] ]
@@ -338,10 +347,12 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.30" version = "1.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf"
dependencies = [ dependencies = [
"jobserver",
"libc",
"shlex", "shlex",
] ]
@@ -408,9 +419,9 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
version = "1.0.2" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]] [[package]]
name = "common" name = "common"
@@ -424,9 +435,61 @@ dependencies = [
[[package]] [[package]]
name = "const-oid" name = "const-oid"
version = "0.10.0-rc.2" version = "0.10.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a0d96d207edbe5135e55038e79ab9ad6d75ba83b14cdf62326ce5b12bc46ab5" checksum = "68ff6be19477a1bd5441f382916a89bc2a0b2c35db6d41e0f6e8538bf6d6463f"
[[package]]
name = "const-str"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3618cccc083bb987a415d85c02ca6c9994ea5b44731ec28b9ecf09658655fba9"
dependencies = [
"const-str-proc-macro",
]
[[package]]
name = "const-str-proc-macro"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d3007177ccd2435eef6de9e7471365c36bc35c0b31773e27b4fe797f39f84bf"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "const_fn"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373e9fafaa20882876db20562275ff58d50e0caa2590077fe7ce7bef90211d0d"
[[package]]
name = "const_format"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50c655d81ff1114fb0dcdea9225ea9f0cc712a6f8d189378e82bdf62a473a64b"
dependencies = [
"const_format_proc_macros",
]
[[package]]
name = "const_format_proc_macros"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff1a44b93f47b1bac19a27932f5c591e43d1ba357ee4f61526c8a25603f0eb1"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
@@ -503,7 +566,7 @@ version = "0.11.0-pre.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf2e3d6615d99707295a9673e889bf363a04b2a466bd320c65a72536f7577379" checksum = "cf2e3d6615d99707295a9673e889bf363a04b2a466bd320c65a72536f7577379"
dependencies = [ dependencies = [
"block-buffer 0.11.0-rc.2", "block-buffer 0.11.0-rc.3",
"const-oid", "const-oid",
"crypto-common 0.2.0-rc.1", "crypto-common 0.2.0-rc.1",
"subtle", "subtle",
@@ -619,9 +682,9 @@ dependencies = [
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.1.1" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4"
[[package]] [[package]]
name = "fixedbitset" name = "fixedbitset"
@@ -795,6 +858,19 @@ version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
[[package]]
name = "git2"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
dependencies = [
"bitflags 2.6.0",
"libc",
"libgit2-sys",
"log",
"url",
]
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.1" version = "0.3.1"
@@ -843,9 +919,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.15.0" version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
[[package]] [[package]]
name = "heck" name = "heck"
@@ -932,9 +1008,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]] [[package]]
name = "hybrid-array" name = "hybrid-array"
version = "0.2.0-rc.11" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5a41e5b0754cae5aaf7915f1df1147ba8d316fc6e019cfcc00fbaba96d5e030" checksum = "45a9a965bb102c1c891fb017c09a05c965186b1265a207640f323ddd009f9deb"
dependencies = [ dependencies = [
"typenum", "typenum",
] ]
@@ -962,9 +1038,9 @@ dependencies = [
[[package]] [[package]]
name = "hyper-timeout" name = "hyper-timeout"
version = "0.5.1" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
dependencies = [ dependencies = [
"hyper", "hyper",
"hyper-util", "hyper-util",
@@ -992,6 +1068,29 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "iana-time-zone"
version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "icu_collections" name = "icu_collections"
version = "1.5.0" version = "1.5.0"
@@ -1148,7 +1247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.0", "hashbrown 0.15.1",
"serde", "serde",
] ]
@@ -1161,6 +1260,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "is_debug"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06d198e9919d9822d5f7083ba8530e04de87841eaf21ead9af8f2304efd57c89"
[[package]] [[package]]
name = "is_terminal_polyfill" name = "is_terminal_polyfill"
version = "1.70.1" version = "1.70.1"
@@ -1182,6 +1287,15 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "jobserver"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.72" version = "0.3.72"
@@ -1199,15 +1313,39 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.159" version = "0.2.162"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
[[package]]
name = "libgit2-sys"
version = "0.17.0+1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
dependencies = [
"cc",
"libc",
"libz-sys",
"pkg-config",
]
[[package]] [[package]]
name = "libm" name = "libm"
version = "0.2.8" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
[[package]]
name = "libz-sys"
version = "1.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
@@ -1283,9 +1421,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]] [[package]]
name = "matchit" name = "matchit"
version = "0.8.4" version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" checksum = "bd0aa4b8ca861b08d68afc8702af3250776898c1508b278e1da9d01e01d4b45c"
[[package]] [[package]]
name = "md-5" name = "md-5"
@@ -1482,6 +1620,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "num_threads"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "numeric_cast" name = "numeric_cast"
version = "0.2.1" version = "0.2.1"
@@ -1626,18 +1773,18 @@ dependencies = [
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.1.6" 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 = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "1.1.6" 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 = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1679,9 +1826,9 @@ dependencies = [
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.2.22" version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn", "syn",
@@ -1689,9 +1836,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.87" version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -1960,10 +2107,16 @@ version = "0.0.1"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"common", "common",
"ecstore",
"hyper", "hyper",
"matchit 0.8.4", "matchit 0.8.5",
"pin-project-lite", "pin-project-lite",
"quick-xml",
"s3s", "s3s",
"serde",
"serde-xml-rs",
"serde_urlencoded",
"time",
"tracing", "tracing",
] ]
@@ -1988,10 +2141,12 @@ version = "0.1.0"
dependencies = [ dependencies = [
"admin", "admin",
"async-trait", "async-trait",
"atoi",
"axum", "axum",
"bytes", "bytes",
"clap", "clap",
"common", "common",
"const-str",
"ecstore", "ecstore",
"flatbuffers", "flatbuffers",
"futures", "futures",
@@ -2004,7 +2159,7 @@ dependencies = [
"lazy_static", "lazy_static",
"lock", "lock",
"log", "log",
"matchit 0.8.4", "matchit 0.8.5",
"mime", "mime",
"netif", "netif",
"pin-project-lite", "pin-project-lite",
@@ -2016,6 +2171,7 @@ dependencies = [
"router", "router",
"s3s", "s3s",
"serde_json", "serde_json",
"shadow-rs",
"time", "time",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
@@ -2033,9 +2189,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.37" version = "0.38.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"errno", "errno",
@@ -2046,9 +2202,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.14" version = "0.23.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e"
dependencies = [ dependencies = [
"log", "log",
"once_cell", "once_cell",
@@ -2070,9 +2226,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls-pki-types" name = "rustls-pki-types"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
[[package]] [[package]]
name = "rustls-webpki" name = "rustls-webpki"
@@ -2087,9 +2243,9 @@ dependencies = [
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"
[[package]] [[package]]
name = "ryu" name = "ryu"
@@ -2100,7 +2256,7 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]] [[package]]
name = "s3s" name = "s3s"
version = "0.11.0-dev" version = "0.11.0-dev"
source = "git+https://github.com/Nugine/s3s.git?rev=c41ac1d30a0ae3ded6a18cc1b5bbb98f8b7f35c2#c41ac1d30a0ae3ded6a18cc1b5bbb98f8b7f35c2" source = "git+https://github.com/Nugine/s3s.git?rev=b4ee0f7297d5ed23772fa8ba6e760c14f481990d#b4ee0f7297d5ed23772fa8ba6e760c14f481990d"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"async-trait", "async-trait",
@@ -2146,7 +2302,7 @@ dependencies = [
[[package]] [[package]]
name = "s3s-policy" name = "s3s-policy"
version = "0.11.0-dev" version = "0.11.0-dev"
source = "git+https://github.com/Nugine/s3s.git?rev=c41ac1d30a0ae3ded6a18cc1b5bbb98f8b7f35c2#c41ac1d30a0ae3ded6a18cc1b5bbb98f8b7f35c2" source = "git+https://github.com/Nugine/s3s.git?rev=b4ee0f7297d5ed23772fa8ba6e760c14f481990d#b4ee0f7297d5ed23772fa8ba6e760c14f481990d"
dependencies = [ dependencies = [
"indexmap 2.6.0", "indexmap 2.6.0",
"serde", "serde",
@@ -2175,6 +2331,18 @@ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]]
name = "serde-xml-rs"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782"
dependencies = [
"log",
"serde",
"thiserror",
"xml-rs",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.214" version = "1.0.214"
@@ -2242,6 +2410,19 @@ dependencies = [
"digest 0.11.0-pre.9", "digest 0.11.0-pre.9",
] ]
[[package]]
name = "shadow-rs"
version = "0.35.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1b2328fb3ec0d5302f95915e7e77cfc2ff943714d9970bc4b66e9eacf318687"
dependencies = [
"const_format",
"git2",
"is_debug",
"time",
"tzdb",
]
[[package]] [[package]]
name = "sharded-slab" name = "sharded-slab"
version = "0.1.7" version = "0.1.7"
@@ -2363,9 +2544,9 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.13.0" version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
@@ -2412,7 +2593,9 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa", "itoa",
"libc",
"num-conv", "num-conv",
"num_threads",
"powerfmt", "powerfmt",
"serde", "serde",
"time-core", "time-core",
@@ -2447,9 +2630,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.41.0" version = "1.41.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@@ -2711,12 +2894,47 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "tz-rs"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4"
dependencies = [
"const_fn",
]
[[package]]
name = "tzdb"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b580f6b365fa89f5767cdb619a55d534d04a4e14c2d7e5b9a31e94598687fb1"
dependencies = [
"iana-time-zone",
"tz-rs",
"tzdb_data",
]
[[package]]
name = "tzdb_data"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "654c1ec546942ce0594e8d220e6b8e3899e0a0a8fe70ddd54d32a376dfefe3f8"
dependencies = [
"tz-rs",
]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.13" version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@@ -2897,6 +3115,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.52.0" version = "0.52.0"
@@ -2991,6 +3218,12 @@ version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "xml-rs"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f"
[[package]] [[package]]
name = "xxhash-rust" name = "xxhash-rust"
version = "0.8.12" version = "0.8.12"
+2 -2
View File
@@ -50,10 +50,10 @@ prost-types = "0.13.3"
protobuf = "3.7" protobuf = "3.7"
protos = { path = "./common/protos" } protos = { path = "./common/protos" }
rand = "0.8.5" rand = "0.8.5"
s3s = { git = "https://github.com/Nugine/s3s.git", rev = "c41ac1d30a0ae3ded6a18cc1b5bbb98f8b7f35c2", default-features = true, features = [ s3s = { git = "https://github.com/Nugine/s3s.git", rev = "b4ee0f7297d5ed23772fa8ba6e760c14f481990d", default-features = true, features = [
"tower", "tower",
] } ] }
s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "c41ac1d30a0ae3ded6a18cc1b5bbb98f8b7f35c2" } s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "b4ee0f7297d5ed23772fa8ba6e760c14f481990d" }
serde = { version = "1.0.214", features = ["derive"] } serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132" serde_json = "1.0.132"
tempfile = "3.13.0" tempfile = "3.13.0"
+1 -28
View File
@@ -22,6 +22,7 @@ use crate::error::{Error, Result};
use crate::disk::BUCKET_META_PREFIX; use crate::disk::BUCKET_META_PREFIX;
use crate::store::ECStore; use crate::store::ECStore;
use crate::utils::xml::deserialize;
pub const BUCKET_METADATA_FILE: &str = ".metadata.bin"; pub const BUCKET_METADATA_FILE: &str = ".metadata.bin";
pub const BUCKET_METADATA_FORMAT: u16 = 1; pub const BUCKET_METADATA_FORMAT: u16 = 1;
@@ -427,31 +428,3 @@ mod test {
assert_eq!(bm.name, new.name); assert_eq!(bm.name, new.name);
} }
} }
pub fn deserialize<T>(input: &[u8]) -> xml::DeResult<T>
where
T: for<'xml> xml::Deserialize<'xml>,
{
let mut d = xml::Deserializer::new(input);
let ans = T::deserialize(&mut d)?;
d.expect_eof()?;
Ok(ans)
}
pub fn serialize_content<T: xml::SerializeContent>(val: &T) -> xml::SerResult<String> {
let mut buf = Vec::with_capacity(256);
{
let mut ser = xml::Serializer::new(&mut buf);
val.serialize_content(&mut ser)?;
}
Ok(String::from_utf8(buf).unwrap())
}
pub fn serialize<T: xml::Serialize>(val: &T) -> xml::SerResult<Vec<u8>> {
let mut buf = Vec::with_capacity(256);
{
let mut ser = xml::Serializer::new(&mut buf);
val.serialize(&mut ser)?;
}
Ok(buf)
}
+2 -1
View File
@@ -10,6 +10,7 @@ use crate::disk::error::DiskError;
use crate::error::{Error, Result}; use crate::error::{Error, Result};
use crate::global::{is_dist_erasure, is_erasure, new_object_layer_fn, GLOBAL_Endpoints}; use crate::global::{is_dist_erasure, is_erasure, new_object_layer_fn, GLOBAL_Endpoints};
use crate::store::ECStore; use crate::store::ECStore;
use crate::utils::xml::deserialize;
use futures::future::join_all; use futures::future::join_all;
use s3s::dto::{ use s3s::dto::{
BucketLifecycleConfiguration, NotificationConfiguration, ObjectLockConfiguration, ReplicationConfiguration, BucketLifecycleConfiguration, NotificationConfiguration, ObjectLockConfiguration, ReplicationConfiguration,
@@ -19,7 +20,7 @@ use time::OffsetDateTime;
use tokio::sync::RwLock; use tokio::sync::RwLock;
use tracing::{error, warn}; use tracing::{error, warn};
use super::metadata::{deserialize, load_bucket_metadata, BucketMetadata}; use super::metadata::{load_bucket_metadata, BucketMetadata};
use super::policy::bucket_policy::BucketPolicy; use super::policy::bucket_policy::BucketPolicy;
use super::quota::BucketQuota; use super::quota::BucketQuota;
use super::target::BucketTargets; use super::target::BucketTargets;
+22 -25
View File
@@ -53,31 +53,28 @@ pub static DEFAULT_INLINE_BLOCK: usize = 128 * 1024;
lazy_static! { lazy_static! {
pub static ref DefaultKVS: KVS = { pub static ref DefaultKVS: KVS = {
let mut kvs = Vec::new(); let kvs = vec![
KV {
kvs.push(KV { key: CLASS_STANDARD.to_owned(),
key: CLASS_STANDARD.to_owned(), value: "".to_owned(),
value: "".to_owned(), hidden_if_empty: false,
hidden_if_empty: false, },
}); KV {
key: CLASS_RRS.to_owned(),
kvs.push(KV { value: "EC:1".to_owned(),
key: CLASS_RRS.to_owned(), hidden_if_empty: false,
value: "EC:1".to_owned(), },
hidden_if_empty: false, KV {
}); key: OPTIMIZE.to_owned(),
value: "availability".to_owned(),
kvs.push(KV { hidden_if_empty: false,
key: OPTIMIZE.to_owned(), },
value: "availability".to_owned(), KV {
hidden_if_empty: false, key: INLINE_BLOCK.to_owned(),
}); value: "".to_owned(),
hidden_if_empty: true,
kvs.push(KV { },
key: INLINE_BLOCK.to_owned(), ];
value: "".to_owned(),
hidden_if_empty: true,
});
KVS(kvs) KVS(kvs)
}; };
+33 -24
View File
@@ -67,34 +67,36 @@ impl Erasure {
); );
let mut total: usize = 0; let mut total: usize = 0;
loop { loop {
let new_len = { if total_size > 0 {
let remain = total_size - total; let new_len = {
if remain > self.block_size { let remain = total_size - total;
self.block_size if remain > self.block_size {
} else { self.block_size
remain
}
};
if new_len == 0 {
break;
}
self.buf.resize(new_len, 0u8);
match reader.read_exact(&mut self.buf).await {
Ok(res) => res,
Err(e) => {
if let ErrorKind::UnexpectedEof = e.kind() {
break;
} else { } else {
return Err(Error::new(e)); remain
} }
} };
};
total += self.buf.len(); if new_len == 0 && total > 0 {
break;
}
self.buf.resize(new_len, 0u8);
match reader.read_exact(&mut self.buf).await {
Ok(res) => res,
Err(e) => {
if let ErrorKind::UnexpectedEof = e.kind() {
break;
} else {
return Err(Error::new(e));
}
}
};
total += self.buf.len();
}
let blocks = self.encode_data(&self.buf)?; let blocks = self.encode_data(&self.buf)?;
let mut errs = Vec::new(); let mut errs = Vec::new();
@@ -112,6 +114,9 @@ impl Erasure {
let none_count = errs.iter().filter(|&x| x.is_none()).count(); let none_count = errs.iter().filter(|&x| x.is_none()).count();
if none_count >= write_quorum { if none_count >= write_quorum {
if total_size == 0 {
break;
}
continue; continue;
} }
@@ -119,6 +124,10 @@ impl Erasure {
warn!("Erasure encode errs {:?}", &errs); warn!("Erasure encode errs {:?}", &errs);
return Err(err); return Err(err);
} }
if total_size == 0 {
break;
}
} }
Ok(total) Ok(total)
+1 -1
View File
@@ -17,7 +17,7 @@ mod sets;
pub mod store; pub mod store;
pub mod store_api; pub mod store_api;
mod store_init; mod store_init;
mod utils; pub mod utils;
pub mod bucket; pub mod bucket;
pub mod file_meta_inline; pub mod file_meta_inline;
+1 -1
View File
@@ -64,7 +64,7 @@ pub fn put_opts_from_headers(
} }
fn get_default_opts( fn get_default_opts(
headers: &HeaderMap<HeaderValue>, _headers: &HeaderMap<HeaderValue>,
metadata: HashMap<String, String>, metadata: HashMap<String, String>,
_copy_source: bool, _copy_source: bool,
) -> Result<ObjectOptions> { ) -> Result<ObjectOptions> {
+4 -3
View File
@@ -22,6 +22,7 @@ use crate::store_err::{
use crate::store_init::ec_drives_no_config; use crate::store_init::ec_drives_no_config;
use crate::utils::crypto::base64_decode; use crate::utils::crypto::base64_decode;
use crate::utils::path::{base_dir_from_prefix, decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; use crate::utils::path::{base_dir_from_prefix, decode_dir_object, encode_dir_object, SLASH_SEPARATOR};
use crate::utils::xml;
use crate::{ use crate::{
bucket::metadata::BucketMetadata, bucket::metadata::BucketMetadata,
disk::{error::DiskError, new_disk, DiskOption, DiskStore, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET}, disk::{error::DiskError, new_disk, DiskOption, DiskStore, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET},
@@ -954,12 +955,12 @@ impl StorageAPI for ECStore {
} }
if opts.lock_enabled { if opts.lock_enabled {
meta.object_lock_config_xml = metadata::serialize::<ObjectLockConfiguration>(&enableObjcetLockConfig)?; meta.object_lock_config_xml = xml::serialize::<ObjectLockConfiguration>(&enableObjcetLockConfig)?;
meta.versioning_config_xml = metadata::serialize::<VersioningConfiguration>(&enableVersioningConfig)?; meta.versioning_config_xml = xml::serialize::<VersioningConfiguration>(&enableVersioningConfig)?;
} }
if opts.versioning_enabled { if opts.versioning_enabled {
meta.versioning_config_xml = metadata::serialize::<VersioningConfiguration>(&enableVersioningConfig)?; meta.versioning_config_xml = xml::serialize::<VersioningConfiguration>(&enableVersioningConfig)?;
} }
meta.save(self).await?; meta.save(self).await?;
+1
View File
@@ -6,3 +6,4 @@ pub mod net;
pub mod os; pub mod os;
pub mod path; pub mod path;
pub mod wildcard; pub mod wildcard;
pub mod xml;
+1 -1
View File
@@ -1,4 +1,4 @@
use std::path::{Path, PathBuf}; use std::path::PathBuf;
const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__";
+29
View File
@@ -0,0 +1,29 @@
use s3s::xml;
pub fn deserialize<T>(input: &[u8]) -> xml::DeResult<T>
where
T: for<'xml> xml::Deserialize<'xml>,
{
let mut d = xml::Deserializer::new(input);
let ans = T::deserialize(&mut d)?;
d.expect_eof()?;
Ok(ans)
}
pub fn serialize_content<T: xml::SerializeContent>(val: &T) -> xml::SerResult<String> {
let mut buf = Vec::with_capacity(256);
{
let mut ser = xml::Serializer::new(&mut buf);
val.serialize_content(&mut ser)?;
}
Ok(String::from_utf8(buf).unwrap())
}
pub fn serialize<T: xml::Serialize>(val: &T) -> xml::SerResult<Vec<u8>> {
let mut buf = Vec::with_capacity(256);
{
let mut ser = xml::Serializer::new(&mut buf);
val.serialize(&mut ser)?;
}
Ok(buf)
}
+1
View File
@@ -1,2 +1,3 @@
pub const AMZ_OBJECT_TAGGING: &str = "X-Amz-Tagging"; pub const AMZ_OBJECT_TAGGING: &str = "X-Amz-Tagging";
pub const AMZ_STORAGE_CLASS: &str = "x-amz-storage-class"; pub const AMZ_STORAGE_CLASS: &str = "x-amz-storage-class";
pub const AMZ_DECODED_CONTENT_LENGTH: &str = "X-Amz-Decoded-Content-Length";
+6
View File
@@ -15,3 +15,9 @@ hyper.workspace = true
matchit = "0.8.4" matchit = "0.8.4"
pin-project-lite.workspace = true pin-project-lite.workspace = true
common.workspace = true common.workspace = true
serde_urlencoded = "0.7.1"
serde.workspace = true
quick-xml = "0.37.0"
serde-xml-rs = "0.6.0"
ecstore.workspace = true
time.workspace = true
+90 -3
View File
@@ -1,16 +1,103 @@
use crate::router::Operation;
use ecstore::utils::xml;
use hyper::StatusCode; use hyper::StatusCode;
use matchit::Params; use matchit::Params;
use s3s::{s3_error, Body, S3Request, S3Response, S3Result}; use s3s::{
dto::{AssumeRoleOutput, Credentials, Timestamp},
s3_error, Body, S3Request, S3Response, S3Result,
};
use serde::Deserialize;
use serde_urlencoded::from_bytes;
use time::{Duration, OffsetDateTime};
use tracing::warn; use tracing::warn;
use crate::router::Operation; #[derive(Deserialize, Debug, Default)]
#[serde(rename_all = "PascalCase", default)]
pub struct AssumeRoleRequest {
pub action: String,
pub duration_seconds: usize,
pub version: String,
pub role_arn: String,
pub role_session_name: String,
pub policy: String,
pub external_id: String,
}
// #[derive(Debug, Serialize, Default)]
// #[serde(rename_all = "PascalCase", default)]
// pub struct AssumeRoleResponse {
// #[serde(rename = "AssumeRoleResult")]
// pub result: AssumeRoleResult,
// }
// #[derive(Debug, Serialize, Default)]
// #[serde(rename_all = "PascalCase", default)]
// pub struct AssumeRoleResult {
// pub credentials: Credentials,
// }
// #[derive(Debug, Serialize, Default)]
// #[serde(rename_all = "PascalCase", default)]
// pub struct Credentials {
// #[serde(rename = "AccessKeyId")]
// pub access_key: String,
// #[serde(rename = "SecretAccessKey")]
// pub secret_key: String,
// pub status: String,
// pub expiration: usize,
// pub session_token: String,
// pub parent_user: String,
// }
pub struct AssumeRoleHandle {} pub struct AssumeRoleHandle {}
#[async_trait::async_trait] #[async_trait::async_trait]
impl Operation for AssumeRoleHandle { impl Operation for AssumeRoleHandle {
async fn call(&self, _req: S3Request<Body>, _params: Params<'_, '_>) -> S3Result<S3Response<(StatusCode, Body)>> { async fn call(&self, req: S3Request<Body>, _params: Params<'_, '_>) -> S3Result<S3Response<(StatusCode, Body)>> {
warn!("handle AssumeRoleHandle"); warn!("handle AssumeRoleHandle");
let Some(cred) = req.credentials else { return Err(s3_error!(InvalidRequest, "get cred failed")) };
let mut input = req.input;
let Some(bytes) = input.take_bytes() else {
return Err(s3_error!(InvalidRequest, "get body failed"));
};
let body: AssumeRoleRequest = from_bytes(&bytes).map_err(|_e| s3_error!(InvalidRequest, "get body failed"))?;
warn!("AssumeRole get body {:?}", body);
let exp = OffsetDateTime::now_utc().saturating_add(Duration::days(1));
// TODO: create tmp access_key
let resp = AssumeRoleOutput {
credentials: Some(Credentials {
access_key_id: cred.access_key,
expiration: Timestamp::from(exp),
secret_access_key: cred.secret_key.expose().to_string(),
session_token: "sdfsdf".to_owned(),
}),
..Default::default()
};
// getAssumeRoleCredentials
let output = xml::serialize::<AssumeRoleOutput>(&resp).unwrap();
Ok(S3Response::new((StatusCode::OK, Body::from(output))))
// return Err(s3_error!(NotImplemented));
}
}
pub struct AccountInfoHandler {}
#[async_trait::async_trait]
impl Operation for AccountInfoHandler {
async fn call(&self, req: S3Request<Body>, _params: Params<'_, '_>) -> S3Result<S3Response<(StatusCode, Body)>> {
warn!("handle AccountInfoHandler");
let Some(cred) = req.credentials else { return Err(s3_error!(InvalidRequest, "get cred failed")) };
warn!("AccountInfoHandler cread {:?}", &cred);
return Err(s3_error!(NotImplemented)); return Err(s3_error!(NotImplemented));
} }
} }
+5 -1
View File
@@ -12,7 +12,11 @@ pub fn make_admin_route() -> Result<impl S3Route> {
let mut r = S3Router::new(); let mut r = S3Router::new();
r.insert(Method::POST, "/", AdminOperation(&handlers::AssumeRoleHandle {}))?; r.insert(Method::POST, "/", AdminOperation(&handlers::AssumeRoleHandle {}))?;
r.insert(
Method::GET,
format!("{}{}", ADMIN_PREFIX, "/v3/accountinfo").as_str(),
AdminOperation(&handlers::AccountInfoHandler {}),
)?;
r.insert( r.insert(
Method::POST, Method::POST,
format!("{}{}", ADMIN_PREFIX, "/v3/service").as_str(), format!("{}{}", ADMIN_PREFIX, "/v3/service").as_str(),
+4
View File
@@ -55,6 +55,9 @@ admin = { path = "../api/admin" }
axum.workspace = true axum.workspace = true
router = { version = "0.0.1", path = "../router" } router = { version = "0.0.1", path = "../router" }
matchit = "0.8.4" matchit = "0.8.4"
shadow-rs = "0.35.2"
const-str = { version = "0.5.7", features = ["std", "proc"] }
atoi = "2.0.0"
[build-dependencies] [build-dependencies]
prost-build.workspace = true prost-build.workspace = true
@@ -75,4 +78,5 @@ hyper-util = { version = "0.1.10", features = [
] } ] }
transform-stream = "0.3.0" transform-stream = "0.3.0"
netif = "0.1.6" netif = "0.1.6"
shadow-rs = "0.35.2"
# pin-utils = "0.1.0" # pin-utils = "0.1.0"
+3
View File
@@ -0,0 +1,3 @@
fn main() -> shadow_rs::SdResult<()> {
shadow_rs::new()
}
+28
View File
@@ -1,4 +1,7 @@
use clap::Parser; use clap::Parser;
use const_str::concat;
shadow_rs::shadow!(build);
/// Default port that a rustfs server listens on. /// Default port that a rustfs server listens on.
/// ///
@@ -7,7 +10,32 @@ pub const DEFAULT_PORT: u16 = 9000;
pub const DEFAULT_ACCESS_KEY: &str = "rustfsadmin"; pub const DEFAULT_ACCESS_KEY: &str = "rustfsadmin";
pub const DEFAULT_SECRET_KEY: &str = "rustfsadmin"; pub const DEFAULT_SECRET_KEY: &str = "rustfsadmin";
#[allow(clippy::const_is_empty)]
const SHORT_VERSION: &str = {
if !build::TAG.is_empty() {
build::TAG
} else if !build::SHORT_COMMIT.is_empty() {
concat!("@", build::SHORT_COMMIT)
} else {
build::PKG_VERSION
}
};
const LONG_VERSION: &str = concat!(
concat!(SHORT_VERSION, "\n"),
concat!("build time : ", build::BUILD_TIME, "\n"),
concat!("build profile: ", build::BUILD_RUST_CHANNEL, "\n"),
concat!("build os : ", build::BUILD_OS, "\n"),
concat!("rust version : ", build::RUST_VERSION, "\n"),
concat!("rust channel : ", build::RUST_CHANNEL, "\n"),
concat!("git branch : ", build::BRANCH, "\n"),
concat!("git commit : ", build::COMMIT_HASH, "\n"),
concat!("git tag : ", build::TAG, "\n"),
concat!("git status :\n", build::GIT_STATUS_FILE),
);
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(version = SHORT_VERSION, long_version = LONG_VERSION)]
pub struct Opt { pub struct Opt {
/// DIR points to a directory on a filesystem. /// DIR points to a directory on a filesystem.
#[arg(required = true)] #[arg(required = true)]
+1 -1
View File
@@ -5,7 +5,7 @@ use ecstore::{
DeleteOptions, DiskAPI, DiskInfoOptions, DiskStore, FileInfoVersions, ReadMultipleReq, ReadOptions, Reader, DeleteOptions, DiskAPI, DiskInfoOptions, DiskStore, FileInfoVersions, ReadMultipleReq, ReadOptions, Reader,
UpdateMetadataOpts, WalkDirOptions, UpdateMetadataOpts, WalkDirOptions,
}, },
erasure::{ReadAt, Writer}, erasure::Writer,
peer::{LocalPeerS3Client, PeerS3Client}, peer::{LocalPeerS3Client, PeerS3Client},
store::{all_local_disk_path, find_local_disk}, store::{all_local_disk_path, find_local_disk},
store_api::{BucketOptions, DeleteBucketOptions, FileInfo, MakeBucketOptions}, store_api::{BucketOptions, DeleteBucketOptions, FileInfo, MakeBucketOptions},
+34 -10
View File
@@ -1,7 +1,6 @@
use bytes::Bytes; use bytes::Bytes;
use common::error::Result; use common::error::Result;
use ecstore::bucket::error::BucketMetadataError; use ecstore::bucket::error::BucketMetadataError;
use ecstore::bucket::metadata;
use ecstore::bucket::metadata::BUCKET_LIFECYCLE_CONFIG; use ecstore::bucket::metadata::BUCKET_LIFECYCLE_CONFIG;
use ecstore::bucket::metadata::BUCKET_NOTIFICATION_CONFIG; use ecstore::bucket::metadata::BUCKET_NOTIFICATION_CONFIG;
use ecstore::bucket::metadata::BUCKET_POLICY_CONFIG; use ecstore::bucket::metadata::BUCKET_POLICY_CONFIG;
@@ -33,6 +32,7 @@ use ecstore::store_api::ObjectOptions;
use ecstore::store_api::ObjectToDelete; use ecstore::store_api::ObjectToDelete;
use ecstore::store_api::PutObjReader; use ecstore::store_api::PutObjReader;
use ecstore::store_api::StorageAPI; use ecstore::store_api::StorageAPI;
use ecstore::utils::xml;
use ecstore::xhttp; use ecstore::xhttp;
use futures::pin_mut; use futures::pin_mut;
use futures::{Stream, StreamExt}; use futures::{Stream, StreamExt};
@@ -588,7 +588,19 @@ impl S3 for FS {
let Some(body) = body else { return Err(s3_error!(IncompleteBody)) }; let Some(body) = body else { return Err(s3_error!(IncompleteBody)) };
let Some(content_length) = content_length else { return Err(s3_error!(IncompleteBody)) }; let content_length = match content_length {
Some(c) => c,
None => {
if let Some(val) = req.headers.get(xhttp::AMZ_DECODED_CONTENT_LENGTH) {
match atoi::atoi::<i64>(val.as_bytes()) {
Some(x) => x,
None => return Err(s3_error!(UnexpectedContent)),
}
} else {
return Err(s3_error!(UnexpectedContent));
}
}
};
let mut reader = PutObjReader::new(body, content_length as usize); let mut reader = PutObjReader::new(body, content_length as usize);
@@ -677,7 +689,19 @@ impl S3 for FS {
// let upload_id = // let upload_id =
let body = body.ok_or_else(|| s3_error!(IncompleteBody))?; let body = body.ok_or_else(|| s3_error!(IncompleteBody))?;
let content_length = content_length.ok_or_else(|| s3_error!(IncompleteBody))?; let content_length = match content_length {
Some(c) => c,
None => {
if let Some(val) = req.headers.get(xhttp::AMZ_DECODED_CONTENT_LENGTH) {
match atoi::atoi::<i64>(val.as_bytes()) {
Some(x) => x,
None => return Err(s3_error!(UnexpectedContent)),
}
} else {
return Err(s3_error!(UnexpectedContent));
}
}
};
// mc cp step 4 // mc cp step 4
let mut data = PutObjReader::new(body, content_length as usize); let mut data = PutObjReader::new(body, content_length as usize);
@@ -844,7 +868,7 @@ impl S3 for FS {
} }
} }
let data = try_!(metadata::serialize(&tagging)); let data = try_!(xml::serialize(&tagging));
try_!(metadata_sys::update(&bucket, BUCKET_TAGGING_CONFIG, data).await); try_!(metadata_sys::update(&bucket, BUCKET_TAGGING_CONFIG, data).await);
@@ -979,7 +1003,7 @@ impl S3 for FS {
// check bucket object lock enable // check bucket object lock enable
// check replication suspended // check replication suspended
let data = try_!(metadata::serialize(&versioning_configuration)); let data = try_!(xml::serialize(&versioning_configuration));
try_!(metadata_sys::update(&bucket, BUCKET_VERSIONING_CONFIG, data).await); try_!(metadata_sys::update(&bucket, BUCKET_VERSIONING_CONFIG, data).await);
@@ -1142,7 +1166,7 @@ impl S3 for FS {
let Some(input_cfg) = lifecycle_configuration else { return Err(s3_error!(InvalidArgument)) }; let Some(input_cfg) = lifecycle_configuration else { return Err(s3_error!(InvalidArgument)) };
let data = try_!(metadata::serialize(&input_cfg)); let data = try_!(xml::serialize(&input_cfg));
try_!(metadata_sys::update(&bucket, BUCKET_LIFECYCLE_CONFIG, data).await); try_!(metadata_sys::update(&bucket, BUCKET_LIFECYCLE_CONFIG, data).await);
Ok(S3Response::new(PutBucketLifecycleConfigurationOutput::default())) Ok(S3Response::new(PutBucketLifecycleConfigurationOutput::default()))
@@ -1238,7 +1262,7 @@ impl S3 for FS {
// TODO: check kms // TODO: check kms
let data = try_!(metadata::serialize(&server_side_encryption_configuration)); let data = try_!(xml::serialize(&server_side_encryption_configuration));
try_!(metadata_sys::update(&bucket, BUCKET_SSECONFIG, data).await); try_!(metadata_sys::update(&bucket, BUCKET_SSECONFIG, data).await);
Ok(S3Response::new(PutBucketEncryptionOutput::default())) Ok(S3Response::new(PutBucketEncryptionOutput::default()))
} }
@@ -1316,7 +1340,7 @@ impl S3 for FS {
} }
} }
let data = try_!(metadata::serialize(&input_cfg)); let data = try_!(xml::serialize(&input_cfg));
try_!(metadata_sys::update(&bucket, OBJECT_LOCK_CONFIG, data).await); try_!(metadata_sys::update(&bucket, OBJECT_LOCK_CONFIG, data).await);
@@ -1381,7 +1405,7 @@ impl S3 for FS {
} }
// TODO: check enable, versioning enable // TODO: check enable, versioning enable
let data = try_!(metadata::serialize(&replication_configuration)); let data = try_!(xml::serialize(&replication_configuration));
try_!(metadata_sys::update(&bucket, BUCKET_REPLICATION_CONFIG, data).await); try_!(metadata_sys::update(&bucket, BUCKET_REPLICATION_CONFIG, data).await);
@@ -1486,7 +1510,7 @@ impl S3 for FS {
} }
} }
let data = try_!(metadata::serialize(&notification_configuration)); let data = try_!(xml::serialize(&notification_configuration));
try_!(metadata_sys::update(&bucket, BUCKET_NOTIFICATION_CONFIG, data).await); try_!(metadata_sys::update(&bucket, BUCKET_NOTIFICATION_CONFIG, data).await);