-
Notifications
You must be signed in to change notification settings - Fork 58
feat: allow caller to initialize the channel #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: allow caller to initialize the channel #93
Conversation
Why not just add the |
That would also work, however, the I could also make the |
Make the |
831325f
to
c45233e
Compare
@davidli2010 Done. I created a new feature gate named |
64ce678
to
728418a
Compare
Actually, after some more thoughts, I believe that what will make the most sense, if a caller needs to customize the channel more deeply, would be for the caller to be able to supply their own |
I had a chance to hack on this a bit more, and a prototype is in #98. This way, generics don't proliferate across the codebase -- the different supported types of Let me know what you think! The added flexibility in my change will help out quite significantly when using this crate in environments with dynamic infrastructure. |
728418a
to
1439f33
Compare
28a3caf
to
d085bfa
Compare
06bf92f
to
6f2c635
Compare
8a75bd9
to
a8f6785
Compare
In some scenarios, such as when using a Deterministic Simulation Testing environment such as `turmoil`, when mocking the behaviour of etcd itself, or using non-Tokio sockets for connecting to etcd, it is desirable to construct a Tonic channel externally, then "wrap" it in a `Client` object. This patch enables this use case by adding a `raw-channel` Cargo feature, which enables the `Client::from_channel` function.
a8f6785
to
0d9fc83
Compare
@davidli2010 Thanks to merging #98, this patch is now ready! Thank you for your reviews. |
In some scenarios, such as when using a Deterministic Simulation Testing environment such as
turmoil
, when mocking the behaviour of etcd itself, or using non-Tokio sockets for connecting to etcd, it is desirable to construct a Tonic channel externally, then "wrap" it in aClient
object. This patch enables this use case by creating aRawClient
type, which is constructed from an existing Tonic channel.In order to ensure maximum code re-use, the existing
Client
is updated to use theRawClient
type internally.