capnproto / capnproto-rust

Cap'n Proto for Rust
MIT License
1.99k stars 220 forks source link

Add support for setPipeline() #379

Open edevil opened 1 year ago

edevil commented 1 year ago

Context: https://github.com/capnproto/capnproto/pull/1131

In the c++ capnproto lib this feature was added that allows, as @kentonv says:

This makes it possible, when an RPC forwards to another RPC, to start forward pipelined calls on the first to the second, before the first RPC actually completes.

Would it be possible to support this in capnproto-rust as well?

Thanks.

kentonv commented 1 year ago

For a real-world example where this matters, compare request() and startRequest() in http-over-capnp.capnp.

https://github.com/capnproto/capnproto/blob/master/c%2B%2B/src/capnp/compat/http-over-capnp.capnp#L47

The introduction of setPipeline() made it possible to simplify this interface (request() being the new, simpler version, where startRequest() was what we needed before). However, it's currently not possible to implement request() in Rust.

dwrensha commented 1 year ago

Yeah, this should be possible. I took some some small first steps here: https://github.com/capnproto/capnproto-rust/pull/380 Probably this will require a version bump, because we will need to change the signature of ClientHook.call() to additionally return a pipeline, and we will need to modify ResultsHook too.

ErikMcClure commented 3 weeks ago

We require this feature for our project. Unfortunately, #380 contains only stubs and minimal direction on what actually needs to happen to implement this feature. Would it be possible for @dwrensha to provide a more detailed explanation of everything that needs to change for this to be implemented correctly? I can then try my hand at providing a PR that implements this.