Crate amaters_cluster

Crate amaters_cluster 

Source
Expand description

Consensus layer for AmateRS (Ukehi - The Sacred Pledge)

This crate implements Raft consensus with support for encrypted logs and distributed cluster management.

§Architecture

The consensus layer consists of:

  • Raft Node: Core consensus implementation with leader election and log replication
  • Log Management: Persistent log with in-memory cache and compaction
  • State Management: Persistent and volatile state tracking
  • RPC Layer: Request/response messages for inter-node communication

§Example

use amaters_cluster::{RaftNode, RaftConfig, Command};

// Create a 3-node cluster
let config = RaftConfig::new(1, vec![1, 2, 3]);
let node = RaftNode::new(config)?;

// Propose a command (as leader)
let cmd = Command::from_str("SET key value");
let index = node.propose(cmd)?;

Re-exports§

pub use error::RaftError;
pub use error::RaftResult;
pub use log::Command;
pub use log::LogEntry;
pub use log::RaftLog;
pub use node::RaftNode;
pub use rpc::AppendEntriesRequest;
pub use rpc::AppendEntriesResponse;
pub use rpc::RequestVoteRequest;
pub use rpc::RequestVoteResponse;
pub use state::CandidateState;
pub use state::LeaderState;
pub use state::PersistentState;
pub use state::VolatileState;
pub use types::LogIndex;
pub use types::NodeId;
pub use types::NodeState;
pub use types::RaftConfig;
pub use types::Term;

Modules§

error
Error types for the Raft consensus module
log
Log management for Raft consensus
node
Main Raft node implementation
rpc
RPC message types for Raft consensus
state
Raft persistent and volatile state
types
Core types for Raft consensus

Constants§

NAME
Library name
VERSION
Library version