forked from whispem/minikv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
83 lines (77 loc) · 2.64 KB
/
Copy pathlib.rs
File metadata and controls
83 lines (77 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! # minikv
//!
//! A production-grade distributed key-value store with:
//! - Raft consensus for coordinator high availability
//! - Write-ahead log (WAL) for durability
//! - Automatic compaction and rebalancing
//! - gRPC for internal coordination, HTTP for public API
//! - Bloom filters and index snapshots for performance
//!
//! ## Architecture
#![allow(clippy::result_large_err)]
//!
//! ```text
//! ┌─────────────────────────────────────────┐
//! │ Coordinator Cluster │
//! │ (Raft consensus for metadata) │
//! │ - Leader: handles writes │
//! │ - Followers: replicate state │
//! └───────────┬─────────────────────────────┘
//! │ gRPC
//! ┌─────────┴──────────┬──────────────┐
//! │ │ │
//! ┌─▼─────────┐ ┌─────▼──────┐ ┌──▼───────────┐
//! │ Volume 1 │ │ Volume 2 │ │ Volume 3 │
//! │ (Shard A) │ │ (Shard B) │ │ (Shard C) │
//! │ + WAL │ │ + WAL │ │ + WAL │
//! └────────────┘ └────────────┘ └──────────────┘
//! ```
//!
//! ## Usage
//!
//! ### Start a coordinator
//! ```bash
//! minikv-coord serve \
//! --id coord-1 \
//! --bind 0.0.0.0:5000 \
//! --db ./coord-data \
//! --peers coord-2:5001,coord-3:5002
//! ```
//!
//! ### Start a volume server
//! ```bash
//! minikv-volume serve \
//! --id vol-1 \
//! --bind 0.0.0.0:6000 \
//! --data ./vol-data \
//! --coordinator http://localhost:5000
//! ```
//!
//! ### Use the CLI
//! ```bash
//! # Put a blob
//! minikv put my-key --file ./data.bin --coordinator http://localhost:5000
//!
//! # Get a blob
//! minikv get my-key --output ./out.bin
//!
//! # Delete
//! minikv delete my-key
//!
//! # Ops commands
//! minikv verify --deep
//! minikv repair --replicas 3
//! minikv compact --shard 0
//! ```
pub mod common;
pub mod coordinator;
pub mod ops;
pub mod volume;
pub use common::{Config, Error, Result};
pub use coordinator::Coordinator;
pub use volume::VolumeServer;
pub mod proto {
tonic::include_proto!("minikv");
}
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const BUILD_INFO: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("CARGO_PKG_NAME"), ")");