-
Notifications
You must be signed in to change notification settings - Fork 15
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
Transport Client Multiplexer #417
base: master
Are you sure you want to change the base?
Transport Client Multiplexer #417
Conversation
8a5ac6c
to
abbd499
Compare
Adding to TransportClientMultiplexer as multiplexing wrapper that can spawn specialized MuxStreamClient subtype of TransportLayerClient.
abbd499
to
abf57aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks solid, @robertbartel. Unless I am missing something, it seems that the request service and likely all other services will need to be modified to accommodate handling stream ordering if we want to use a TransportClientMultiplexer
to communicate with them, right? If that is the case, we should probably throw an exception when trying to create a TransportClientMultiplexer
until those changes have been introduced. Thoughts?
if len(mux_id) != self._len_mux_id: | ||
msg = f"{self.__class__.__name__} can't send using mux id {mux_id} (expected length {self._len_mux_id!s})" | ||
raise ValueError(msg) | ||
await self._wrapped_client.async_send(f"{mux_id}{data}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we will need to make changes to the request service's deserialization and serialization behavior to accommodate this change, right? One fear that I have is that this custom serialization format will spread across the entire codebase. For example, if you wanted to use this client and communicate with a particular service directly, that service would have to implement the custom deserialization format and handle stream ordering too.
You are correct, @aaraney. I got a little too focused on the looking glass and forgot about what was on the other side of it. For now, I think we leave this as Draft/Blocked. This is going to need a proper server-side solution to go along with it. I'm not exactly sure what form that will need to take yet, and it may inform changes to what I initially had here. |
Okay, cool! Yeah, im not sure either. Ill spend some time thinking about what that might look like too and maybe we can come together and compare our thoughts. |
Adding
TransportClientMultiplexer
type to wrap aTransportLayerClient
instance in order to share the latter's connection, along with specializedMuxStreamClient
concrete type that implementsTransportLayerClient
and is spawned from the wrapper to share the wrapped client.This addresses the problem of users of a
TransportLayerClient
instance relying upon ordering of incoming messages in a way that is not guaranteed when there are multiple users.This PR relies on changes in #409 and should remain in draft status until that has been merged.