update tonic axum

Signed-off-by: junxiang Mu <1948535941@qq.com>
This commit is contained in:
junxiang Mu
2025-04-09 02:39:46 +00:00
parent 5fd9b17b53
commit ebf1a9d9c4
8 changed files with 99 additions and 132 deletions

195
Cargo.lock generated
View File

@@ -614,28 +614,6 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "async-stream"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476"
dependencies = [
"async-stream-impl",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-stream-impl"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.100",
]
[[package]]
name = "async-task"
version = "4.7.1"
@@ -722,13 +700,13 @@ dependencies = [
[[package]]
name = "axum"
version = "0.7.9"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
checksum = "de45108900e1f9b9242f7f2e254aa3e2c029c921c258fe9e6b4217eeebd54288"
dependencies = [
"async-trait",
"axum-core",
"bytes",
"form_urlencoded",
"futures-util",
"http",
"http-body",
@@ -736,7 +714,7 @@ dependencies = [
"hyper",
"hyper-util",
"itoa 1.0.15",
"matchit 0.7.3",
"matchit",
"memchr",
"mime",
"percent-encoding",
@@ -756,13 +734,12 @@ dependencies = [
[[package]]
name = "axum-core"
version = "0.4.5"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"futures-core",
"http",
"http-body",
"http-body-util",
@@ -777,24 +754,23 @@ dependencies = [
[[package]]
name = "axum-server"
version = "0.6.0"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ad46c3ec4e12f4a4b6835e173ba21c25e484c9d02b49770bf006ce5367c036"
checksum = "495c05f60d6df0093e8fb6e74aa5846a0ad06abaf96d76166283720bf740f8ab"
dependencies = [
"arc-swap",
"bytes",
"futures-util",
"fs-err",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-util",
"pin-project-lite",
"rustls 0.21.12",
"rustls",
"rustls-pemfile",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.24.1",
"tower 0.4.13",
"tokio-rustls",
"tower-service",
]
@@ -1389,7 +1365,7 @@ dependencies = [
"lazy_static",
"scopeguard",
"tokio",
"tonic",
"tonic 0.13.0",
"tracing-error",
]
@@ -3007,7 +2983,7 @@ dependencies = [
"serde",
"serde_json",
"tokio",
"tonic",
"tonic 0.13.0",
"tower 0.5.2",
"url",
]
@@ -3063,7 +3039,7 @@ dependencies = [
"tokio",
"tokio-stream",
"tokio-util",
"tonic",
"tonic 0.13.0",
"tower 0.5.2",
"tracing",
"tracing-error",
@@ -3285,6 +3261,16 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "fs-err"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f89bda4c2a21204059a977ed3bfe746677dfd137b83c339e702b0ac91d482aa"
dependencies = [
"autocfg",
"tokio",
]
[[package]]
name = "fs_extra"
version = "1.3.0"
@@ -4042,10 +4028,10 @@ dependencies = [
"http",
"hyper",
"hyper-util",
"rustls 0.23.25",
"rustls",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.26.2",
"tokio-rustls",
"tower-service",
"webpki-roots",
]
@@ -4764,7 +4750,7 @@ dependencies = [
"serde",
"serde_json",
"tokio",
"tonic",
"tonic 0.13.0",
"tracing",
"tracing-error",
"url",
@@ -4918,15 +4904,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
[[package]]
name = "matchit"
version = "0.7.3"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]]
name = "matchit"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f926ade0c4e170215ae43342bf13b9310a437609c81f29f86c5df6657582ef9"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
[[package]]
name = "md-5"
@@ -5616,7 +5596,7 @@ dependencies = [
"reqwest",
"thiserror 2.0.12",
"tokio",
"tonic",
"tonic 0.12.3",
"tracing",
]
@@ -5643,7 +5623,7 @@ dependencies = [
"opentelemetry",
"opentelemetry_sdk",
"prost",
"tonic",
"tonic 0.12.3",
]
[[package]]
@@ -6495,7 +6475,7 @@ dependencies = [
"prost-build",
"protobuf 3.7.2",
"tokio",
"tonic",
"tonic 0.13.0",
"tonic-build",
"tower 0.5.2",
]
@@ -6548,7 +6528,7 @@ dependencies = [
"quinn-proto",
"quinn-udp",
"rustc-hash 2.1.1",
"rustls 0.23.25",
"rustls",
"socket2",
"thiserror 2.0.12",
"tokio",
@@ -6567,7 +6547,7 @@ dependencies = [
"rand 0.9.0",
"ring",
"rustc-hash 2.1.1",
"rustls 0.23.25",
"rustls",
"rustls-pki-types",
"slab",
"thiserror 2.0.12",
@@ -6905,7 +6885,7 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"quinn",
"rustls 0.23.25",
"rustls",
"rustls-pemfile",
"rustls-pki-types",
"serde",
@@ -6914,7 +6894,7 @@ dependencies = [
"sync_wrapper",
"system-configuration",
"tokio",
"tokio-rustls 0.26.2",
"tokio-rustls",
"tokio-util",
"tower 0.5.2",
"tower-service",
@@ -7147,7 +7127,7 @@ dependencies = [
"local-ip-address",
"lock",
"madmin",
"matchit 0.8.6",
"matchit",
"mime",
"mime_guess",
"netif",
@@ -7163,7 +7143,7 @@ dependencies = [
"rmp-serde",
"rust-embed",
"rustfs-obs",
"rustls 0.23.25",
"rustls",
"rustls-pemfile",
"rustls-pki-types",
"s3s",
@@ -7173,10 +7153,10 @@ dependencies = [
"shadow-rs",
"time",
"tokio",
"tokio-rustls 0.26.2",
"tokio-rustls",
"tokio-stream",
"tokio-util",
"tonic",
"tonic 0.13.0",
"tonic-build",
"tonic-reflection",
"tower 0.5.2",
@@ -7265,18 +7245,6 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "rustls"
version = "0.21.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
"log",
"ring",
"rustls-webpki 0.101.7",
"sct",
]
[[package]]
name = "rustls"
version = "0.23.25"
@@ -7288,7 +7256,7 @@ dependencies = [
"once_cell",
"ring",
"rustls-pki-types",
"rustls-webpki 0.103.1",
"rustls-webpki",
"subtle",
"zeroize",
]
@@ -7311,16 +7279,6 @@ dependencies = [
"web-time",
]
[[package]]
name = "rustls-webpki"
version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "rustls-webpki"
version = "0.103.1"
@@ -7418,16 +7376,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sct"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "security-framework"
version = "2.11.1"
@@ -8412,23 +8360,13 @@ dependencies = [
"syn 2.0.100",
]
[[package]]
name = "tokio-rustls"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
"rustls 0.21.12",
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b"
dependencies = [
"rustls 0.23.25",
"rustls",
"tokio",
]
@@ -8519,7 +8457,33 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52"
dependencies = [
"async-stream",
"async-trait",
"base64 0.22.1",
"bytes",
"flate2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-timeout",
"hyper-util",
"percent-encoding",
"pin-project",
"prost",
"tokio",
"tokio-stream",
"tower 0.4.13",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tonic"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85839f0b32fd242bb3209262371d07feda6d780d16ee9d2bc88581b89da1549b"
dependencies = [
"async-trait",
"axum",
"base64 0.22.1",
@@ -8535,12 +8499,10 @@ dependencies = [
"percent-encoding",
"pin-project",
"prost",
"rustls-pemfile",
"socket2",
"tokio",
"tokio-rustls 0.26.2",
"tokio-stream",
"tower 0.4.13",
"tower 0.5.2",
"tower-layer",
"tower-service",
"tracing",
@@ -8548,9 +8510,9 @@ dependencies = [
[[package]]
name = "tonic-build"
version = "0.12.3"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11"
checksum = "d85f0383fadd15609306383a90e85eaed44169f931a5d2be1b42c76ceff1825e"
dependencies = [
"prettyplease",
"proc-macro2",
@@ -8562,15 +8524,15 @@ dependencies = [
[[package]]
name = "tonic-reflection"
version = "0.12.3"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "878d81f52e7fcfd80026b7fdb6a9b578b3c3653ba987f87f0dce4b64043cba27"
checksum = "88fa815be858816dad226a49439ee90b7bcf81ab55bee72fdb217f1e6778c3ca"
dependencies = [
"prost",
"prost-types",
"tokio",
"tokio-stream",
"tonic",
"tonic 0.13.0",
]
[[package]]
@@ -8601,9 +8563,12 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
"futures-core",
"futures-util",
"indexmap 2.8.0",
"pin-project-lite",
"slab",
"sync_wrapper",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",

View File

@@ -111,9 +111,9 @@ time = { version = "0.3.41", features = [
"serde",
] }
tokio = { version = "1.44.2", features = ["fs", "rt-multi-thread"] }
tonic = { version = "0.12.3", features = ["gzip"] }
tonic-build = "0.12.3"
tonic-reflection = "0.12"
tonic = { version = "0.13.0", features = ["gzip"] }
tonic-build = "0.13.0"
tonic-reflection = "0.13.0"
tokio-rustls = { version = "0.26", default-features = false }
tokio-stream = "0.1.17"
tokio-util = { version = "0.7.13", features = ["io", "compat"] }
@@ -132,8 +132,8 @@ uuid = { version = "1.15.1", features = [
"fast-rng",
"macro-diagnostics",
] }
axum = "0.7.9"
axum-server = { version = "0.6", features = ["tls-rustls"] }
axum = "0.8.3"
axum-server = { version = "0.7.2", features = ["tls-rustls"] }
md-5 = "0.10.6"
workers = { path = "./common/workers" }
test-case = "3.3.1"

View File

@@ -11,5 +11,5 @@ async-trait.workspace = true
lazy_static.workspace = true
scopeguard = "1.2.0"
tokio.workspace = true
tonic.workspace = true
tonic = { workspace = true }
tracing-error.workspace = true

View File

@@ -13,7 +13,7 @@ flatbuffers = { workspace = true }
prost = { workspace = true }
protobuf = { workspace = true }
tokio = { workspace = true }
tonic = { workspace = true, features = ["transport", "tls"] }
tonic = { workspace = true, features = ["transport"] }
tower = { workspace = true }
[build-dependencies]

View File

@@ -8,7 +8,7 @@ use std::{
type AnyError = Box<dyn std::error::Error>;
const ENV_OUT_DIR: &str = "OUT_DIR";
const VERSION_PROTOBUF: Version = Version(27, 0, 0); // 27.0
const VERSION_PROTOBUF: Version = Version(30, 2, 0); // 30.2.0
const VERSION_FLATBUFFERS: Version = Version(24, 3, 25); // 24.3.25
/// Build protos if the major version of `flatc` or `protoc` is greater
/// or lesser than the expected version.

View File

@@ -1085,7 +1085,7 @@ pub mod node_service_client {
}
impl<T> NodeServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
@@ -1106,13 +1106,13 @@ pub mod node_service_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
NodeServiceClient::new(InterceptedService::new(inner, interceptor))
@@ -3607,7 +3607,7 @@ pub mod node_service_server {
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
@@ -7074,7 +7074,9 @@ pub mod node_service_server {
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(

View File

@@ -22,7 +22,7 @@ protos.workspace = true
rmp-serde.workspace = true
serde.workspace = true
serde_json.workspace = true
tonic = { version = "0.12.3", features = ["gzip"] }
tonic = { workspace = true }
tokio = { workspace = true }
tower.workspace = true
url.workspace = true

View File

@@ -60,7 +60,7 @@ tokio = { workspace = true, features = [
tokio-rustls.workspace = true
lazy_static.workspace = true
tokio-stream.workspace = true
tonic.workspace = true
tonic = { workspace = true }
tonic-reflection.workspace = true
tower.workspace = true
tracing-core = { workspace = true }
@@ -71,7 +71,7 @@ uuid = "1.15.1"
url.workspace = true
axum.workspace = true
axum-server = { workspace = true }
matchit = "0.8.6"
matchit = "0.8.4"
shadow-rs.workspace = true
const-str = { version = "0.6.1", features = ["std", "proc"] }
atoi = "2.0.0"