Skip to content

Commit

Permalink
Merge branch 'master' into rename-interceptor-call-method-to-intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
tobz authored Oct 22, 2024
2 parents 6b3880c + 3009cf5 commit 750bcce
Show file tree
Hide file tree
Showing 50 changed files with 203 additions and 194 deletions.
4 changes: 2 additions & 2 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ tonic-types = { path = "../tonic-types", optional = true }
async-stream = { version = "0.3", optional = true }
tokio-stream = { version = "0.1", optional = true }
tokio-util = { version = "0.7.8", optional = true }
tower = { version = "0.4", optional = true }
tower = { version = "0.5", optional = true }
rand = { version = "0.8", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
Expand All @@ -318,7 +318,7 @@ h2 = { version = "0.4", optional = true }
tokio-rustls = { version = "0.26", optional = true, features = ["ring", "tls12"], default-features = false }
hyper-rustls = { version = "0.27.0", features = ["http2", "ring", "tls12"], optional = true, default-features = false }
rustls-pemfile = { version = "2.0.0", optional = true }
tower-http = { version = "0.5", optional = true }
tower-http = { version = "0.6", optional = true }
pin-project = { version = "1.0.11", optional = true }

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions examples/helloworld-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ name = "helloworld-client"
path = "src/client.rs"

[dependencies]
tonic = "0.12"
tonic = "0.13"
prost = "0.13"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }

[build-dependencies]
tonic-build = "0.12"
tonic-build = "0.13"
```

We include `tonic-build` as a useful way to incorporate the generation of our client and server gRPC code into the build process of our application. We will setup this build process now:
Expand Down
4 changes: 2 additions & 2 deletions examples/routeguide-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Edit `Cargo.toml` and add all the dependencies we'll need for this example:

```toml
[dependencies]
tonic = "0.12"
tonic = "0.13"
prost = "0.13"
tokio = { version = "1.0", features = ["rt-multi-thread", "macros", "sync", "time"] }
tokio-stream = "0.1"
Expand All @@ -185,7 +185,7 @@ serde_json = "1.0"
rand = "0.8"

[build-dependencies]
tonic-build = "0.12"
tonic-build = "0.13"
```

Create a `build.rs` file at the root of your crate:
Expand Down
2 changes: 1 addition & 1 deletion examples/src/tower/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let channel = ServiceBuilder::new()
// Interceptors can be also be applied as middleware
.layer(tonic::service::interceptor(intercept))
.layer(tonic::service::InterceptorLayer::new(intercept))
.layer_fn(AuthSvc::new)
.service(channel);

Expand Down
2 changes: 1 addition & 1 deletion examples/src/tower/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Apply our own middleware
.layer(MyMiddlewareLayer::default())
// Interceptors can be also be applied as middleware
.layer(tonic::service::interceptor(intercept))
.layer(tonic::service::InterceptorLayer::new(intercept))
.into_inner();

Server::builder()
Expand Down
2 changes: 1 addition & 1 deletion interop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ prost = "0.13"
tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros"]}
tokio-stream = "0.1"
tonic = {path = "../tonic", features = ["tls"]}
tower = {version = "0.4"}
tower = "0.5"
tracing-subscriber = {version = "0.3"}

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions tests/compression/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ prost = "0.13"
tokio = {version = "1.0", features = ["macros", "rt-multi-thread", "net"]}
tokio-stream = "0.1"
tonic = {path = "../../tonic", features = ["gzip", "zstd"]}
tower = {version = "0.4", features = []}
tower-http = {version = "0.5", features = ["map-response-body", "map-request-body"]}
tower = "0.5"
tower-http = {version = "0.6", features = ["map-response-body", "map-request-body"]}

[build-dependencies]
tonic-build = {path = "../../tonic-build" }
4 changes: 2 additions & 2 deletions tests/integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ http = "1"
http-body = "1"
hyper-util = "0.1"
tokio-stream = {version = "0.1.5", features = ["net"]}
tower = {version = "0.4", features = []}
tower-http = { version = "0.5", features = ["set-header", "trace"] }
tower = "0.5"
tower-http = { version = "0.6", features = ["set-header", "trace"] }
tower-service = "0.3"
tracing = "0.1"

Expand Down
4 changes: 2 additions & 2 deletions tonic-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
description = """
Codegen module of `tonic` gRPC implementation.
"""
documentation = "https://docs.rs/tonic-build/0.12.3"
documentation = "https://docs.rs/tonic-build/0.13.0"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "codegen", "protobuf"]
license = "MIT"
name = "tonic-build"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.3"
version = "0.13.0"

[dependencies]
prettyplease = { version = "0.2" }
Expand Down
2 changes: 1 addition & 1 deletion tonic-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-build/0.12.3")]
#![doc(html_root_url = "https://docs.rs/tonic-build/0.13.0")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
Expand Down
8 changes: 4 additions & 4 deletions tonic-health/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
description = """
Health Checking module of `tonic` gRPC implementation.
"""
documentation = "https://docs.rs/tonic-health/0.12.3"
documentation = "https://docs.rs/tonic-health/0.13.0"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "healthcheck"]
license = "MIT"
name = "tonic-health"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.3"
version = "0.13.0"

[features]
default = ["transport"]
Expand All @@ -23,12 +23,12 @@ async-stream = "0.3"
prost = "0.13"
tokio = {version = "1.0", features = ["sync"]}
tokio-stream = "0.1"
tonic = { version = "0.12", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
tonic = { version = "0.13.0", path = "../tonic", default-features = false, features = ["codegen", "prost"] }

[dev-dependencies]
tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]}
tokio-stream = "0.1"
prost-types = "0.13"
prost-types = "0.13.0"

[package.metadata.cargo_check_external_types]
allowed_external_types = [
Expand Down
2 changes: 1 addition & 1 deletion tonic-health/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-health/0.12.3")]
#![doc(html_root_url = "https://docs.rs/tonic-health/0.13.0")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
Expand Down
8 changes: 4 additions & 4 deletions tonic-reflection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Server Reflection module of `tonic` gRPC implementation.
"""
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
documentation = "https://docs.rs/tonic-reflection/0.12.3"
documentation = "https://docs.rs/tonic-reflection/0.13.0"
keywords = ["rpc", "grpc", "async", "reflection"]
license = "MIT"
name = "tonic-reflection"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.3"
version = "0.13.0"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -30,10 +30,10 @@ prost = "0.13"
prost-types = {version = "0.13", optional = true}
tokio = { version = "1.0", features = ["sync", "rt"], optional = true }
tokio-stream = {version = "0.1", features = ["net"], optional = true }
tonic = { version = "0.12", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
tonic = { version = "0.13.0", path = "../tonic", default-features = false, features = ["codegen", "prost"] }

[dev-dependencies]
tonic = { version = "0.12", path = "../tonic", default-features = false, features = ["transport"] }
tonic = { version = "0.13.0", path = "../tonic", default-features = false, features = ["transport"] }

[package.metadata.cargo_check_external_types]
allowed_external_types = [
Expand Down
2 changes: 1 addition & 1 deletion tonic-reflection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.12.3")]
#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.13.0")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
Expand Down
6 changes: 3 additions & 3 deletions tonic-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ categories = ["web-programming", "network-programming", "asynchronous"]
description = """
A collection of useful protobuf types that can be used with `tonic`.
"""
documentation = "https://docs.rs/tonic-types/0.12.3"
documentation = "https://docs.rs/tonic-types/0.13.0"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "protobuf"]
license = "MIT"
name = "tonic-types"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.3"
version = "0.13.0"

[dependencies]
prost = "0.13"
prost-types = "0.13"
tonic = { version = "0.12", path = "../tonic", default-features = false }
tonic = { version = "0.13.0", path = "../tonic", default-features = false }

[package.metadata.cargo_check_external_types]
allowed_external_types = [
Expand Down
2 changes: 1 addition & 1 deletion tonic-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-types/0.12.3")]
#![doc(html_root_url = "https://docs.rs/tonic-types/0.13.0")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]

mod generated {
Expand Down
8 changes: 4 additions & 4 deletions tonic-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
description = """
grpc-web protocol translation for tonic services.
"""
documentation = "https://docs.rs/tonic-web/0.12.3"
documentation = "https://docs.rs/tonic-web/0.13.0"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "grpc-web"]
license = "MIT"
name = "tonic-web"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.3"
version = "0.13.0"

[dependencies]
base64 = "0.22"
Expand All @@ -22,10 +22,10 @@ http = "1"
http-body = "1"
http-body-util = "0.1"
pin-project = "1"
tonic = { version = "0.12", path = "../tonic", default-features = false }
tonic = { version = "0.13.0", path = "../tonic", default-features = false }
tower-service = "0.3"
tower-layer = "0.3"
tower-http = { version = "0.5", features = ["cors"] }
tower-http = { version = "0.6", features = ["cors"] }
tracing = "0.1"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion tonic-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
rust_2018_idioms,
unreachable_pub
)]
#![doc(html_root_url = "https://docs.rs/tonic-web/0.12.3")]
#![doc(html_root_url = "https://docs.rs/tonic-web/0.13.0")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]

pub use call::GrpcWebCall;
Expand Down
8 changes: 4 additions & 4 deletions tonic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ categories = ["web-programming", "network-programming", "asynchronous"]
description = """
A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.
"""
documentation = "https://docs.rs/tonic/0.12.3"
documentation = "https://docs.rs/tonic/0.13.0"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "futures", "protobuf"]
license = "MIT"
readme = "../README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.3"
version = "0.13.0"

[features]
codegen = ["dep:async-trait"]
Expand Down Expand Up @@ -84,7 +84,7 @@ hyper = {version = "1", features = ["http1", "http2"], optional = true}
hyper-util = { version = "0.1.4", features = ["tokio"], optional = true }
socket2 = { version = "0.5", optional = true, features = ["all"] }
tokio = {version = "1", default-features = false, optional = true}
tower = {version = "0.4.7", default-features = false, optional = true}
tower = {version = "0.5", default-features = false, optional = true}
axum = {version = "0.7", default-features = false, optional = true}

# rustls
Expand All @@ -107,7 +107,7 @@ quickcheck_macros = "1.0"
rand = "0.8"
static_assertions = "1.0"
tokio = {version = "1.0", features = ["rt", "macros"]}
tower = {version = "0.4.7", features = ["full"]}
tower = {version = "0.5", features = ["full"]}

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion tonic/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub type BoxBody = http_body_util::combinators::UnsyncBoxBody<bytes::Bytes, crat
pub fn boxed<B>(body: B) -> BoxBody
where
B: http_body::Body<Data = bytes::Bytes> + Send + 'static,
B::Error: Into<crate::Error>,
B::Error: Into<crate::BoxError>,
{
body.map_err(crate::Status::map_error).boxed_unsync()
}
Expand Down
10 changes: 5 additions & 5 deletions tonic/src/client/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl<T> Grpc<T> {
where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + Send + 'static,
<T::ResponseBody as Body>::Error: Into<crate::Error>,
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
M2: Send + Sync + 'static,
Expand All @@ -232,7 +232,7 @@ impl<T> Grpc<T> {
where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + Send + 'static,
<T::ResponseBody as Body>::Error: Into<crate::Error>,
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
S: Stream<Item = M1> + Send + 'static,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
Expand Down Expand Up @@ -269,7 +269,7 @@ impl<T> Grpc<T> {
where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + Send + 'static,
<T::ResponseBody as Body>::Error: Into<crate::Error>,
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
M2: Send + Sync + 'static,
Expand All @@ -288,7 +288,7 @@ impl<T> Grpc<T> {
where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + Send + 'static,
<T::ResponseBody as Body>::Error: Into<crate::Error>,
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
S: Stream<Item = M1> + Send + 'static,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
Expand Down Expand Up @@ -328,7 +328,7 @@ impl<T> Grpc<T> {
where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + Send + 'static,
<T::ResponseBody as Body>::Error: Into<crate::Error>,
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
{
let encoding = CompressionEncoding::from_encoding_header(
response.headers(),
Expand Down
6 changes: 3 additions & 3 deletions tonic/src/client/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait GrpcService<ReqBody> {
/// Responses body given by the service.
type ResponseBody: Body;
/// Errors produced by the service.
type Error: Into<crate::Error>;
type Error: Into<crate::BoxError>;
/// The future response value.
type Future: Future<Output = Result<http::Response<Self::ResponseBody>, Self::Error>>;

Expand All @@ -32,9 +32,9 @@ pub trait GrpcService<ReqBody> {
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
where
T: Service<http::Request<ReqBody>, Response = http::Response<ResBody>>,
T::Error: Into<crate::Error>,
T::Error: Into<crate::BoxError>,
ResBody: Body,
<ResBody as Body>::Error: Into<crate::Error>,
<ResBody as Body>::Error: Into<crate::BoxError>,
{
type ResponseBody = ResBody;
type Error = T::Error;
Expand Down
Loading

0 comments on commit 750bcce

Please sign in to comment.