How dnmohanty/sharded-kv works
ShardedKV is a C++ key-value service: clients send line-based commands through a TCP proxy, which hashes each key to a backend; a backend applies SET/GET/DEL against its sharded in-memory store and persists mutations in a WAL. Backend restart replays that log, while background maintenance sweeps expired entries and compacts large logs. The graph preserves these workflows and the proxy’s health-based ring membership. Evidence is limited to the shown source excerpts and README; unsampled CLI details are represented only where documented.
Main entry points: Server.cpp Backend command server · Proxy.cpp TCP proxy · WAL.cpp Write-ahead log · ConsistentHash.cpp Consistent hash ring
Components 10
Entry points
- Interactive CLI
src/cli.cpp - Process entry
src/main.cpp
Routing and networking
- TCP proxy
src/Proxy.cpp - Consistent hash ring
src/ConsistentHash.cpp - Backend health checks
src/Proxy.cpp
Backend data path
- Backend command server
src/Server.cpp - Sharded TTL store
src/Store.cpp
Persistence and maintenance
- Write-ahead log
src/WAL.cpp - Sweep and compaction
src/Server.cpp
Other components
- TCP client
Connections 14
- TCP client → TCP proxy: sends commands
README.md - Interactive CLI → TCP proxy: connects to
README.md - Process entry → TCP proxy: starts proxy
src/main.cpp - Process entry → Backend command server: starts backend
src/main.cpp - TCP proxy → Consistent hash ring: routes keys
src/Proxy.cpp - Backend health checks → Consistent hash ring: updates membership
src/Proxy.cpp - TCP proxy → Backend command server: forwards commands
src/Proxy.cpp - Backend command server → Consistent hash ring: checks key owner
src/Server.cpp - Backend command server → Sharded TTL store: reads and mutates
src/Server.cpp - Backend command server → Write-ahead log: appends mutations
src/Server.cpp - Backend command server → Write-ahead log: recovers on startup
src/Server.cpp - Sweep and compaction → Sharded TTL store: sweeps expirations
src/Server.cpp - Sweep and compaction → Write-ahead log: compacts log
src/Server.cpp - Write-ahead log → Sharded TTL store: replays and snapshots
src/WAL.cpp