-
Notifications
You must be signed in to change notification settings - Fork 962
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
swarm/src/behaviour: Consider removing NetworkBehaviourAction::TInEvent
#2374
Comments
Even if manageable to have a Do you know what was the initial motivation to have I looked quickly into the |
Initially, we had multiple type parameters. It has only been a recent effort to reduce those and "derive" them from associated types of other parameters (like in this case, from the |
Corresponding pull requests: #2182 #2183
If I recall correctly, the goal was to not clone the gossip messages for each peer the message would be send to. @AgeManning @divagant-martian would know more. |
Yes, this was an optimization that was suggested here: #898 (comment) If its standing in the way of this, I think we can probably find another way in doing this. The messages can be quite large and send to quite a number of peers, so it would be nice to avoid cloning these. |
Something along the lines of 1123952 could be used, i.e. a custom |
Github refuses to open the link to the comment since it's resolved. This one worked better for me (takes a couple of secs to load) |
Today
NetworkBehaviourAction
has a trait parameterTInEvent
that defaults toTHandlerInEvent<THandler>
.rust-libp2p/swarm/src/behaviour.rs
Lines 356 to 359 in b316c6d
TInEvent
is needed to construct aNetworkBehaviourAction
that contains anInEvent
not matching the corresponding handler. If I am not mistaken this is only needed inlibp2p-gossipsub
for an optimization of wrapping messages to be gossiped in anArc
.rust-libp2p/protocols/gossipsub/src/behaviour.rs
Lines 200 to 201 in b316c6d
I think it is worth exploring an alternative for
libp2p-gossipsub
and thus being able to removeTInEvent
onNetworkBehaviourAction
. In my eyes, removing the trait parameter simplifies things a lot.Proof of concept
The text was updated successfully, but these errors were encountered: