-
Notifications
You must be signed in to change notification settings - Fork 27
feat: peer-discovery not using peer-info #41
Conversation
BREAKING CHANGE: peer-discovery emits object with id and multiaddrs properties
We currently do not have meaningful tests for this interface yet. Should we try to leverage this change to do it? If we specify that the events should be emitted via a function cc @jacobheun |
Yes we should.
What are you trying to get out of this? It seems like it's doing some unnecessary restrictions. If we specify the API requirements and add tests that should be sufficient. |
I agree with not being nice to add unnecessary restrictions. However, we need to have a way of simulating the |
I think this should just be handled by the common setup requirements of the test. Such as, once The interface tests shouldn't trigger anything, just call methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few things. Also, I think we should merge this into a new minor branch since we'll need to update a few of the other interfaces for the peer-info change.
src/peer-discovery/README.md
Outdated
Everytime a peer is discovered by a discovery service, it emmits a `peer` event with the discovered peer's information, which must contain the following properties: | ||
|
||
- `<`[`PeerId`](https://github.com/libp2p/js-peer-id)`>` `peerInfo.id` | ||
- `<Array<`[`Multiaddr`](https://github.com/multiformats/js-multiaddr)`>>` `peerInfo.multiaddrs` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change peerInfo
to peerData
everywhere to avoid confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please 😂
}, | ||
async teardown () { | ||
clearInterval(intervalId) | ||
await new Promise(resolve => setTimeout(resolve, 10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't need to be here.
await new Promise(resolve => setTimeout(resolve, 10)) |
Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
fff9c14
to
360a056
Compare
What about an approach with a pre-release, so that we can start merging all the PRs related to |
These aren't mutually exclusive options. We can do pre releases / RCs from any branch. The main reason for the separate branch is to keep master open for any patches that might be needed before this is released. We can always cherry pick patches onto the latest tag and release that, but we'd also have to remember to pull those patches, as needed back into master. Putting everything into a new branch avoids the need to remember because we'll get the change when we go to merge into master. |
This also replaces #19 right? |
Yes, let's do it in a new branch then
Oh yes! Just closed it, completely forgot about that initial PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, updated the base branch to 0.3.x
In the context of deprecating
peer-info
as described on libp2p/js-libp2p#589, this PR changes thepeer-discovery
interface to emit an object containing anid
property and amultiaddrs
property.Future discovery services might gather other data, such as known protocols. However, we should specify those optional parameters when the time comes.
BREAKING CHANGE: peer-discovery emits object with id and multiaddrs properties