google / tarpc

An RPC framework for Rust with a focus on ease of use.
MIT License
3.18k stars 194 forks source link

Add abitiy to store request context #393

Open axos88 opened 1 year ago

axos88 commented 1 year ago

Resolves #392

If a transport is created that sinks/streams (C, Item/SinkItem), and that is used to create the BaseChannel, the transport will be able to generate a value (c:C) in the stream that will be opaquely forwarded to the Sink.

This can be used for example to differentiate in exaclty how a request arrived at the transport, for example if the transport's channel is aggregating multiple clients. It will be used mainly for MQTT, where the response topic is received together with the Request, and the Sink needs to be know where to publish the response.

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

axos88 commented 1 year ago

This is based on your branch containing the async trait features.

axos88 commented 1 year ago

Signed the CLA.

axos88 commented 1 year ago

This currently breaks existing code. need to revise.

tikue commented 1 year ago

Thanks for the PR! For now, I will continue the discussion on #392 and will wait to review this until I better understand the solution space.