Expand description
Lease Consensus Logic
This crate implements the consensus algorithms required to agree on Lease Validity.
§Features
std- Enable standard library (includes tokio)net- Enable networking (UDP transport)grpc- Enable gRPC transport with tonictls- Enable TLS/mTLS supportobservability- Enable Prometheus metricsfull- Enable all features
§Architecture
┌─────────────────────────────────────────────────────────────┐
│ ConsensusEngine │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ RaftEngine │ │ RaftNetwork │ │ ReplicatedStateMachine│ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ RaftStorage │ │GrpcTransport│ │ StateMachine │ │
│ │ (Sled/Mem) │ │ (or InMem) │ │ (User-defined) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘Re-exports§
pub use engine::ConsensusEngine;pub use engine::ConsensusError;pub use engine::ConsensusFactory;pub use engine::ConsensusStrategy;pub use engine::RaftConfig;pub use engine::RaftEngine;pub use network::ConsensusNetwork;pub use network::InMemoryNetwork;pub use network::NetworkConfig;pub use network::NetworkError;pub use network::Packet;pub use network::PeerInfo;pub use network::RaftMessage;pub use network::RaftNetwork;pub use metrics::RaftMetrics;pub use metrics::RaftRoleMetric;pub use raft::FileStorage;pub use raft::InMemoryStorage;pub use raft::LogEntry;pub use raft::LogIndex;pub use raft::LogInfo;pub use raft::NodeId;pub use raft::RaftNode;pub use raft::RaftRole;pub use raft::RaftStorage;pub use raft::Snapshot;pub use raft::StorageStats;pub use raft::Term;pub use state_machine::KeyValueStateMachine;pub use state_machine::KvCommand;pub use state_machine::KvOutput;pub use state_machine::NoOpStateMachine;pub use state_machine::ReplicatedStateMachine;pub use state_machine::StateMachine;
Modules§
- builder
- deadlock
- engine
- Consensus Engine Implementation
- metrics
- Raft Metrics and Observability
- network
- Network transport for Raft consensus.
- prelude
- Convenient imports for common use cases.
- raft
- state_
machine - State Machine Abstraction
Macros§
- raft_
span - Creates a new span for Raft RPC operations.
Structs§
- Lease
Manager - Manages the consensus of leases for a specific resource.