Monotonically increasing per machine, globally unique eventids
Note: This is not an official Google product.
An eventId uniquely identifies an event across a network of services. It is
globally unique, and is monotically increasing locally. This makes eventids
useful for lexically comparable identifiers for events in a distributed system.
This can be used instead of timestamps – JavaScript timestamps only have
millisecond resolution making them unsuitable for the purpose of building
monotonically increasing local ids.
const EventId = require('eventid');
const eventId = new EventId();
const id1 = eventId.new();
const id2 = eventId.new();
assert(id1 < id2);
const another = new EventId();
const id3 = another.new();