This repository was archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
chore: update content and peer routing interfaces removing peer-info #43
Merged
vasco-santos
merged 3 commits into
v0.3.x
from
chore/update-content-and-peer-routing-interfaces-removing-peer-info
Apr 17, 2020
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -30,6 +30,32 @@ TBD | |||||
|
||||||
A valid (read: that follows this abstraction) Content Routing module must implement the following API. | ||||||
|
||||||
### `.findProviders` | ||||||
### findProviders | ||||||
|
||||||
### `.provide` | ||||||
- `findProviders(peerId)` | ||||||
|
||||||
Find peers in the network that can provide a specific value, given a key. | ||||||
|
||||||
**Parameters** | ||||||
- [CID](https://github.com/multiformats/js-cid) | ||||||
|
||||||
**Returns** | ||||||
|
||||||
It returns an `AsyncIterable` containing the identification and addresses of the peers providing the given key, as follows: | ||||||
|
||||||
`AsyncIterable<{ id: CID, addrs: Multiaddr[] }>` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be a PeerId?
Suggested change
|
||||||
|
||||||
### provide | ||||||
|
||||||
- `provide(cid)` | ||||||
|
||||||
Announce to the network that we are providing the given value. | ||||||
|
||||||
**Parameters** | ||||||
- [CID](https://github.com/multiformats/js-cid) | ||||||
|
||||||
**Returns** | ||||||
|
||||||
It returns a promise that is resolved on the success of the operation. | ||||||
|
||||||
`Promise<void>` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,12 +30,17 @@ TBD | |
|
||
A valid (read: that follows this abstraction) Peer Routing module must implement the following API. | ||
|
||
### `.findPeers` - Find peers 'responsible' or 'closest' to a given key | ||
### findPeer | ||
|
||
- `Node.js` peerRouting.findPeers(key, function (err, peersPriorityQueue) {}) | ||
- `findPeer(peerId)` | ||
|
||
In a peer to peer context, the concept of 'responsability' or 'closeness' for a given key translates to having a way to find deterministically or that at least there is a significant overlap between searches, the same group of peers when searching for the same given key. | ||
Query the network for all multiaddresses associated with a `PeerId`. | ||
|
||
This method will query the network (route it) and return a Priority Queue datastructe with a list of PeerInfo objects, ordered by 'closeness'. | ||
**Parameters** | ||
- [peerId](https://github.com/libp2p/js-peer-id). | ||
|
||
key is a multihash | ||
**Returns** | ||
|
||
It returns a the `peer-id` [cid](https://github.com/multiformats/js-cid) together with the known peers [multiaddrs](https://github.com/multiformats/js-multiaddr), as follows: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is confusing. Is it a PeerId or CID? Shouldn't it be a PeerId? |
||
|
||
`Promise<{ id: CID, addrs: Multiaddr[] }>` | ||
vasco-santos marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.