Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: bitswap.stat docs (#355)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
alanshaw authored Aug 28, 2018
1 parent 2904a7e commit f146e1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions SPEC/BITSWAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ ipfs.bitswap.wantlist(peerId, (err, list) => console.log(list))

#### `bitswap.stat`

> Adds an IPFS object to the pinset and also stores it to the IPFS repo. pinset is the set of hashes currently pinned (not gc'able).
> Show diagnostic information on the bitswap agent.
##### `Go` **WIP**

##### `JavaScript` - ipfs.bitswap.stat([callback])

`stats.bitswap` and `bitswap.stat` can be used interchangeably.
Note: `bitswap.stat` and `stats.bitswap` can be used interchangeably.

`callback` must follow `function (err, stats) {}` signature, where `err` is an error if the operation was not successful. `stats` is an Object containing the following keys:

- `provideBufLen` is an integer.
- `wantlist` (array)
- `peers` (array)
- `wantlist` (array of CIDs)
- `peers` (array of peer IDs)
- `blocksReceived` is a [Big Int][1]
- `dataReceived` is a [Big Int][1]
- `blocksSent` is a [Big Int][1]
Expand All @@ -57,10 +57,10 @@ If no `callback` is passed, a promise is returned.
**Example:**

```JavaScript
ipfs.stats.bitswap((err, stats) => console.log(stats))
ipfs.bitswap.stat((err, stats) => console.log(stats))

// { provideBufLen: 0,
// wantlist: null,
// wantlist: [ { '/': 'QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM' } ],
// peers:
// [ 'QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
// 'QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
Expand Down
8 changes: 6 additions & 2 deletions SPEC/STATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@

#### `stats.bitswap`

`stats.bitswap` and `bitswap.stat` can be used interchangeably. See [`bitswap.stat`](./BITSWAP.md#stat) for more details.
> Show diagnostic information on the bitswap agent.
Note: `stats.bitswap` and `bitswap.stat` can be used interchangeably. See [`bitswap.stat`](./BITSWAP.md#bitswapstat) for more details.

#### `stats.repo`

`stats.repo` and `repo.stat` can be used interchangeably. See [`repo.stat`](./REPO.md#stat) for more details.
> Get stats for the currently used repo.
Note: `stats.repo` and `repo.stat` can be used interchangeably. See [`repo.stat`](./REPO.md#repostat) for more details.

#### `stats.bw`

Expand Down

0 comments on commit f146e1b

Please sign in to comment.