mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
docs: update peer store api with metadata (#735)
This commit is contained in:
parent
4851680c4d
commit
0e3cc5866b
@ -1216,7 +1216,7 @@ Get the stored information of a given peer, namely its [`PeerId`][peer-id], know
|
|||||||
|
|
||||||
| Type | Description |
|
| Type | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
| `{ id: PeerId, addresses: Array<Address>, protocols: Array<string> }` | Peer information of the provided peer |
|
| `{ id: PeerId, addresses: Array<Address>, metadata: Map<string, Buffer>}, protocols: Array<string> }` | Peer information of the provided peer |
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
@ -1243,13 +1243,13 @@ Get all the stored information of every peer.
|
|||||||
|
|
||||||
| Type | Description |
|
| Type | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
| `Map<string, { id: PeerId, addresses: Array<Address>, protocols: Array<string> }>` | Peer data of every peer known |
|
| `Map<string, { id: PeerId, addresses: Array<Address>, metadata: Map<string, Buffer>}, protocols: Array<string> }>` | Peer data of every peer known |
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```js
|
```js
|
||||||
for (let [peerIdString, peer] of peerStore.peers.entries()) {
|
for (let [peerIdString, peer] of peerStore.peers.entries()) {
|
||||||
// peer { id, addresses, protocols }
|
// peer { id, addresses, metadata, protocols }
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ class PeerStore extends EventEmitter {
|
|||||||
* @property {PeerId} id peer's peer-id instance.
|
* @property {PeerId} id peer's peer-id instance.
|
||||||
* @property {Array<Address>} addresses peer's addresses containing its multiaddrs and metadata.
|
* @property {Array<Address>} addresses peer's addresses containing its multiaddrs and metadata.
|
||||||
* @property {Array<string>} protocols peer's supported protocols.
|
* @property {Array<string>} protocols peer's supported protocols.
|
||||||
|
* @property {Map<string, Buffer>} metadata peer's metadata map.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user