clocks
crdv · C helpers for CRDV vector clocks and hybrid logical clocks
Overview
PostgreSQL · 16
Usage
Sources:
- README.md
- schema/sql/01-types.sql
- schema/clocks/clocks.control
- schema/clocks/clocks–1.0.sql
- schema/clocks/clocks.c
clocks 1.0 supplies C helpers for CRDV vector clocks and hybrid logical clocks. CRDV is a research prototype tested on PostgreSQL 16. This component does not provide replication or create the prerequisite types itself.
Core workflow
Prerequisites and functions
Use the existing hlc and vclock definitions when initializing a CRDV database; do not redefine live types. They must be visible during extension creation. vclock_lte checks component-wise ordering, vclock_max returns component-wise maxima, and next_hlc advances the hybrid clock using the current time and prior logical state. Keep clock dimensions and ordering conventions consistent with the application.
Installation requires a superuser, and no shared preload is declared. Full CRDV cluster initialization and logical-replication settings belong to the surrounding CRDV system, not to these three functions. Preserve its type definitions when backing up or restoring the extension.