-
Notifications
You must be signed in to change notification settings - Fork 964
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
Embed the topology directly in the NetworkBehaviour #854
Comments
Note that this is probably not the brightest idea. Right now you can't have multiple handlers of the same protocol simultaneously, otherwise only the first handler will receive all the substreams. I don't think it is a good idea in general for rust-libp2p to try support multiple separate networks. The protocols handlers managed by network behaviours automatically apply to all connections, but in practice can be either used or unused. |
More precise potential changes:
For Substrate (which is our real-world test-case for changes in libp2p): assuming that the way Substrate is similar to gossipsub, the After this change, the user would have to perform more actions manually. However we ideally also would like to provide some combinations of behaviours in On a more theoretical level:
|
cc #785
Right now libp2p assumes one single network, and therefore one single topology.
In practice, though, we probably want to support multiple overlay networks, potentially on top of one another.
In these situations, having one single
Topology
plugged into theSwarm
is not necessarily an ideal solution.Instead I suggest that:
NetworkBehaviour
hold a topology (example:KademliaDiscovery
,Brahms
,Mdns
).NetworkBehaviour
. Multiple behaviours can be plugged together by joining the results.Floodsub
would get passed a list of destinations every time we send a message (cc Should the nodes floodsub sends messages to be better defined? #713).For example, a user can:
HashMap<NetworkId, KademliaDiscovery>
, where eachKademliaDiscovery
holds a partial random view of its network.KademliaDiscovery
generates events that indicate when this view is updated.Gossipsub
(for example) in aHashMap<NetworkId, Gossipsub>
.Gossipsub
handles building an overlay network of top of the view of theKademliaDiscovery
.The drawback is that the user now has to do things a bit more manually. For example when
identify
generates events containing the listening addresses of a node we're connected to, the user has to transmit this information to theKademliaDiscovery
.This solution would work around #785 by removing the problem altogether.
The text was updated successfully, but these errors were encountered: