Skip to main content

Module versioned_pointer

Module versioned_pointer 

Source
Expand description

Versioned/MVCC pointers - time-travel addressing for snapshot isolation, immutable trees, and distributed clocks.

Three pointer flavours sharing a common shape (version, target):

TypeVersionUse case
VersionedPointer<T>u64Local MVCC, snapshot isolation
HlcVersionedPointer<T>(u64 physical, u64 logical)Distributed (CockroachDB-style HLC)
VectorClockPointer<T, N>[u64; N] per-nodePer-node causal ordering (Riak-style)

Plus a VersionedChain<T> linked-list of VersionedNode<T>s that retains all historical versions for time-travel queries.

§The K_temporal / K_cascade interplay

VersionedPointer<T> is a single-version snapshot. VersionedPointer<VersionedPointer<T>> is the K_cascade = 2 case: outer carries coarse (physical) time, inner carries fine (logical) counter. This is exactly the Hybrid Logical Clock pattern that CockroachDB and Spanner use - here exposed as a first-class typed primitive via HlcVersionedPointer<T>.

Structs§

HlcVersionedPointer
Pointer + HLC. Composes VersionedPointer with the cascade structure of (physical, logical). Two-level rejection on visible_at: physical mismatch rejects fast, logical compares only when physical ties.
HybridLogicalClock
Hybrid Logical Clock: (physical timestamp, logical counter) pair. Combines wall-clock time (microsecond resolution typical) with a per-node monotonic counter that breaks ties between events recorded in the same physical instant.
VectorClock
Per-node monotonic counters. N is the number of nodes in the system; clock[i] is node i’s observed event count. Causal ordering: a causally precedes b when every component of a is <= the corresponding component of b, with at least one strict less-than.
VectorClockPointer
Pointer + vector clock. Useful for distributed CRDT-style snapshot reads where causal-but-concurrent updates must be surfaced rather than ordered.
VersionedChain
Linked list of (version, value) nodes ordered newest-first. Time-travel reads walk the chain until they find a version <= the query snapshot.
VersionedPointer
Pointer + monotonic u64 version. Used for snapshot-isolation reads: visible at a query snapshot when self.version <= snapshot.