-
Notifications
You must be signed in to change notification settings - Fork 985
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Review of NetworkBehaviour #2006
Comments
The
Assuming the current design of This is just a rough outline of the direction that I would personally pursue. In fairness I need to mention though that as I'm switching employers, I'm wrapping up my work on |
really sad to hear you're leaving, you and mxinden are currently the main maintainers/contributors. will there be someone from parity taking over your role in libp2p or does parity consider libp2p "finished"? also curious who your new employer is, although maybe slightly off topic. the approach you suggest sounds good, but also fairly complicated and involved. Maybe we can merge #1995 anyway as a plaster until someone tackles it like you suggest. |
I honestly don't know what the plans are w.r.t. Parity and
I assume you meant #2007. I've given it a review. |
First off, I appreciate the detailed comments above, especially the many links to past discussions. Below are my thoughts on the matter. Status quoI agree that the status quo, and more particular the design around
Minimal interface suggestion
I am not sure I fully understand the suggestion above, thus please correct me if I am wrong with the small note below. I am currently conducting user interviews with various users of rust-libp2p. (As an aside, in case users are reading this and would like to share thoughts, suggestions ... on rust-libp2p as a whole in a call, send me a mail). One thing that came up multiple times is the lack of guidance rust-libp2p gives to users / implementors. Lack of guidance in the sense that while rust-libp2p is very versatile, at the same time it is hard to use given there being various possible solutions to a given problem. While not perfect, the design around |
We have a job offer up: https://www.parity.io/apply/?gh_jid=4347843003 |
Note that, to oversimplify a bit, Is anyone opposed if we move this to a github discussion, rather than keeping it as an issue? |
If I understand correctly the changes would be:
|
Perhaps, yes. I was thinking about something even more minimal though. These are completely unfinished thoughts but what I at one point drafted in pseudo-code was something like trait Protocol {
type Command;
fn notify(&mut self, e: &mut NetworkEvent<'_>) -> Result<Self::Command>;
fn execute(&mut self, n: &mut Network<...>, c: Self::Command) -> Result<???>;
fn poll(&mut self, ...) -> Poll<???>;
} where the methods would be called for each "registered" protocol in the order listed by some
Yes, certainly.
Like I said, I really didn't think this through and I have no doubt there are many obstacles ahead. Experimenting and thinking through all the details would be what it entails to explore this direction. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I actually kind of like the
NetworkBehaviour
in general. Some things that may help would be:inject_new_external_addr
needs ainject_expired_external_addr
whenSwarm::remove_external_address
is called.inject_new_listen_addr
andinject_expired_listen_addr
should pass aListenerId
.SwarmEvent
andNetworkBehaviour
inject methods seem to be two ways of doing the same thing (in many cases). Maybe deprecateSwarmEvent
and adding some missing methods toNetworkBehaviour
would be sensible?For writing tests (where I think
SwarmEvent
is probably most useful), aNetworkBehaviour
can be added that allows registering a channel to get something like aSwarmEvent
.Another idea would be remove swarm methods completely and make
NetworkBehaviourAction
more powerful instead.The text was updated successfully, but these errors were encountered: