grpc / grpc/grpc-rust

Support plugable Timer implementation

Open
#2,040 0 comments 0 reactions 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

Tonic's builtin transport rely on tokio runtime, but with some simple tweaking, I managed to make it work with another runtime, by providing a customized `hyper::rt::Executor` and Connector(`tower_service::Service`), ... except for the timer, which is [buried deeply in the channel implementation](https://github.com/hyperium/tonic/blob/v0.12.3/tonic/src/transport/channel/service/connection.rs#L39).

### Proposal

Because the callsite accepts a `hyper::rt::Timer` naturally, I wonder if there's any chance to expose it somehow via an interface, to allow the users set it to implementations other than tokio.

### P.S.

I split the feature `channel` into `channel` and `channel-full`, and feature guarded some of the code related to tokio. So when only `channel` is enabled, it's possible to use most of the builtin channel without rely on tokio(#152). Please let me know if this is something you wanted, then I can start a PR.
```
channel = [
"dep:hyper", "hyper?/client",
"dep:hyper-util", "hyper-util?/client",
"dep:tower", "tower?/buffer", "tower?/discover", "tower?/util",
"dep:tokio",
]
channel-full = [
"channel",
"hyper-util?/client-legacy", "hyper-util?/tokio",
"tower?/balance", "tower?/limit",
"tokio?/time",
"dep:hyper-timeout",
]
```

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.