How nitin27pro/distributed-key-value-store works
This is a C++ distributed key-value store: clients issue text commands to a primary, which serves reads locally and synchronously replicates writes to healthy backups before acknowledging them. Sequence-numbered WALs support restart replay and replica catch-up; a health monitor retries recovery while the primary remains online. The repository also includes an earlier standalone TCP server in kv_server_week4.cpp, separate from the replicated runtime. Relationships reflect the excerpts and README; unsampled details are omitted.
Main entry points: primary_node.cpp Command handler · backup_node.cpp Backup protocol · kv_server_week4.cpp Standalone server
Components 15
Primary runtime
- Primary server
primary_node.cpp - Command handler
primary_node.cpp - Primary LRU
primary_node.cpp - Primary WAL
primary_node.cpp - Replication manager
primary_node.cpp - Health monitor
primary_node.cpp
Replica runtime
- Backup server
backup_node.cpp - Backup protocol
backup_node.cpp - Backup LRU
backup_node.cpp - Backup WAL
backup_node.cpp
Standalone server
- Standalone server
kv_server_week4.cpp - Command handler
kv_server_week4.cpp - LRU engine
kv_server_week4.cpp
Other components
- Client
- Client
Connections 16
- Client → Primary server: sends commands
README.md - Primary server → Command handler: dispatches
README.md - Command handler → Primary LRU: serves reads
primary_node.cpp - Command handler → Replication manager: replicates writes
primary_node.cpp - Command handler → Primary LRU: applies writes
primary_node.cpp - Command handler → Primary WAL: appends writes
primary_node.cpp - Health monitor → Replication manager: drives recovery
primary_node.cpp - Replication manager → Primary WAL: reads catch-up entries
README.md - Replication manager → Backup server: sends SEQWRITE
README.md - Health monitor → Backup server: probes GETSEQ
primary_node.cpp - Backup server → Backup protocol: handles connections
backup_node.cpp - Backup protocol → Backup LRU: applies writes
backup_node.cpp - Backup protocol → Backup WAL: persists writes
backup_node.cpp - Client → Standalone server: connects over TCP
kv_server_week4.cpp - Standalone server → Command handler: dispatches lines
kv_server_week4.cpp - Command handler → LRU engine: reads and writes
kv_server_week4.cpp