Skip to content

chore: update deps #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2020
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
"homepage": "https://github.com/ipfs/js-ipfs-bitswap#readme",
"devDependencies": {
"@nodeutils/defaults-deep": "^1.1.0",
"aegir": "^26.0.0",
"aegir": "^28.1.0",
"benchmark": "^2.1.4",
"delay": "^4.3.0",
"ipfs-repo": "^6.0.1",
"ipfs-utils": "^3.0.0",
"ipfs-repo": "^7.0.0",
"ipfs-utils": "^4.0.0",
"iso-random-stream": "^1.1.1",
"it-all": "^1.0.2",
"it-drain": "^1.0.1",
"libp2p": "libp2p/js-libp2p#0.29.x",
"libp2p": "^0.29.3",
"libp2p-kad-dht": "^0.20.0",
"libp2p-mplex": "^0.10.0",
"libp2p-secio": "^0.13.0",
Expand All @@ -73,15 +73,15 @@
},
"dependencies": {
"abort-controller": "^3.0.0",
"any-signal": "^1.1.0",
"any-signal": "^2.1.1",
"bignumber.js": "^9.0.0",
"cids": "^1.0.0",
"debug": "^4.1.0",
"ipld-block": "^0.10.0",
"ipld-block": "^0.11.0",
"it-length-prefixed": "^3.0.0",
"it-pipe": "^1.1.0",
"just-debounce-it": "^1.1.0",
"libp2p-interfaces": "^0.4.1",
"libp2p-interfaces": "^0.7.1",
"moving-average": "^1.0.0",
"multicodec": "^2.0.0",
"multihashing-async": "^2.0.1",
Expand Down
16 changes: 11 additions & 5 deletions src/decision-engine/req-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ const SortedMap = require('../utils/sorted-map')

/**
* @typedef {Object} TaskMerger
* @property {function(task, tasksWithTopic)} hasNewInfo - given the existing
* tasks with the same topic, does the task add some new information?
* Used to decide whether to merge the task or ignore it.
* @property {function(task, existingTask)} merge - merge the information from
* the given task into the existing task (with the same topic)
* @property {function(task, tasksWithTopic)} hasNewInfo - given the existing tasks with the same topic, does the task add some new information? Used to decide whether to merge the task or ignore it.
* @property {function(task, existingTask)} merge - merge the information from the given task into the existing task (with the same topic)
*/

/**
Expand Down Expand Up @@ -49,6 +46,7 @@ class RequestQueue {

/**
* Push tasks onto the queue for the given peer
*
* @param {PeerId} peerId
* @param {Task} tasks
*/
Expand All @@ -69,6 +67,7 @@ class RequestQueue {
* the total size is at least targetMinBytes.
* This puts the popped tasks into the "active" state, meaning they are
* actively being processed (and cannot be modified).
*
* @param {number} targetMinBytes - the minimum total size of tasks to pop
* @returns {Object}
*/
Expand Down Expand Up @@ -109,6 +108,7 @@ class RequestQueue {

/**
* Remove the task with the given topic for the given peer.
*
* @param {string} topic
* @param {PeerId} peerId
*/
Expand All @@ -119,6 +119,7 @@ class RequestQueue {

/**
* Called when the tasks for the given peer complete.
*
* @param {PeerId} peerId
* @param {Task[]} tasks
*/
Expand Down Expand Up @@ -158,6 +159,7 @@ class PeerTasks {

/**
* Push tasks onto the queue.
*
* @param {Task[]} tasks
*/
pushTasks (tasks) {
Expand Down Expand Up @@ -214,6 +216,7 @@ class PeerTasks {

/**
* Pop tasks off the queue such that the total size is at least targetMinBytes
*
* @param {number} targetMinBytes
* @returns {Object}
*/
Expand Down Expand Up @@ -243,6 +246,7 @@ class PeerTasks {
/**
* Called when a task completes.
* Note: must be the same reference as returned from popTasks.
*
* @param {Task} task
*/
taskDone (task) {
Expand All @@ -254,6 +258,7 @@ class PeerTasks {

/**
* Remove pending tasks with the given topic
*
* @param {string} topic
*/
remove (topic) {
Expand All @@ -262,6 +267,7 @@ class PeerTasks {

/**
* No work to be done, this PeerTasks object can be freed.
*
* @returns {boolean}
*/
isIdle () {
Expand Down
2 changes: 2 additions & 0 deletions src/decision-engine/task-merger.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const TaskMerger = {
/**
* Indicates whether the given task has newer information than the active
* tasks with the same topic
*
* @param {Task} task
* @param {Task[]} tasksWithTopic
* @returns {boolean}
Expand Down Expand Up @@ -39,6 +40,7 @@ const TaskMerger = {

/**
* Merge the information from the task into the existing pending task
*
* @param {Task} newTask
* @param {Task} existingTask
*/
Expand Down
7 changes: 4 additions & 3 deletions src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ class Network {

/**
* Handles both types of incoming bitswap messages
*
* @private
* @param {object} param0
* @param {string} param0.protocol The protocol the stream is running
* @param {Stream} param0.stream A duplex iterable stream
* @param {Connection} param0.connection A libp2p Connection
* @param {string} param0.protocol - The protocol the stream is running
* @param {Stream} param0.stream - A duplex iterable stream
* @param {Connection} param0.connection - A libp2p Connection
* @returns {void}
*/
async _onConnection ({ protocol, stream, connection }) {
Expand Down
2 changes: 1 addition & 1 deletion src/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Notifications extends EventEmitter {
* Signal the system that we received `block`.
*
* @param {Block} block
* @return {void}
* @returns {void}
*/
hasBlock (block) {
const event = blockEvent(block.cid)
Expand Down
1 change: 1 addition & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const sortBy = (fn, list) => {

/**
* Is equal for Maps of BitswapMessageEntry or Blocks
*
* @param {Map} a
* @param {Map} b
* @returns {boolean}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/sorted-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class SortedMap extends Map {
/**
* @param {Array<k, v>} [entries]
* @param {function(a, b)} [cmp] compares [k1, v1] to [k2, v2]
* @param {function(a, b)} [cmp] - compares [k1, v1] to [k2, v2]
*/
constructor (entries, cmp) {
super()
Expand Down
7 changes: 4 additions & 3 deletions test/network/gen-bitswap-network.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ describe('gen Bitswap network', function () {

/**
* @private
* @param {Array<*>} nodes Array of Bitswap Network nodes
* @param {number} blocksPerNode Number of blocks to exchange per node
* @param {Array<*>} nodes - Array of Bitswap Network nodes
* @param {number} blocksPerNode - Number of blocks to exchange per node
*/
async function exchangeBlocks (nodes, blocksPerNode = 10) {
const blocks = await createBlocks(nodes.length * blocksPerNode)
Expand Down Expand Up @@ -88,8 +88,9 @@ async function exchangeBlocks (nodes, blocksPerNode = 10) {

/**
* Resolves `num` blocks
*
* @private
* @param {number} num The number of blocks to create
* @param {number} num - The number of blocks to create
* @returns {Promise<Block[]>}
*/
function createBlocks (num) {
Expand Down
4 changes: 2 additions & 2 deletions test/utils/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ exports.applyNetwork = (bs, n) => {

/**
* @private
* @param {number} n The number of nodes in the network
* @param {boolean} enableDHT Whether or not to run the dht
* @param {number} n - The number of nodes in the network
* @param {boolean} enableDHT - Whether or not to run the dht
*/
exports.genBitswapNetwork = async (n, enableDHT = false) => {
const netArray = [] // bitswap, peerStore, libp2p, peerId, repo
Expand Down