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
This commit is contained in:
Vasco Santos
2020-04-17 17:22:43 +02:00
committed by Jacob Heun
parent 5bcfc966f7
commit 87e2e89791
2 changed files with 38 additions and 7 deletions

View File

@ -30,6 +30,32 @@ TBD
A valid (read: that follows this abstraction) Content Routing module must implement the following API.
### `.findProviders`
### findProviders
### `.provide`
- `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: 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>`