1313<p align =" center " >
1414 <a href =" https://github.com/ApiliumCode/aingle/actions/workflows/ci.yml " ><img src =" https://github.com/ApiliumCode/aingle/actions/workflows/ci.yml/badge.svg " alt =" Build Status " ></a >
1515 <a href =" ./LICENSE " ><img src =" https://img.shields.io/badge/License-Apache%202.0-blue.svg " alt =" License " ></a >
16- <a href =" https://www.rust-lang.org/ " ><img src =" https://img.shields.io/badge/rust-1.70%2B-orange.svg " alt =" Rust " ></a >
16+ <a href =" https://www.rust-lang.org/ " ><img src =" https://img.shields.io/badge/rust-1.83%2B-orange.svg " alt =" Rust " ></a >
17+ <a href =" https://github.com/ApiliumCode/mayros " ><img src =" https://img.shields.io/badge/Powers-Mayros%20AI-blueviolet?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0id2hpdGUiPjxwYXRoIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0wIDNjMS42NiAwIDMgMS4zNCAzIDNzLTEuMzQgMy0zIDMtMy0xLjM0LTMtMyAxLjM0LTMgMy0zem0wIDE0LjJjLTIuNSAwLTQuNzEtMS4yOC02LTMuMjIuMDMtMS45OSA0LTMuMDggNi0zLjA4IDEuOTkgMCA1Ljk3IDEuMDkgNiAzLjA4LTEuMjkgMS45NC0zLjUgMy4yMi02IDMuMjJ6Ii8+PC9zdmc+ " alt =" Powers Mayros AI " ></a >
1718</p >
1819
1920<p align =" center " >
@@ -156,6 +157,73 @@ Interactive D3.js dashboard. Watch your DAG evolve in real-time. Filter, search,
156157
157158---
158159
160+ ## Clustering
161+
162+ AIngle supports multi-node clustering via Raft consensus for high availability and horizontal scalability. Writes are replicated to all nodes; reads can be served from any node with optional quorum consistency.
163+
164+ ### Quick Start (3-node cluster)
165+
166+ ``` bash
167+ # Node 1 — bootstrap leader
168+ aingle-cortex --port 8081 \
169+ --cluster --cluster-node-id 1 \
170+ --cluster-secret " your-secret-at-least-16-chars" \
171+ --cluster-wal-dir ./data/node1/wal \
172+ --db-path ./data/node1/graph.sled
173+
174+ # Node 2 — joins via node 1
175+ aingle-cortex --port 8082 \
176+ --cluster --cluster-node-id 2 \
177+ --cluster-peers 127.0.0.1:8081 \
178+ --cluster-secret " your-secret-at-least-16-chars" \
179+ --cluster-wal-dir ./data/node2/wal \
180+ --db-path ./data/node2/graph.sled
181+
182+ # Node 3 — joins via node 1
183+ aingle-cortex --port 8083 \
184+ --cluster --cluster-node-id 3 \
185+ --cluster-peers 127.0.0.1:8081 \
186+ --cluster-secret " your-secret-at-least-16-chars" \
187+ --cluster-wal-dir ./data/node3/wal \
188+ --db-path ./data/node3/graph.sled
189+ ```
190+
191+ ### With TLS encryption
192+
193+ ``` bash
194+ # Auto-generated self-signed certs (development)
195+ aingle-cortex --port 8081 --cluster --cluster-node-id 1 \
196+ --cluster-secret " your-secret" --cluster-tls
197+
198+ # Custom certificates (production)
199+ aingle-cortex --port 8081 --cluster --cluster-node-id 1 \
200+ --cluster-secret " your-secret" --cluster-tls \
201+ --cluster-tls-cert /path/to/cert.pem \
202+ --cluster-tls-key /path/to/key.pem
203+ ```
204+
205+ ### Cluster endpoints
206+
207+ | Endpoint | Method | Description |
208+ | ----------| --------| -------------|
209+ | ` /api/v1/cluster/status ` | GET | Node role, leader ID, current term |
210+ | ` /api/v1/cluster/members ` | GET | All cluster members and their state |
211+ | ` /api/v1/cluster/join ` | POST | Add a new node to the cluster |
212+ | ` /api/v1/cluster/leave ` | POST | Gracefully remove a node |
213+ | ` /api/v1/cluster/wal/stats ` | GET | WAL segment count and disk usage |
214+ | ` /api/v1/cluster/wal/verify ` | POST | Verify WAL integrity (checksums) |
215+
216+ ### Features
217+
218+ - ** Raft consensus** — automatic leader election, log replication, and membership changes
219+ - ** Streaming snapshots** — 512KB chunked transfer with per-chunk ACK for large datasets
220+ - ** Write-Ahead Log** — crash-safe durability with segment rotation and integrity verification
221+ - ** TLS encryption** — optional TLS for inter-node communication (self-signed or custom certs)
222+ - ** Constant-time auth** — cluster secret verified with timing-safe comparison
223+ - ** Quorum reads** — optional strong consistency for read operations
224+
225+ ---
226+
159227## Architecture
160228
161229```
@@ -177,6 +245,12 @@ Interactive D3.js dashboard. Watch your DAG evolve in real-time. Filter, search,
177245│ │ Graph │ │ Engine │ │ (Privacy) │ │ Runtime │ │
178246│ └──────────────┘ └──────────────┘ └──────────────┘ └───────────┘ │
179247├────────────────────────────────────────────────────────────────────────┤
248+ │ CONSENSUS LAYER │
249+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
250+ │ │ Raft │ │ WAL │ │ Streaming │ │ TLS │ │
251+ │ │ (openraft) │ │ (Durability) │ │ Snapshots │ │ (mTLS) │ │
252+ │ └──────────────┘ └──────────────┘ └──────────────┘ └───────────┘ │
253+ ├────────────────────────────────────────────────────────────────────────┤
180254│ NETWORK LAYER │
181255│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
182256│ │ Kitsune P2P │ │ CoAP │ │ Gossip │ │ mDNS │ │
@@ -199,6 +273,9 @@ cd aingle
199273# Build
200274cargo build --workspace --release
201275
276+ # Build with clustering support
277+ cargo build -p aingle_cortex --features cluster --release
278+
202279# Test
203280cargo test --workspace
204281
@@ -208,7 +285,7 @@ cargo doc --workspace --no-deps --open
208285
209286### Prerequisites
210287
211- - ** Rust** 1.70 or later
288+ - ** Rust** 1.83 or later
212289- ** libsodium-dev** (cryptography)
213290- ** libssl-dev** (TLS)
214291- ** pkg-config**
@@ -264,6 +341,13 @@ cargo doc --workspace --no-deps --open
264341| ` aingle_logic ` | Prolog-style reasoning engine |
265342| ` aingle_graph ` | Semantic graph database |
266343
344+ ### Clustering & Consensus
345+
346+ | Component | Purpose |
347+ | -----------| ---------|
348+ | ` aingle_raft ` | Raft consensus (leader election, log replication, streaming snapshots) |
349+ | ` aingle_wal ` | Write-Ahead Log for crash-safe durability |
350+
267351### Security & Privacy
268352
269353| Component | Purpose |
0 commit comments