Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions SPEC/BITSWAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ Note: `bitswap.stat` and `stats.bitswap` can be used interchangeably.
- `provideBufLen` is an integer.
- `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]
- `dataSent` is a [Big Int][1]
- `dupBlksReceived` is a [Big Int][1]
- `dupDataReceived` is a [Big Int][1]
- `blocksReceived` is a [BigNumber Int][1]
- `dataReceived` is a [BigNumber Int][1]
- `blocksSent` is a [BigNumber Int][1]
- `dataSent` is a [BigNumber Int][1]
- `dupBlksReceived` is a [BigNumber Int][1]
- `dupDataReceived` is a [BigNumber Int][1]

If no `callback` is passed, a promise is returned.

Expand All @@ -73,4 +73,4 @@ ipfs.bitswap.stat((err, stats) => console.log(stats))
// dupDataReceived: 0 }
```

[1]: https://github.com/MikeMcl/big.js/
[1]: https://github.com/MikeMcl/bignumber.js/
8 changes: 4 additions & 4 deletions SPEC/REPO.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ Where:

`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:

- `numObjects` is a [Big Int][1].
- `repoSize` is a [Big Int][1], in bytes.
- `numObjects` is a [BigNumber Int][1].
- `repoSize` is a [BigNumber Int][1], in bytes.
- `repoPath` is a string.
- `version` is a string.
- `storageMax` is a [Big Int][1].
- `storageMax` is a [BigNumber Int][1].

If no `callback` is passed, a promise is returned.

Expand Down Expand Up @@ -85,4 +85,4 @@ ipfs.repo.version((err, version) => console.log(version))
// "6"
```

[1]: https://github.com/MikeMcl/big.js/
[1]: https://github.com/MikeMcl/bignumber.js/
34 changes: 17 additions & 17 deletions SPEC/STATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Where:

`stat` is, in both cases, an Object containing the following keys:

- `totalIn` - is a [Big Int][big], in bytes.
- `totalOut` - is a [Big Int][big], in bytes.
- `rateIn` - is a [Big Int][big], in bytes.
- `rateOut` - is a [Big Int][big], in bytes.
- `totalIn` - is a [BigNumber Int][bigNumber], in bytes.
- `totalOut` - is a [BigNumber Int][bigNumber], in bytes.
- `rateIn` - is a [BigNumber Int][bigNumber], in bytes.
- `rateOut` - is a [BigNumber Int][bigNumber], in bytes.

If no `callback` is passed, a promise is returned.

Expand All @@ -50,10 +50,10 @@ If no `callback` is passed, a promise is returned.
```JavaScript
ipfs.stats.bw((err, stats) => console.log(stats))

// { totalIn: Big {...},
// totalOut: Big {...},
// rateIn: Big {...},
// rateOut: Big {...} }
// { totalIn: BigNumber {...},
// totalOut: BigNumber {...},
// rateIn: BigNumber {...},
// rateOut: BigNumber {...} }
```

#### `stats.bwPullStream`
Expand All @@ -79,10 +79,10 @@ pull(
log()
)

// { totalIn: Big {...},
// totalOut: Big {...},
// rateIn: Big {...},
// rateOut: Big {...} }
// { totalIn: BigNumber {...},
// totalOut: BigNumber {...},
// rateIn: BigNumber {...},
// rateOut: BigNumber {...} }
// ...
// Ad infinitum
```
Expand All @@ -106,14 +106,14 @@ stream.on('data', (data) => {
console.log(data)
}))

// { totalIn: Big {...},
// totalOut: Big {...},
// rateIn: Big {...},
// rateOut: Big {...} }
// { totalIn: BigNumber {...},
// totalOut: BigNumber {...},
// rateIn: BigNumber {...},
// rateOut: BigNumber {...} }
// ...
// Ad infinitum
```

[big]: https://github.com/MikeMcl/big.js/
[bigNumber]: https://github.com/MikeMcl/bignumber.js/
[rs]: https://www.npmjs.com/package/readable-stream
[ps]: https://www.npmjs.com/package/pull-stream
2 changes: 1 addition & 1 deletion js/src/stats/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { expect } = require('../utils/mocha')

const isBigInt = (n) => {
return n.constructor.name === 'Big'
return n.constructor.name === 'BigNumber'
}

exports.expectIsBitswap = (err, stats) => {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"homepage": "https://github.com/ipfs/interface-ipfs-core#readme",
"dependencies": {
"async": "^2.6.1",
"big.js": "^5.2.2",
"bl": "^2.1.2",
"bs58": "^4.0.1",
"chai": "^4.2.0",
Expand All @@ -49,7 +48,7 @@
"into-stream": "^4.0.0",
"ipfs-block": "~0.8.0",
"ipfs-unixfs": "~0.1.16",
"ipld-dag-cbor": "~0.13.0",
"ipld-dag-cbor": "~0.13.1",
"ipld-dag-pb": "~0.15.0",
"is-ipfs": "~0.4.2",
"is-plain-object": "^2.0.4",
Expand Down