vclock

1.0.0 • Public • Published

vclock

Vector clock implementation in js. Vector clocks can be used to generate partial ordering of events in a distributed system.

Implements the asynchronous algorithm described in Timestamps in Message-Passing Systems That Preserve the Partial Ordering.

Install

Install the package with npm:

$ npm install vclock

API

new Clock(id)

Creates a new Clock. id is used as a key in the clock hash.

.tick()

Increment the clock.

.get([id])

Get the current local clock value for clock id. id defaults to the clocks id.

Unknown clocks have value 0.

.update(clock)

Update the local clock with values from clock.

License

MIT

Package Sidebar

Install

npm i vclock

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • lennon