Module lattice

Module lattice 

Source
Expand description

Lattice trait and CRDT primitive types for conflict-free parallel state merging.

A lattice is a partially ordered set where every pair of elements has a least upper bound (join/merge). The Lattice trait captures this via the merge method, which must satisfy commutativity, associativity, and idempotency.

§Primitive Types

TypeMerge semantics
FlagBoolean OR (monotonic enable)
MaxReg<T>Maximum value
MinReg<T>Minimum value
GCounterGrow-only counter (per-node max, sum for value)
GSet<T>Grow-only set (union)
ORSet<T>Observed-remove set (add-wins)
ORMap<K, V>Observed-remove map with recursive value merge (put-wins)

Structs§

Flag
A monotonic boolean flag: once enabled, it stays enabled forever.
GCounter
A grow-only counter (G-Counter) with per-node tracking.
GSet
A grow-only set (G-Set). Elements can be added but never removed.
LatticeRegistry
Registry that maps paths to type-erased lattice merge functions.
MaxReg
A register that merges by taking the maximum value.
MinReg
A register that merges by taking the minimum value.
ORMap
An observed-remove map (OR-Map) with put-wins semantics and recursive value merge.
ORSet
An observed-remove set (OR-Set) with add-wins semantics.

Traits§

Lattice
A join-semilattice: a set equipped with a commutative, associative, idempotent merge.
LatticeMerger
Type-erased lattice merge function.