Adding utility functions for Discovery interface
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 13d 21h
- Merged PRs (30d)
- 1
Description
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](https://github.com/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):
1) Restricting an implementations use by key (similar to the LimitedValueStore)
2) Utilizing multiple implementations together (similar to the Parallel router)
3) Caching/Backoff with various strategies (e.g. None, Fixed, Exponential)
4) 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.
Any thoughts @raulk @Stebalien
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading discovery/discovery.go and routing/routing.go, then compare the existing helpers in libp2p/go-libp2p-routing-helpers. Review the linked PubSub use case and decide which Discovery utility designs are in scope; the work is done when the agreed helpers, including their behavior and tests, support the selected composition, restriction, caching, or backoff use cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100