README
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
$ 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