Skip to main content

Module hlc_storage

Module hlc_storage 

Source
Expand description

SQL-backed HlcStorage for the hybrid logical clock.

Owns the clock’s schema — a single-row register table, named from a caller prefix — and the SQL behind it. save enqueues into a DbBatch sink rather than committing on its own, so the clock state lands in the same transaction as the write it timestamps. The persist upsert is MAX-guarded, so an out-of-order commit can never lower the stored clock.

The clock is read exactly once, at startup: SqlHlcStorage::open ensures the table and loads the seed asynchronously, then caches it so the synchronous load the service calls just returns it.

Structs§

SqlHlcStorage
Persistence for the clock register, scoped to a table-name prefix.