Expand description
mocra-cluster: the embedded control plane (refactor Phase 3).
The control plane uses a redb state machine + Raft consensus to provide strongly consistent
membership / locks / KV / partition ownership; the data plane (queues) still goes through
the main crate’s pluggable MqBackend.
§Current progress
- ✅ redb replicated state machine (
StateMachine):kv/locks(with monotonic fencing tokens). - ✅ Single-node control plane (
LocalControlPlane):set/get/cas/acquire_lock/renew_lock/release_lock. - ✅ openraft consensus layered on top of the state machine (
RaftControlPlane): persistent log + snapshots. - ✅ Membership / join API + partition ownership (
partition: rendezvous assignment + Raft fencing leases). - ✅ On the main crate side,
RaftCoordinationBackendadaptsCoordinationBackendto provide cluster coordination.
Re-exports§
pub use cmd::Cmd;pub use cmd::CmdResult;pub use cmd::Lock;pub use control::ControlError;pub use control::ControlPlane;pub use control::LocalControlPlane;pub use partition::DEFAULT_PARTITIONS;pub use partition::owner_of_partition;pub use partition::owns_key;pub use partition::partition_of;pub use partition::partitions_owned_by;pub use raft::MocraRaft;pub use raft::Node;pub use raft::NodeId;pub use raft::TypeConfig;pub use raft_http::JoinRequest;pub use raft_node::ClusterStatus;pub use raft_node::RaftControlPlane;pub use raft_node::RaftTuning;pub use state_machine::StateMachine;pub use state_machine::StateMachineError;
Modules§
- cmd
- State machine commands and results.
- control
- Control plane API: strongly consistent KV + distributed locks on top of the state machine.
- partition
- Partition ownership (refactor Phase 3): spreads collection work across cluster nodes by partition.
- raft
- openraft type configuration: wires the control plane’s
Cmd/CmdResultinto Raft (openraft 0.9.24). - raft_
http - Node-to-node control plane RPC: HTTP + msgpack.
- raft_
log_ store - redb-persisted Raft log storage.
- raft_
network - Stub network for single-node deployments.
- raft_
node - Single-node Raft control plane: assembles the openraft node; commands are committed through Raft and then applied to the redb state machine.
- raft_
store - Raft storage: in-memory log + redb state machine.
- state_
machine - A redb-backed replicated state machine.