mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-30 12:13:34 +00:00
docs: Add usage examples for distributed systems crates
Add Rust code examples showing how to use: - ruvector-raft: 5-node Raft cluster configuration - ruvector-cluster: Consistent hash ring with auto-sharding - ruvector-replication: SemiSync multi-master replication 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
526a9c39c9
commit
f67705e8f0
1 changed files with 28 additions and 0 deletions
28
README.md
28
README.md
|
|
@ -129,6 +129,34 @@ let enhanced = layer.forward(&query, &neighbors, &weights);
|
|||
| **Snapshots** | Point-in-time backups, incremental | Disaster recovery |
|
||||
| **Cluster Metrics** | Prometheus-compatible monitoring | Observability at scale |
|
||||
|
||||
```bash
|
||||
cargo add ruvector-raft ruvector-cluster ruvector-replication
|
||||
```
|
||||
|
||||
```rust
|
||||
use ruvector_raft::{RaftNode, RaftNodeConfig};
|
||||
use ruvector_cluster::{ClusterManager, ConsistentHashRing};
|
||||
use ruvector_replication::{SyncManager, SyncMode};
|
||||
|
||||
// Configure a 5-node Raft cluster
|
||||
let config = RaftNodeConfig {
|
||||
node_id: "node-1".into(),
|
||||
cluster_members: vec!["node-1", "node-2", "node-3", "node-4", "node-5"]
|
||||
.into_iter().map(Into::into).collect(),
|
||||
election_timeout_min: 150, // ms
|
||||
election_timeout_max: 300, // ms
|
||||
heartbeat_interval: 50, // ms
|
||||
};
|
||||
let raft = RaftNode::new(config);
|
||||
|
||||
// Auto-sharding with consistent hashing (150 virtual nodes per real node)
|
||||
let ring = ConsistentHashRing::new(64, 3); // 64 shards, replication factor 3
|
||||
let shard = ring.get_shard("my-vector-key");
|
||||
|
||||
// Multi-master replication with conflict resolution
|
||||
let sync = SyncManager::new(SyncMode::SemiSync { min_replicas: 2 });
|
||||
```
|
||||
|
||||
### AI & ML
|
||||
|
||||
| Feature | What It Does | Why It Matters |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue