grpc / grpc/grpc-rust

Expose `DynamicStreamService`

Open
#1,231 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Feature Request

### Crates

`tonic`

### Motivation

In https://github.com/TrueLayer/ginepro/issues/39 we discovered that tonic's `Channel::balance_channel` only does random distribution.

We would like to experiment with enabling other `Load` implementations in the discovery in `tower::Balance`, but this requires us to re-implement `Connection`

### Proposal

Make a type that has a generic parameter of
```rust
D: Discover,
D::Error: Into
```

Such that it returns a stream of `Connection`. This would require `Connection` to be stabilised, but no methods to be exposed apart from `Service` and `Load`.

`DynamicServiceStream` is then just a type alias for this, taking a channel `Receiver` as the `Discover` impl (potentially with a `.map(Ok)` on the stream).

### Alternatives

Expose `Connection` as a fully stable type with stable methods to construct the connection from a hyper connection.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.