Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

chore: use new content and peer routing apis #181

Merged
merged 2 commits into from
Apr 24, 2020

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented Apr 11, 2020

In the context of deprecating peer-info as described on libp2p/js-libp2p#589, this PR removes the peer-info from being used, as well as returned in the API, in favour of returning { id, multiaddrs } in the same way as ipfs does. Moreover, it uses the new topologyinterface

BREAKING CHANGE: findProviders returns id and addrs properties instead of peer-info instance

This PR sits on top of #179 and #180, and those should be merged first and this PR rebased.

Needs:

@vasco-santos vasco-santos force-pushed the chore/use-new-content-and-peer-routing-apis branch 8 times, most recently from d38c19e to bea1087 Compare April 17, 2020 20:19
@vasco-santos vasco-santos force-pushed the chore/use-new-content-and-peer-routing-apis branch 2 times, most recently from 1566333 to d2eaeee Compare April 18, 2020 08:59
@vasco-santos vasco-santos force-pushed the chore/use-new-content-and-peer-routing-apis branch 3 times, most recently from 5100466 to 9e4e657 Compare April 21, 2020 12:26
@vasco-santos vasco-santos force-pushed the chore/use-new-content-and-peer-routing-apis branch from 9e4e657 to 185f9c5 Compare April 21, 2020 12:32
@vasco-santos vasco-santos marked this pull request as ready for review April 21, 2020 12:44
@vasco-santos vasco-santos requested a review from jacobheun April 21, 2020 12:44
Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found 1 thing, otherwise this looks good.

id: peer.id.id,
addrs: peer.multiaddrs.toArray().map((m) => m.buffer)
addrs: (peer.multiaddrs || []).map((m) => m && m.buffer),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning for the check on m (m && m.buffer)? If it's possible for m to be null or undefined we should do a reduce, otherwise we'll end up with undefined in the addrs array for that value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was me when trying to debug a bug to short circuit it. But it is not needed anymore 😆

@vasco-santos vasco-santos requested a review from jacobheun April 23, 2020 14:49
Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢

@vasco-santos vasco-santos merged commit 568c19c into master Apr 24, 2020
@vasco-santos vasco-santos deleted the chore/use-new-content-and-peer-routing-apis branch April 24, 2020 06:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants