Comparing version 3.2.1 to 3.3.0
@@ -56,2 +56,6 @@ /* | ||
`crypto.randomBytes(20)`. | ||
* `metadata`: _Object_ _(Default: {})_ Optional satellite data to include | ||
with the k-bucket. `metadata` property is guaranteed not be altered by, | ||
it is provided as an explicit container for users of k-bucket to store | ||
implementation-specific data. | ||
* `numberOfNodesPerKBucket`: _Integer_ _(Default: 20)_ The number of nodes | ||
@@ -77,2 +81,4 @@ that a k-bucket can contain before being full or split. | ||
this.root = createNode() | ||
this.metadata = Object.assign({}, options.metadata) | ||
} | ||
@@ -79,0 +85,0 @@ |
{ | ||
"name": "k-bucket", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "Kademlia DHT K-bucket implementation as a binary tree", | ||
@@ -21,3 +21,4 @@ "keywords": [ | ||
"Fabien O'Carroll <fabien@allou.is>", | ||
"Kirill Fomichev <fanatid@ya.ru>" | ||
"Kirill Fomichev <fanatid@ya.ru>", | ||
"Robert Kowalski <rok@kowalski.gd>" | ||
], | ||
@@ -24,0 +25,0 @@ "main": "./index.js", |
@@ -11,3 +11,3 @@ # k-bucket | ||
[@tristanls](https://github.com/tristanls), [@mikedeboer](https://github.com/mikedeboer), [@deoxxa](https://github.com/deoxxa), [@feross](https://github.com/feross), [@nathanph](https://github.com/nathanph), [@allouis](https://github.com/allouis), [@fanatid](https://github.com/fanatid) | ||
[@tristanls](https://github.com/tristanls), [@mikedeboer](https://github.com/mikedeboer), [@deoxxa](https://github.com/deoxxa), [@feross](https://github.com/feross), [@nathanph](https://github.com/nathanph), [@allouis](https://github.com/allouis), [@fanatid](https://github.com/fanatid), [@robertkowalski](https://github.com/robertkowalski) | ||
@@ -113,2 +113,3 @@ ## Installation | ||
* [kBucket.get(id)](#kbucketgetid) | ||
* [kBucket.metadata](#kbucketmetadata) | ||
* [kBucket.remove(id)](#kbucketremoveid) | ||
@@ -145,2 +146,3 @@ * [kBucket.toArray()](#kbuckettoarray) | ||
* `localNodeId`: _Buffer_ An optional Buffer representing the local node id. If not provided, a local node id will be created via `crypto.randomBytes(20)`. | ||
* `metadata`: _Object_ _(Default: {})_ Optional satellite data to include with the k-bucket. `metadata` property is guaranteed not be altered, it is provided as an explicit container for users of k-bucket to store implementation-specific data. | ||
* `numberOfNodesPerKBucket`: _Integer_ _(Default: 20)_ The number of nodes that a k-bucket can contain before being full or split. | ||
@@ -181,2 +183,8 @@ * `numberOfNodesToPing`: _Integer_ _(Default: 3)_ The number of nodes to ping when a bucket that should not be split becomes full. KBucket will emit a `ping` event that contains `numberOfNodesToPing` nodes that have not been contacted the longest. | ||
#### kBucket.metadata | ||
* `metadata`: _Object_ _(Default: {})_ | ||
The `metadata` property serves as a container that can be used by implementations using k-bucket. One example is storing a timestamp to indicate the last time when a node in the bucket was responding to a ping. | ||
#### kBucket.remove(id) | ||
@@ -183,0 +191,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53425
908
288