Expand description
Pillar: I. PACR fields: ι (node identity), Π (predecessor edges).
A lock-free, append-only causal DAG over PacrRecord nodes.
Physical axiom: special relativity mandates that causation propagates at most at the speed of light, imposing a strict partial order on events. This partial order is encoded in the predecessor set Π — there is no total order and no global clock.
§Design
| Operation | Complexity | Mechanism |
|---|---|---|
CausalDag::append | O(|Π|) | predecessor validation + DashMap CAS |
CausalDag::get | O(1) expected | DashMap sharded read |
CausalDag::successors | O(1) | DashMap reverse-index read |
CausalDag::predecessors | O(1) | DashMap sharded read |
CausalDag::ancestry | O(V+E) | BFS with HashSet visited-set |
§CRDT semantics
The DAG is a Grow-Only Set (G-Set): records are immutable once inserted and the only mutation is appending new records. Two replicas converge by exchanging unseen records (union of node sets).
§Concurrency
DashMap uses sharded locks (not a single RwLock) and provides
lock-free concurrent reads on already-inserted keys. Append uses
entry() for an atomic duplicate-check-and-insert, eliminating the
TOCTOU race of a separate contains_key + insert pair.
No Mutex or RwLock is used anywhere in this crate.
Modules§
- distance_
tax - Pillar: I + II. PACR fields: Π + Λ.
- merge
- Pillar: I + II. PACR field: Π.
Structs§
- Causal
Dag - A lock-free, append-only directed acyclic graph of
PacrRecordnodes.
Enums§
- DagError
- Error returned by
CausalDag::append.