Skip to content

Commit

Permalink
add metadata container
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkowalski committed Aug 21, 2017
1 parent 9b9c3c0 commit 7643bd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -254,6 +254,10 @@ Emitted when `contact` was removed from the bucket.

Emitted when a previously existing ("previously existing" means `oldContact.id` equals `newContact.id`) contact was added to the bucket and it was replaced with `newContact`.

#### Property: 'metadata'

The `metadata` object 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.

## Releases

[Current releases](https://github.com/tristanls/k-bucket/releases).
Expand Down
2 changes: 2 additions & 0 deletions index.js
Expand Up @@ -73,6 +73,8 @@ function KBucket (options) {
this.arbiter = options.arbiter || KBucket.arbiter

this.root = createNode()

this.metadata = Object.assign({}, options.metadata)
}

inherits(KBucket, EventEmitter)
Expand Down

0 comments on commit 7643bd0

Please sign in to comment.