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

Commit 0c40084

Browse files
hacdiasdaviddias
authored andcommitted
feat: Link stats.repo and stats.bitswap (#210)
* Update BITSWAP.md * Update STATS.md * Update BITSWAP.md * Update REPO.md
1 parent 02dc5f4 commit 0c40084

File tree

3 files changed

+54
-73
lines changed

3 files changed

+54
-73
lines changed

SPEC/BITSWAP.md

+49-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
1-
bitswap API (not spec'ed yet)
2-
=============================
1+
Bitswap API
2+
=======
3+
4+
#### `wantlist` (not spec'ed yet)
5+
6+
#### `unwant` (not spec'ed yet)
7+
8+
#### `stat`
9+
10+
> 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).
11+
12+
##### `Go` **WIP**
13+
14+
##### `JavaScript` - ipfs.bitswap.stat([callback])
15+
16+
`stats.bitswap` and `bitswap.stat` can be used interchangeably.
17+
18+
`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:
19+
20+
- `provideBufLen`
21+
- `wantlist` (array)
22+
- `peers` (array)
23+
- `blocksReceived`
24+
- `dataReceived`
25+
- `blocksSent`
26+
- `dataSent`
27+
- `dupBlksReceived`
28+
- `dupDataReceived`
29+
30+
If no `callback` is passed, a promise is returned.
31+
32+
**Example:**
33+
34+
```JavaScript
35+
ipfs.stats.bitswap((err, stats) => console.log(stats))
36+
37+
// { provideBufLen: 0,
38+
// wantlist: null,
39+
// peers:
40+
// [ 'QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
41+
// 'QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
42+
// 'QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd' ],
43+
// blocksReceived: 0,
44+
// dataReceived: 0,
45+
// blocksSent: 0,
46+
// dataSent: 0,
47+
// dupBlksReceived: 0,
48+
// dupDataReceived: 0 }
49+
```

SPEC/REPO.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ ipfs.repo.gc((err, res) => console.log(res))
3333

3434
##### `JavaScript` - ipfs.repo.stat([options, callback])
3535

36+
`stats.repo` and `repo.stat` can be used interchangeably.
37+
3638
Where:
3739

3840
- `options` is an object that contains following properties

SPEC/STATS.md

+3-71
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,11 @@ Stats API
33

44
#### `bitswap`
55

6-
> 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).
7-
8-
##### `Go` **WIP**
9-
10-
##### `JavaScript` - ipfs.stats.bitswap([callback])
6+
`stats.bitswap` and `bitswap.stat` can be used interchangeably. See [`bitswap.stat`](./BITSWAP.md#stat) for more details.
117

12-
`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:
13-
14-
- `provideBufLen`
15-
- `wantlist` (array)
16-
- `peers` (array)
17-
- `blocksReceived`
18-
- `dataReceived`
19-
- `blocksSent`
20-
- `dataSent`
21-
- `dupBlksReceived`
22-
- `dupDataReceived`
8+
#### `repo`
239

24-
If no `callback` is passed, a promise is returned.
25-
26-
**Example:**
27-
28-
```JavaScript
29-
ipfs.stats.bitswap((err, stats) => console.log(stats))
30-
31-
// { provideBufLen: 0,
32-
// wantlist: null,
33-
// peers:
34-
// [ 'QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
35-
// 'QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
36-
// 'QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd' ],
37-
// blocksReceived: 0,
38-
// dataReceived: 0,
39-
// blocksSent: 0,
40-
// dataSent: 0,
41-
// dupBlksReceived: 0,
42-
// dupDataReceived: 0 }
43-
```
10+
`stats.repo` and `repo.stat` can be used interchangeably. See [`repo.stat`](./REPO.md#stat) for more details.
4411

4512
#### `bw`
4613

@@ -77,38 +44,3 @@ ipfs.stats.bw((err, stats) => console.log(stats))
7744
// rateIn: 905.0873512246716,
7845
// rateOut: 893.7400053359125 }
7946
```
80-
81-
#### `stat`
82-
83-
> Get stats for the currently used repo.
84-
85-
##### `Go` **WIP**
86-
87-
##### `JavaScript` - ipfs.repo.stat([options, callback])
88-
89-
Where:
90-
91-
- `options` is an object that contains following properties
92-
- `human` a Boolean value to output `repoSize` in MiB.
93-
94-
`callback` must follow `function (err, stats) {}` signature, where `err` is an Error if the operation was not successful and `stats` is an object containing the following keys:
95-
96-
- `numObjects`
97-
- `repoSize`
98-
- `repoPath`
99-
- `version`
100-
- `storageMax`
101-
102-
If no `callback` is passed, a promise is returned.
103-
104-
**Example:**
105-
106-
```JavaScript
107-
ipfs.repo.stat((err, stats) => console.log(stats))
108-
109-
// { numObjects: 15,
110-
// repoSize: 64190,
111-
// repoPath: 'C:\\Users\\henri\\AppData\\Local\\Temp\\ipfs_687c6eb3da07d3b16fe3c63ce17560e9',
112-
// version: 'fs-repo@6',
113-
// storageMax: 10000000000 }
114-
```

0 commit comments

Comments
 (0)