Skip to main content

mocra_cluster/
lib.rs

1//! mocra-cluster: the embedded control plane (refactor Phase 3).
2//!
3//! The **control plane** uses a redb state machine + Raft consensus to provide strongly consistent
4//! membership / locks / KV / partition ownership; the **data plane** (queues) still goes through
5//! the main crate's pluggable `MqBackend`.
6//!
7//! # Current progress
8//! - ✅ redb replicated state machine ([`StateMachine`]): `kv` / `locks` (with monotonic fencing
9//!   tokens).
10//! - ✅ Single-node control plane ([`LocalControlPlane`]):
11//!   `set/get/cas/acquire_lock/renew_lock/release_lock`.
12//! - ✅ openraft consensus layered on top of the state machine ([`RaftControlPlane`]): persistent
13//!   log + snapshots.
14//! - ✅ Membership / join API + partition ownership ([`partition`]: rendezvous assignment + Raft
15//!   fencing leases).
16//! - ✅ On the main crate side, `RaftCoordinationBackend` adapts `CoordinationBackend` to provide
17//!   cluster coordination.
18
19pub mod cmd;
20pub mod control;
21pub mod partition;
22pub mod raft;
23pub mod raft_http;
24pub mod raft_log_store;
25pub mod raft_network;
26pub mod raft_node;
27pub mod raft_store;
28pub mod state_machine;
29
30pub use cmd::{Cmd, CmdResult, Lock};
31pub use control::{ControlError, ControlPlane, LocalControlPlane};
32pub use partition::{
33    DEFAULT_PARTITIONS, owner_of_partition, owns_key, partition_of, partitions_owned_by,
34};
35pub use raft::{MocraRaft, Node, NodeId, TypeConfig};
36pub use raft_http::JoinRequest;
37pub use raft_node::{ClusterStatus, RaftControlPlane, RaftTuning};
38pub use state_machine::{StateMachine, StateMachineError};