Skip to content

Commit

Permalink
fix(reflection, health): Remove transport feature (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
BratSinot authored Nov 7, 2022
1 parent f82488c commit 7153289
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1
- name: Check fmt
run: cargo fmt -- --check
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1
- uses: actions/checkout@master
- name: Run tests
Expand All @@ -93,7 +93,7 @@ jobs:
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1
- name: Run interop tests
run: ./interop/test.sh
Expand Down
6 changes: 3 additions & 3 deletions tonic-health/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ version = "0.7.1"

[features]
default = ["transport"]
transport = ["tonic/transport"]
transport = []

[dependencies]
async-stream = "0.3"
bytes = "1.0"
prost = "0.11"
tokio = {version = "1.0", features = ["sync"]}
tokio-stream = "0.1"
tonic = {version = "0.8", path = "../tonic", features = ["codegen", "prost"]}
tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["codegen", "prost"] }

[dev-dependencies]
tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]}
tonic-build = {version = "0.8", path = "../tonic-build", features = ["prost"]}
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] }
6 changes: 5 additions & 1 deletion tonic-health/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ Please follow the example in the [main repo](https://github.com/hyperium/tonic/t
## Features

- transport: Provides the ability to set the service by using the type system and the
`NamedService` trait.
`NamedService` trait. You can use it like that:
```rust
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
let client = HealthClient::new(conn);
```
11 changes: 0 additions & 11 deletions tonic-health/src/generated/grpc.health.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ pub mod health_client {
pub struct HealthClient<T> {
inner: tonic::client::Grpc<T>,
}
impl HealthClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> HealthClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
Expand Down
2 changes: 1 addition & 1 deletion tonic-health/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;
use tokio::sync::{watch, RwLock};
use tokio_stream::Stream;
#[cfg(feature = "transport")]
use tonic::transport::NamedService;
use tonic::server::NamedService;
use tonic::{Request, Response, Status};

/// Creates a `HealthReporter` and a linked `HealthServer` pair. Together,
Expand Down
1 change: 1 addition & 0 deletions tonic-health/tests/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn bootstrap() {
tonic_build::configure()
.build_client(true)
.build_server(true)
.build_transport(false)
.out_dir(format!("{}", out_dir.display()))
.compile(iface_files, dirs)
.unwrap();
Expand Down
7 changes: 4 additions & 3 deletions tonic-reflection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ version = "0.5.0"
bytes = "1.0"
prost = "0.11"
prost-types = "0.11"
tokio = {version = "1.0", features = ["sync"]}
tokio = {version = "1.0", features = ["sync", "rt"]}
tokio-stream = {version = "0.1", features = ["net"]}
tonic = {version = "0.8", path = "../tonic", features = ["codegen", "prost"]}
tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["codegen", "prost"] }

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

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

0 comments on commit 7153289

Please sign in to comment.