This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Link stats.repo and stats.bitswap (#210)
* Update BITSWAP.md * Update STATS.md * Update BITSWAP.md * Update REPO.md
- Loading branch information
Showing
3 changed files
with
54 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
bitswap API (not spec'ed yet) | ||
============================= | ||
Bitswap API | ||
======= | ||
|
||
#### `wantlist` (not spec'ed yet) | ||
|
||
#### `unwant` (not spec'ed yet) | ||
|
||
#### `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). | ||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.bitswap.stat([callback]) | ||
|
||
`stats.bitswap` and `bitswap.stat` 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` | ||
- `wantlist` (array) | ||
- `peers` (array) | ||
- `blocksReceived` | ||
- `dataReceived` | ||
- `blocksSent` | ||
- `dataSent` | ||
- `dupBlksReceived` | ||
- `dupDataReceived` | ||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
**Example:** | ||
|
||
```JavaScript | ||
ipfs.stats.bitswap((err, stats) => console.log(stats)) | ||
|
||
// { provideBufLen: 0, | ||
// wantlist: null, | ||
// peers: | ||
// [ 'QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM', | ||
// 'QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu', | ||
// 'QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd' ], | ||
// blocksReceived: 0, | ||
// dataReceived: 0, | ||
// blocksSent: 0, | ||
// dataSent: 0, | ||
// dupBlksReceived: 0, | ||
// dupDataReceived: 0 } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters