diff --git a/Cargo.lock b/Cargo.lock index 60bd0acbd..ed330cd55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -388,7 +388,7 @@ dependencies = [ "arrow-schema", "chrono", "half", - "indexmap 2.8.0", + "indexmap 2.9.0", "lexical-core", "memchr", "num", @@ -1626,6 +1626,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32c" version = "0.6.8" @@ -1644,6 +1659,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crc64fast-nvme" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4955638f00a809894c947f85a024020a20815b65a5eea633798ea7924edab2b3" +dependencies = [ + "crc", +] + [[package]] name = "crossbeam-channel" version = "0.5.14" @@ -1933,7 +1957,7 @@ dependencies = [ "base64 0.22.1", "half", "hashbrown 0.14.5", - "indexmap 2.8.0", + "indexmap 2.9.0", "libc", "log", "object_store", @@ -2028,7 +2052,7 @@ dependencies = [ "datafusion-functions-aggregate-common", "datafusion-functions-window-common", "datafusion-physical-expr-common", - "indexmap 2.8.0", + "indexmap 2.9.0", "paste", "recursive", "serde_json", @@ -2043,7 +2067,7 @@ checksum = "18f0a851a436c5a2139189eb4617a54e6a9ccb9edc96c4b3c83b3bb7c58b950e" dependencies = [ "arrow", "datafusion-common", - "indexmap 2.8.0", + "indexmap 2.9.0", "itertools 0.14.0", "paste", ] @@ -2197,7 +2221,7 @@ dependencies = [ "datafusion-common", "datafusion-expr", "datafusion-physical-expr", - "indexmap 2.8.0", + "indexmap 2.9.0", "itertools 0.14.0", "log", "recursive", @@ -2220,7 +2244,7 @@ dependencies = [ "datafusion-physical-expr-common", "half", "hashbrown 0.14.5", - "indexmap 2.8.0", + "indexmap 2.9.0", "itertools 0.14.0", "log", "paste", @@ -2282,7 +2306,7 @@ dependencies = [ "futures", "half", "hashbrown 0.14.5", - "indexmap 2.8.0", + "indexmap 2.9.0", "itertools 0.14.0", "log", "parking_lot 0.12.3", @@ -2300,7 +2324,7 @@ dependencies = [ "bigdecimal", "datafusion-common", "datafusion-expr", - "indexmap 2.8.0", + "indexmap 2.9.0", "log", "recursive", "regex", @@ -3816,7 +3840,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.8.0", + "indexmap 2.9.0", "slab", "tokio", "tokio-util", @@ -4301,9 +4325,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -6000,7 +6024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset", - "indexmap 2.8.0", + "indexmap 2.9.0", ] [[package]] @@ -7338,8 +7362,8 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "s3s" -version = "0.11.0-dev" -source = "git+https://github.com/Nugine/s3s.git?rev=ab139f72fe768fb9d8cecfe36269451da1ca9779#ab139f72fe768fb9d8cecfe36269451da1ca9779" +version = "0.12.0-dev" +source = "git+https://github.com/Nugine/s3s.git?rev=3ad13ace7af703c3c8afc99cf19f4c18c82603a3#3ad13ace7af703c3c8afc99cf19f4c18c82603a3" dependencies = [ "arrayvec", "async-trait", @@ -7348,17 +7372,20 @@ dependencies = [ "bytes", "bytestring", "chrono", + "const-str", "crc32c", "crc32fast", - "digest 0.11.0-pre.10", + "crc64fast-nvme", "futures", "hex-simd", "hmac 0.13.0-pre.5", + "http", "http-body", "http-body-util", "httparse", "hyper", "itoa 1.0.15", + "md-5", "memchr", "mime", "nom", @@ -7385,10 +7412,10 @@ dependencies = [ [[package]] name = "s3s-policy" -version = "0.11.0-dev" -source = "git+https://github.com/Nugine/s3s.git?rev=ab139f72fe768fb9d8cecfe36269451da1ca9779#ab139f72fe768fb9d8cecfe36269451da1ca9779" +version = "0.12.0-dev" +source = "git+https://github.com/Nugine/s3s.git?rev=3ad13ace7af703c3c8afc99cf19f4c18c82603a3#3ad13ace7af703c3c8afc99cf19f4c18c82603a3" dependencies = [ - "indexmap 2.8.0", + "indexmap 2.9.0", "serde", "serde_json", "thiserror 2.0.12", @@ -7839,9 +7866,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" [[package]] name = "snafu" @@ -8455,7 +8482,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.8.0", + "indexmap 2.9.0", "toml_datetime", "winnow 0.5.40", ] @@ -8466,7 +8493,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.8.0", + "indexmap 2.9.0", "toml_datetime", "winnow 0.5.40", ] @@ -8477,7 +8504,7 @@ version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ - "indexmap 2.8.0", + "indexmap 2.9.0", "serde", "serde_spanned", "toml_datetime", @@ -8596,7 +8623,7 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "indexmap 2.8.0", + "indexmap 2.9.0", "pin-project-lite", "slab", "sync_wrapper", diff --git a/Cargo.toml b/Cargo.toml index 9f1b721ce..780477d2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,10 +101,8 @@ rust-embed = "8.6.0" rustls = { version = "0.23" } rustls-pki-types = "1.11.0" rustls-pemfile = "2.2.0" -s3s = { git = "https://github.com/Nugine/s3s.git", rev = "ab139f72fe768fb9d8cecfe36269451da1ca9779", default-features = true, features = [ - "tower", -] } -s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "ab139f72fe768fb9d8cecfe36269451da1ca9779" } +s3s = { git = "https://github.com/Nugine/s3s.git", rev = "3ad13ace7af703c3c8afc99cf19f4c18c82603a3" } +s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "3ad13ace7af703c3c8afc99cf19f4c18c82603a3" } shadow-rs = { version = "0.38.0", default-features = false } serde = { version = "1.0.217", features = ["derive"] } serde_json = "1.0.138" diff --git a/rustfs/src/admin/router.rs b/rustfs/src/admin/router.rs index 4fb605d69..d19d4da2c 100644 --- a/rustfs/src/admin/router.rs +++ b/rustfs/src/admin/router.rs @@ -67,14 +67,16 @@ where uri.path().starts_with(ADMIN_PREFIX) || uri.path().starts_with(RPC_PREFIX) } - async fn call(&self, req: S3Request) -> S3Result> { + async fn call(&self, req: S3Request) -> S3Result> { let uri = format!("{}|{}", &req.method, req.uri.path()); // warn!("get uri {}", &uri); if let Ok(mat) = self.router.at(&uri) { let op: &T = mat.value; - return op.call(req, mat.params).await; + let mut resp = op.call(req, mat.params).await?; + resp.status = Some(resp.output.0); + return Ok(resp.map_output(|x| x.1)); } return Err(s3_error!(NotImplemented)); diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index cd1c72d1c..f2b69999e 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -226,7 +226,7 @@ async fn run(opt: config::Opt) -> Result<()> { // Setup S3 service // 本项目使用 s3s 库来实现 s3 服务 - let service = { + let s3_service = { let store = storage::ecfs::FS::new(); // let mut b = S3ServiceBuilder::new(storage::ecfs::FS::new(server_address.clone(), endpoint_pools).await?); let mut b = S3ServiceBuilder::new(store.clone()); @@ -308,11 +308,10 @@ async fn run(opt: config::Opt) -> Result<()> { let mut sigterm_inner = sigterm_inner; let mut sigint_inner = sigint_inner; - let hyper_service = service.into_shared(); let hybrid_service = TowerToHyperService::new( tower::ServiceBuilder::new() .layer(CorsLayer::permissive()) - .service(hybrid(hyper_service, rpc_service)), + .service(hybrid(s3_service, rpc_service)), ); let http_server = ConnBuilder::new(TokioExecutor::new()); diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index a235542b8..f1f53b9fb 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -1069,11 +1069,11 @@ impl S3 for FS { #[tracing::instrument(level = "debug", skip(self))] async fn get_bucket_tagging(&self, req: S3Request) -> S3Result> { - let GetBucketTaggingInput { bucket, .. } = req.input; + let bucket = req.input.bucket.clone(); // check bucket exists. let _bucket = self - .head_bucket(S3Request::new(HeadBucketInput { - bucket: bucket.clone(), + .head_bucket(req.map_input(|input| HeadBucketInput { + bucket: input.bucket, expected_bucket_owner: None, })) .await?;