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
//! Control-Plane Mini Kernel
//!
//! This module implements a type-safe, effect-based control-plane for session management.
//! All control operations are decomposed into atomic effects, invariants are encoded in types,
//! and unsafe operations are explicitly documented at their call sites.
//!
//! ## Architecture
//!
//! - **effects**: Primitive control-plane operations (Open, TopologyBegin, TxCommit, StateSnapshot, etc.)
//! - 14 primitive effects covering all control operations
//! - Idempotency, generation bump, and history modification properties
//! - **error**: Unified error handling (`CpError`, `TopologyError`, `AbortError`, etc.)
//! - Consolidates all control-plane errors for uniform handling
//! - Includes replay detection and RID mismatch errors
//! - **types**: Type-level invariants (NoCrossLaneAliasing, AtMostOnceCommit, etc.)
//! - Marker traits for compile-time safety
//! - Newtypes for Lane, Generation, RendezvousId
//! - **txn**: Typestate-based transaction protocol
//! - Linear state transitions: Txn → InBegin → InAcked → Closed
//! - Shot discipline enforcement (One vs Many)
//!
//! ## Invariant Registry
//!
//! - **NoCrossLaneAliasing**: Marked at the type level
//! - **AtMostOnceCommit**: Enforced by the typestate protocol
//! - **IncreasingGen**: Maintained by `Generation::bump()` and rendezvous
//! - **One**: Single-use shot discipline enforced by the type marker
//!
//! ## Design Principles
//!
//! 1. **Effect-based decomposition**: All operations map to `ControlOp` enum
//! 2. **Type-level invariants**: Marker traits prevent misuse at compile time
//! 3. **Single control kernel**: All external effects collapse into `ControlOp`
//!
//! ## Architecture Notes
//!
//! - Effect decomposition: All 14 control operations mapped to `ControlOp`
//! - Type-level invariants: NoCrossLaneAliasing, AtMostOnceCommit, Shot discipline
//! - Unified errors: `CpError` consolidates all control-plane errors
//! - Tap integration for distributed topology/cap/deleg events
//!
//! ## Usage
//!
//! ```rust,ignore
//! use crate::control::automaton::txn::{NoopTap, Txn};
//! use crate::control::types::{IncreasingGen, One};
//!
//! let mut tap = NoopTap;
//! let txn: Txn<MyInv, IncreasingGen, One> = /* ... */;
//! let in_begin = txn.begin(&mut tap);
//! let in_acked = in_begin.ack(&mut tap);
//! let closed = in_acked.commit(&mut tap);
//! ```
/// Typestate automata for control operations.
pub
pub
/// Capability resources and payloads.
pub
/// Control-plane cluster coordination.
pub
/// Lease planning and capacity checks.
pub
/// Control-plane types and invariants.
pub