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.
Merge branch 'master' into feature/pin
- Loading branch information
Showing
86 changed files
with
2,354 additions
and
1,418 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict' | ||
|
||
const gulp = require('gulp') | ||
const parallel = require('run-parallel') | ||
const series = require('run-series') | ||
const createTempNode = require('./test/utils/temp-node') | ||
const API = require('./src/http-api') | ||
|
||
let nodes = [] | ||
|
||
function startNode (num, done) { | ||
createTempNode(num, (err, node) => { | ||
if (err) throw err | ||
|
||
const api = new API(node.repo.path()) | ||
nodes.push(api) | ||
api.start(done) | ||
}) | ||
} | ||
|
||
gulp.task('libnode:start', (done) => { | ||
nodes = [] | ||
parallel([ | ||
(cb) => startNode(7, cb), | ||
(cb) => startNode(8, cb), | ||
(cb) => startNode(9, cb) | ||
], done) | ||
}) | ||
|
||
gulp.task('libnode:stop', (done) => { | ||
series(nodes.map((node) => (cb) => { | ||
setTimeout(() => node.stop(cb), 500) | ||
}), done) | ||
}) | ||
|
||
gulp.task('test:browser:before', ['libnode:start']) | ||
gulp.task('test:node:before', ['libnode:start']) | ||
gulp.task('test:browser:after', ['libnode:stop']) | ||
gulp.task('test:node:after', ['libnode:stop']) | ||
|
||
require('aegir/gulp')(gulp) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
const utils = require('../../utils') | ||
|
||
module.exports = Command.extend({ | ||
desc: 'Show some diagnostic information on the bitswap agent.', | ||
|
||
options: { | ||
}, | ||
|
||
run: () => { | ||
utils.getIPFS((err, ipfs) => { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
ipfs.bitswap.stat((err, stats) => { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
stats.Wantlist = stats.Wantlist || [] | ||
stats.Peers = stats.Peers || [] | ||
|
||
console.log(` | ||
bitswap status | ||
blocks received: ${stats.BlocksReceived} | ||
dup blocks received: ${stats.DupBlksReceived} | ||
dup data received: ${stats.DupDataReceived}B | ||
wantlist [${stats.Wantlist.length} keys] | ||
${stats.Wantlist.join('\n ')} | ||
partners [${stats.Peers.length}] | ||
${stats.Peers.join('\n ')}`) | ||
}) | ||
}) | ||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
const utils = require('../../utils') | ||
|
||
module.exports = Command.extend({ | ||
desc: 'Remove a given block from your wantlist.', | ||
|
||
options: { | ||
key: { | ||
required: true | ||
} | ||
}, | ||
|
||
run: (key) => { | ||
utils.getIPFS((err, ipfs) => { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
throw new Error('Not implemented yet') | ||
}) | ||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
const utils = require('../../utils') | ||
|
||
module.exports = Command.extend({ | ||
desc: 'Print out all blocks currently on the bitswap wantlist for the local peer.', | ||
|
||
options: { | ||
}, | ||
|
||
run: () => { | ||
utils.getIPFS((err, ipfs) => { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
ipfs.bitswap.wantlist((err, res) => { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
res.Keys.forEach((k) => console.log(k)) | ||
}) | ||
}) | ||
} | ||
}) |
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
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
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
Oops, something went wrong.