Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

chore: update content and peer routing interfaces removing peer-info #43

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/content-routing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `findProviders(peerId)`
- `findProviders(cid)`


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[] }>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a PeerId?

Suggested change
`AsyncIterable<{ id: CID, addrs: Multiaddr[] }>`
`AsyncIterable<{ id: PeerId, addrs: Multiaddr[] }>`


### 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>`
15 changes: 10 additions & 5 deletions src/peer-routing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The 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[] }>`