[!NOTE] This is one of 190 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.
🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️
Vector clock functions for synchronizing distributed states & processes.
inc()
).merge()
).The package provides the following immutable vector clock operations, where vector clocks are plain JS objects:
inc(clock, id)
- increment (or create) clock componentremove(clock, id)
- remove clock componentmerge(a, b)
- merge two vector clockssignedSkew(a, b)
- max signed difference between vector clocksabsSkew(a, b)
- max unsigned difference between vector clockscompare(a, b)
- comparator for logically ordering vector clocksisBefore(a, b)
- true if a < bisAfter(a, b)
- true if a > bisConcurrent(a, b)
- if both clocks represent concurrent updatesequiv(a, b)
- equality predicateorderAsc(a, b)
- alias for compare()
orderDesc(a, b)
- reverse order to orderAsc()
References:
BETA - possibly breaking changes forthcoming
Search or submit any issues for this package
yarn add @thi.ng/vclock
ES module import:
<script type="module" src="https://cdn.skypack.dev/@thi.ng/vclock"></script>
For Node.js REPL:
const vclock = await import("@thi.ng/vclock");
Package sizes (brotli'd, pre-treeshake): ESM: 431 bytes
TODO
If this project contributes to an academic publication, please cite it as:
@misc{thing-vclock,
title = "@thi.ng/vclock",
author = "Karsten Schmidt",
note = "https://thi.ng/vclock",
year = 2018
}
© 2018 - 2024 Karsten Schmidt // Apache License 2.0
Generated using TypeDoc