-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat(socketio): Async adapter #395
base: feat-adapter-rework
Are you sure you want to change the base?
Conversation
e922c42
to
c93a125
Compare
c93a125
to
f177f7f
Compare
f177f7f
to
4ec5721
Compare
* Remove Sync bound on adapter error * Add an AdapterCtr trait to keep state
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.
clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
a66ed7c
to
54fb59a
Compare
54fb59a
to
c0ecf9c
Compare
This will allow adapter implementors to use the `LocalAdapter` as a parent.
This will allow to share errors between nodes. The parser error is also now a Boxed error in order to have multiple dyn possible implementations;
c427e34
to
dc0a4ff
Compare
dc0a4ff
to
67bcc99
Compare
6342381
to
a30d2df
Compare
a30d2df
to
db50c6d
Compare
|
||
#[inline(always)] | ||
fn into_room_iter(self) -> Self::IntoIter { | ||
self.into_iter().map(|i| Cow::Borrowed(*i)) |
Check warning
Code scanning / clippy
this .into_iter() call is equivalent to .iter() and will not consume the slice Warning
|
||
#[inline(always)] | ||
fn into_room_iter(self) -> Self::IntoIter { | ||
self.into_iter().map(|i| Cow::Borrowed(*i)) |
Check warning
Code scanning / clippy
this .into_iter() call is equivalent to .iter() and will not consume the slice Warning
Motivation
Transform the
Adapter
trait to returnimpl Future + Send
so that it is possible to implement adapters with other systems (redis, mongo, ...).Solution
Adapter
returnsimpl Future + Send
for all the methods that may need to communicate remotely (e.gemit
,emit_with_ack
on theBroadcastOperators
andSocketIo
structs).socketioxide_core
trait as well as someerror
types. So that new adapters only need to depends onsocketioxide_core
.Packet
andAckError
implementSerialize
in order to send them to remote nodes.ParserError
is now simply a wrapper around aBox<impl StdError>
so that it is easy to implserde
on it. Therefore theDecodeError
andEncodeError
GAT have been removed.State
GAT allow anyAdapter
implementors to share a common state between all adapters of a node. It can be useful to share a connection to a remote server (redis, mongo, ...).AckStream
GAT allow the adapter to merge a stream from the local node with a remote stream of acknowledgments.Remaining questions/issues:
To do:
BroadcastOperators
.