minerva 0.2.0

Causal ordering for distributed systems
//! `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.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![deny(clippy::all)]
#![deny(clippy::dbg_macro)]
#![deny(clippy::cargo)]
#![deny(clippy::nursery)]
#![deny(clippy::pedantic)]
#![deny(missing_docs)]
#![forbid(unsafe_code)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(unused_results)]
#![no_std]

#[cfg(feature = "std")]
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).
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
mod readme_doctests {}

pub mod kairos;

pub mod metis;

#[cfg(feature = "std")]
pub mod chronos;