Streaming support.#146
Conversation
a728401 to
bda9829
Compare
|
@wllenyj Awesome! Thanks a ton for introducing this so important feature. @jodh-intel @mxpv @lifupan @liubin Please take a look at this. |
|
@dmcgowan Any time to help with this? Thanks a lot. |
|
@wllenyj thanks! I'll take a look |
84081f0 to
d216133
Compare
| &self, | ||
| req: Request, | ||
| streaming_client: bool, | ||
| streaming_server: bool, |
There was a problem hiding this comment.
I think streaming_client: bool and streaming_server: bool are a bit confusing, it's more clear to define them as sendable: bool and receivable: bool, while in this case only 3 conditions sender stream, receiver stream, and duplex stream, maybe an enum is better.
There was a problem hiding this comment.
Try to keep this commit consistent with the golang version. Optimization will be done later.
Codecov Report
@@ Coverage Diff @@
## master #146 +/- ##
===========================================
+ Coverage 11.68% 26.02% +14.34%
===========================================
Files 13 16 +3
Lines 1549 2413 +864
===========================================
+ Hits 181 628 +447
- Misses 1368 1785 +417
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Move the MessageHeader from `common.rs` to the `proto.rs` file. Move the `compiled::ttrpc` from `common.rs` to `proto.rs` file and re-export. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
Introduce Codec trait for protobuf message encoding/decoding. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
Added more unit test for proto.rs. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
It is used for server-side graceful shutdown. Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
The first block uses the standard library. The second block uses the third party crates, and the third block uses this crate. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
Using shutdown can be used instead of channel composition. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
Make message encoding/decoding uniform. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
For abstract connections, our connections are handled as one sending task and one receiving task. We can use the same logic to handle it. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
The client and server handle connections almost identically. Both use a sender side and a receiver side to handle the connection. Their respective differences are implemented using the delegate. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
Added protocol support for streaming. Added `StreamInner` struct for streaming operations and Streaming related errors. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
Added streaming support for client-side. Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
Added streaming support for server-side. Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
Added streaming support for generator. Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
This example is the same as the golang version. See `https://github.com/containerd/ttrpc/tree/main/integration/streaming` for details. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
This is required by unicode-ident crate. For details: ``` error[L001]: failed to satisfy license requirements ┌─ unicode-ident 1.0.3 (registry+https://github.com/rust-lang/crates.io-index):4:13 │ 4 │ license = "(MIT OR Apache-2.0) AND Unicode-DFS-2016" │ -^^^----^^^^^^^^^^------^^^^^^^^^^^^^^^^ │ ││ │ │ │ ││ │ rejected: not explicitly allowed │ ││ accepted: license is explicitly allowed │ │accepted: license is explicitly allowed │ license expression retrieved via Cargo.toml `license` │ = unicode-ident v1.0.3 ├── proc-macro2 v1.0.43 │ ├── async-trait v0.1.57 │ │ └── ttrpc v0.6.1 │ ├── futures-macro v0.3.21 │ │ └── futures-util v0.3.21 │ │ ├── futures v0.3.21 │ │ │ ├── tokio-vsock v0.3.2 │ │ │ │ └── ttrpc v0.6.1 (*) │ │ │ └── ttrpc v0.6.1 (*) │ │ └── futures-executor v0.3.21 │ │ └── futures v0.3.21 (*) │ ├── quote v1.0.21 │ │ ├── async-trait v0.1.57 (*) │ │ ├── futures-macro v0.3.21 (*) │ │ ├── syn v1.0.99 │ │ │ ├── async-trait v0.1.57 (*) │ │ │ ├── futures-macro v0.3.21 (*) │ │ │ ├── thiserror-impl v1.0.32 │ │ │ │ └── thiserror v1.0.32 │ │ │ │ └── ttrpc v0.6.1 (*) │ │ │ └── tokio-macros v1.8.0 │ │ │ └── tokio v1.20.1 │ │ │ ├── tokio-vsock v0.3.2 (*) │ │ │ └── ttrpc v0.6.1 (*) │ │ ├── thiserror-impl v1.0.32 (*) │ │ └── tokio-macros v1.8.0 (*) │ ├── syn v1.0.99 (*) │ ├── thiserror-impl v1.0.32 (*) │ └── tokio-macros v1.8.0 (*) └── syn v1.0.99 (*) ``` Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
quanweiZhou
left a comment
There was a problem hiding this comment.
Thanks @wllenyj, LGTM.
Bump the major version due to pr containerd#146. Signed-off-by: Tim Zhang <tim@hyper.sh>
Bump the major version of compiler to 0.6.0 due to containerd#146. Signed-off-by: Tim Zhang <tim@hyper.sh>
Bump the major version of ttrpc-compiler to 0.6.0 due to containerd#146. Signed-off-by: Tim Zhang <tim@hyper.sh>
Bump the major version of ttrpc-compiler to 0.6.0 due to containerd#146. Signed-off-by: Tim Zhang <tim@hyper.sh>
Streaming support.
Bump the major version due to pr containerd#146. Signed-off-by: Tim Zhang <tim@hyper.sh>
Bump the major version of ttrpc-compiler to 0.6.0 due to containerd#146. Signed-off-by: Tim Zhang <tim@hyper.sh>
Introduce support for streaming(https://github.com/containerd/ttrpc/blob/main/PROTOCOL.md#streaming). This is already supported by Golang's TTRPC in containerd/ttrpc#107. But currently only async is implemented. Related issues #144.
This pull request changes include:
shutdownmodule to handle graceful shutdown.Usually, streaming supports 3 types:
These 3 types are the same as GRPC, see https://grpc.io/docs/what-is-grpc/core-concepts/#server-streaming-rpc for details.
A general
Bidirectional streamingprocess is as follows:The
Connectionis an abstraction of a connection. One connection is handled as oneWriteasync-task and oneReadasync-task.Writetask receives the message from the channel and writes it to the connection.Readtask receives the message from the connection and writes it to the channel.