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

Commit dafafd6

Browse files
authored
chore: update content and peer routing interfaces removing peer-info (#43)
* chore: update content and peer routing interfaces removing peer-info BREAKING CHANGE: content-routing and peer-routing APIs return an object with relevant properties instead of peer-info
1 parent d64a7bf commit dafafd6

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

src/content-routing/README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@ TBD
3030

3131
A valid (read: that follows this abstraction) Content Routing module must implement the following API.
3232

33-
### `.findProviders`
33+
### findProviders
3434

35-
### `.provide`
35+
- `findProviders(cid)`
36+
37+
Find peers in the network that can provide a specific value, given a key.
38+
39+
**Parameters**
40+
- [CID](https://github.com/multiformats/js-cid)
41+
42+
**Returns**
43+
44+
It returns an `AsyncIterable` containing the identification and addresses of the peers providing the given key, as follows:
45+
46+
`AsyncIterable<{ id: PeerId, addrs: Multiaddr[] }>`
47+
48+
### provide
49+
50+
- `provide(cid)`
51+
52+
Announce to the network that we are providing the given value.
53+
54+
**Parameters**
55+
- [CID](https://github.com/multiformats/js-cid)
56+
57+
**Returns**
58+
59+
It returns a promise that is resolved on the success of the operation.
60+
61+
`Promise<void>`

src/peer-routing/README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ TBD
3030

3131
A valid (read: that follows this abstraction) Peer Routing module must implement the following API.
3232

33-
### `.findPeers` - Find peers 'responsible' or 'closest' to a given key
33+
### findPeer
3434

35-
- `Node.js` peerRouting.findPeers(key, function (err, peersPriorityQueue) {})
35+
- `findPeer(peerId)`
3636

37-
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.
37+
Query the network for all multiaddresses associated with a `PeerId`.
3838

39-
This method will query the network (route it) and return a Priority Queue datastructe with a list of PeerInfo objects, ordered by 'closeness'.
39+
**Parameters**
40+
- [peerId](https://github.com/libp2p/js-peer-id).
4041

41-
key is a multihash
42+
**Returns**
43+
44+
It returns the [peerId](https://github.com/libp2p/js-peer-id) together with the known peers [multiaddrs](https://github.com/multiformats/js-multiaddr), as follows:
45+
46+
`Promise<{ id: PeerId, addrs: Multiaddr[] }>`

0 commit comments

Comments
 (0)