peerstore: add new `GetPeersForProtocol` method to `Protobook`
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 13d 21h
- Merged PRs (30d)
- 1
Description
The proposal is to add a new `GetPeersForProtocol` method to `Protobook` interface and implementations.
Currently, the protobook only maps from peers to protocols, and not the other way around. It's possible to simply iterate over all peers and filter them out by calling `SupportsProtocols`, but this could potentially become inefficient if we need to do this frequently and we have a large number of peers in the peerstore.
Alternatively, it is possible to listen for events (e.g `EvtPeerProtocolsUpdated`) and build the reverse mapping ourselves, but this is not 100% accurate as for example atm there is no event for when a protocol is removed. In fact, currently the `Protobook` data never gets purged at all, which is another issue entirely.
cc: @vyzo @Stebalien @marten-seemann
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 locating the Protobook interface and its implementations, then read the existing SupportsProtocols behavior and EvtPeerProtocolsUpdated handling. Done means the proposed GetPeersForProtocol operation is defined consistently across the interface and implementations, with behavior checked against the existing peer-to-protocol mapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100