Skip to content

Commit 7153289

Browse files
authoredNov 7, 2022
fix(reflection, health): Remove transport feature (#1112)
1 parent f82488c commit 7153289

File tree

7 files changed

+17
-22
lines changed

7 files changed

+17
-22
lines changed
 

‎.github/workflows/CI.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install Protoc
3030
uses: arduino/setup-protoc@v1
3131
with:
32-
repo-token: ${{ secrets.GITHUB_TOKEN }}
32+
repo-token: ${{ secrets.GITHUB_TOKEN }}
3333
- uses: Swatinem/rust-cache@v1
3434
- name: Check fmt
3535
run: cargo fmt -- --check
@@ -66,7 +66,7 @@ jobs:
6666
- name: Install Protoc
6767
uses: arduino/setup-protoc@v1
6868
with:
69-
repo-token: ${{ secrets.GITHUB_TOKEN }}
69+
repo-token: ${{ secrets.GITHUB_TOKEN }}
7070
- uses: Swatinem/rust-cache@v1
7171
- uses: actions/checkout@master
7272
- name: Run tests
@@ -93,7 +93,7 @@ jobs:
9393
- name: Install Protoc
9494
uses: arduino/setup-protoc@v1
9595
with:
96-
repo-token: ${{ secrets.GITHUB_TOKEN }}
96+
repo-token: ${{ secrets.GITHUB_TOKEN }}
9797
- uses: Swatinem/rust-cache@v1
9898
- name: Run interop tests
9999
run: ./interop/test.sh

‎tonic-health/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ version = "0.7.1"
1616

1717
[features]
1818
default = ["transport"]
19-
transport = ["tonic/transport"]
19+
transport = []
2020

2121
[dependencies]
2222
async-stream = "0.3"
2323
bytes = "1.0"
2424
prost = "0.11"
2525
tokio = {version = "1.0", features = ["sync"]}
2626
tokio-stream = "0.1"
27-
tonic = {version = "0.8", path = "../tonic", features = ["codegen", "prost"]}
27+
tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
2828

2929
[dev-dependencies]
3030
tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]}
31-
tonic-build = {version = "0.8", path = "../tonic-build", features = ["prost"]}
31+
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] }

‎tonic-health/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ Please follow the example in the [main repo](https://github.com/hyperium/tonic/t
77
## Features
88

99
- transport: Provides the ability to set the service by using the type system and the
10-
`NamedService` trait.
10+
`NamedService` trait. You can use it like that:
11+
```rust
12+
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
13+
let client = HealthClient::new(conn);
14+
```

‎tonic-health/src/generated/grpc.health.v1.rs

-11
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ pub mod health_client {
5353
pub struct HealthClient<T> {
5454
inner: tonic::client::Grpc<T>,
5555
}
56-
impl HealthClient<tonic::transport::Channel> {
57-
/// Attempt to create a new client by connecting to a given endpoint.
58-
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
59-
where
60-
D: std::convert::TryInto<tonic::transport::Endpoint>,
61-
D::Error: Into<StdError>,
62-
{
63-
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
64-
Ok(Self::new(conn))
65-
}
66-
}
6756
impl<T> HealthClient<T>
6857
where
6958
T: tonic::client::GrpcService<tonic::body::BoxBody>,

‎tonic-health/src/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::sync::Arc;
99
use tokio::sync::{watch, RwLock};
1010
use tokio_stream::Stream;
1111
#[cfg(feature = "transport")]
12-
use tonic::transport::NamedService;
12+
use tonic::server::NamedService;
1313
use tonic::{Request, Response, Status};
1414

1515
/// Creates a `HealthReporter` and a linked `HealthServer` pair. Together,

‎tonic-health/tests/bootstrap.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fn bootstrap() {
1212
tonic_build::configure()
1313
.build_client(true)
1414
.build_server(true)
15+
.build_transport(false)
1516
.out_dir(format!("{}", out_dir.display()))
1617
.compile(iface_files, dirs)
1718
.unwrap();

‎tonic-reflection/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ version = "0.5.0"
2121
bytes = "1.0"
2222
prost = "0.11"
2323
prost-types = "0.11"
24-
tokio = {version = "1.0", features = ["sync"]}
24+
tokio = {version = "1.0", features = ["sync", "rt"]}
2525
tokio-stream = {version = "0.1", features = ["net"]}
26-
tonic = {version = "0.8", path = "../tonic", features = ["codegen", "prost"]}
26+
tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
2727

2828
[build-dependencies]
29-
tonic-build = {version = "0.8", path = "../tonic-build", features = ["transport", "prost"]}
29+
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] }
3030

3131
[dev-dependencies]
32+
tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["transport"] }
3233
futures = "0.3"
3334
futures-util = "0.3"

0 commit comments

Comments
 (0)
Please sign in to comment.