1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! `no_std`-first primitives for causal ordering in distributed systems.
//!
//! [`kairos`] provides a lock-free Hybrid Logical Clock. Its 128-bit
//! [`Kairos`](kairos::Kairos) stamp orders physical time, logical time, a
//! caller-defined kairotic tag, and station identity.
//!
//! [`metis`] adds causal delivery, exact dot sets, stability tracking,
//! causal stores, sequence CRDTs, and recorded membership. Its witness types
//! distinguish proven state from raw input at compile time.
//!
//! The optional `chronos` adapter provides OS-backed time sources when the
//! `std` feature is enabled. The core remains `no_std`.
//!
//! Minerva owns mechanism. It validates structure, preserves causal
//! invariants, returns typed refusals, and offers explicit resource bounds.
//! Callers own trust, retry, conflict resolution, reclamation, and membership
//! policy.
//!
//! # Example
//!
//! Two replicas write one sequence and converge:
//!
//! ```
//! use minerva::kairos::{Clock, TickCounter};
//! use minerva::metis::{Anchor, Composer, DotSet, Locus, Rhapsody};
//!
//! let clock = Clock::with_default_config(TickCounter::new(), 1)?;
//! let mut ada = Composer::<Rhapsody>::new(1);
//! let mut bea = Composer::<Rhapsody>::new(2);
//!
//! // Ada writes one element. The write mints a dot: the element's identity.
//! let rank = clock.now(0u16);
//! let (_dot, _delta) = ada.compose(|assigned| {
//! let mut rhapsody = Rhapsody::new();
//! assert!(rhapsody.weave(assigned, Locus { anchor: Anchor::Origin, rank }));
//! (rhapsody, DotSet::new())
//! });
//!
//! // Bea absorbs what Ada owes her. Both replicas read the same order.
//! let owed = ada.owed_to(bea.state().context());
//! let _ = bea.absorb(1, &owed);
//! assert_eq!(ada.state().store().order(), bea.state().store().order());
//! # Ok::<(), minerva::kairos::InvalidStationId>(())
//! ```
//!
//! [`docs/day-one.adoc`](https://github.com/OwlRoute/minerva/blob/main/docs/day-one.adoc)
//! extends this example to a full replicated document.
extern crate std;
/// The README's example compiles and runs as a doctest, so the crates.io
/// landing page cannot drift from the live surface (the day-one discipline,
/// applied to the README).