| Crates.io | amaters-cluster |
| lib.rs | amaters-cluster |
| version | 0.1.0 |
| created_at | 2026-01-19 01:07:27.207288+00 |
| updated_at | 2026-01-19 01:07:27.207288+00 |
| description | Consensus layer for AmateRS (Ukehi) |
| homepage | |
| repository | https://github.com/cool-japan/amaters |
| max_upload_size | |
| id | 2053430 |
| size | 151,366 |
Consensus layer for AmateRS (Ukehi - The Sacred Pledge)
amaters-cluster implements distributed consensus and cluster management for AmateRS using the Ukehi component. It ensures data consistency and fault tolerance across multiple nodes using Raft consensus with encrypted log entries.
Cluster
┌──────────────────────────┐
│ [Ukehi - Consensus] │
│ │
┌────┴────┐ ┌────────┐ ┌────┴────┐
│ Leader │ │Follower│ │Follower │
│ Node 1 │←→│ Node 2 │←→│ Node 3 │
└────┬────┘ └────────┘ └────┬────┘
│ │
┌────▼────┐ ┌────▼────┐
│ Shard A │ │ Shard B │
│ Keys │ │ Keys │
│ 0-50% │ │ 50-100% │
└─────────┘ └─────────┘
use amaters_cluster::{Cluster, Node, Config};
// Create a 3-node cluster
let config = Config {
node_id: "node-1",
peers: vec!["node-2:7878", "node-3:7878"],
data_dir: "/var/lib/amaters",
};
let node = Node::new(config).await?;
node.start().await?;
// Cluster operations
if node.is_leader().await? {
// Perform leader operations
node.propose_entry(entry).await?;
}
[cluster]
node_id = "node-1"
peers = ["node-2:7878", "node-3:7878"]
[raft]
election_timeout_ms = 1000
heartbeat_interval_ms = 100
max_log_entries = 10000
snapshot_interval = 1000
[sharding]
num_shards = 16
rebalance_threshold = 0.2 # 20% imbalance
split_threshold_mb = 512
merge_threshold_mb = 64
| Cluster Size | Max Failures | Quorum |
|---|---|---|
| 3 nodes | 1 failure | 2 |
| 5 nodes | 2 failures | 3 |
| 7 nodes | 3 failures | 4 |
Formula: Quorum = (N + 1) / 2
# Run unit tests
cargo test
# Chaos tests (simulate failures)
cargo test --test chaos -- --ignored
# Benchmarks
cargo bench
raft - Raft consensus libraryamaters-core - Core types and storageamaters-net - Network communicationtokio - Async runtimeLicensed under MIT OR Apache-2.0
COOLJAPAN OU (Team KitaSan)