bones_core/dag/mod.rs
1//! Eg-Walker event DAG with causal parent tracking.
2//!
3//! This module implements the Merkle-DAG structure used for content-addressed
4//! event storage and causal ordering in the bones event log.
5//!
6//! # DAG Properties
7//!
8//! - **Content-addressed identity**: every event is identified by a BLAKE3
9//! hash of its fields, including its parent hashes.
10//! - **Causal ordering**: parent hash references encode happens-before
11//! relationships, independent of wall-clock time.
12//! - **Merkle integrity**: modifying any event changes its hash and therefore
13//! invalidates all descendant hashes, enabling tamper detection.
14//! - **Linear events** have one parent; **merge points** have two (or more).
15//! Root events have no parents.
16//!
17//! # Sub-modules
18//!
19//! - [`hash`]: Hash verification and parent chain validation.
20//! ([`verify_event_hash`], [`verify_chain`])
21//! - [`graph`]: In-memory DAG structure with parent/descendant traversal.
22//! ([`EventDag`], [`DagNode`])
23//! - [`lca`]: Lowest Common Ancestor finding for divergent branches.
24//! ([`find_lca`], [`find_all_lcas`])
25//! - [`replay`]: Divergent-branch replay for CRDT state reconstruction.
26//! ([`replay_divergent`], [`replay_divergent_for_item`])
27//!
28//! # Related Modules
29//!
30//! - [`crate::event::writer::compute_event_hash`]: Computes the BLAKE3 hash
31//! for an event. Used internally by [`hash::verify_event_hash`] and
32//! [`hash::verify_chain`].
33
34pub mod graph;
35pub mod hash;
36pub mod lca;
37pub mod replay;