You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Discovery interface is basically a generalized version of the Content Routing interface. The only differences are that Discovery handles strings instead of only CIDs and Discovery returns more information from its functions then Content Routing does.
Therefore, it would be very helpful to have a set of utilities for working with multiple implementations of the Discovery interface together, just as we have for Content Routing (in libp2p/go-libp2p-routing-helpers).
One driving use case is to be able to pass multiple Discovery options into PubSub after /libp2p/go-libp2p-pubsub#184 lands as well as create configurable backoff/caching layers for the Discovery implementations.
Some useful utilities to add (probably to go-libp2p-discovery):
Restricting an implementations use by key (similar to the LimitedValueStore)
Utilizing multiple implementations together (similar to the Parallel router)
Caching/Backoff with various strategies (e.g. None, Fixed, Exponential)
Might also be nice to add a Content Router that is derived from a Discovery service, instead of just having the other way around. (Note: in principle this combined with the existing Discovery from Content Routing implementation would allow us to use the routing-helpers instead of create new ones. However, because the Discovery service has more information available and is more generic there would be some information loss.)
Unfortunately, Go's lack of generics makes reusing the routing-helpers code directly pretty difficult and basically requires us to fall back to something similar to copy-paste-edit. However, if there's interest I can try and make the internals reusable for a future modification of the routing-helpers.
The Discovery interface is basically a generalized version of the Content Routing interface. The only differences are that Discovery handles strings instead of only CIDs and Discovery returns more information from its functions then Content Routing does.
Discovery: https://github.com/libp2p/go-libp2p-core/blob/f61804b905d3a0f75df0f03385e5ca5dbb801ad0/discovery/discovery.go
Content Routing: https://github.com/libp2p/go-libp2p-core/blob/f61804b905d3a0f75df0f03385e5ca5dbb801ad0/routing/routing.go
Therefore, it would be very helpful to have a set of utilities for working with multiple implementations of the Discovery interface together, just as we have for Content Routing (in libp2p/go-libp2p-routing-helpers).
One driving use case is to be able to pass multiple Discovery options into PubSub after /libp2p/go-libp2p-pubsub#184 lands as well as create configurable backoff/caching layers for the Discovery implementations.
Some useful utilities to add (probably to go-libp2p-discovery):
Unfortunately, Go's lack of generics makes reusing the routing-helpers code directly pretty difficult and basically requires us to fall back to something similar to copy-paste-edit. However, if there's interest I can try and make the internals reusable for a future modification of the routing-helpers.
Any thoughts @raulk @Stebalien
The text was updated successfully, but these errors were encountered: