How l4l4a/distributed-kv-store works
This is an in-memory distributed key-value store exposed through an HTTP API. Clients set, get, and delete keys; the cluster coordinates placement and replication through a consistent-hash ring, while reads can fall back to replicas. Separate API capabilities expose health and node details and allow simulating node failures or revivals. The source excerpts show the HTTP handlers, cluster operations, ring placement, and per-node maps; they do not show networked nodes or durable storage, so neither is represented.
Main entry points: node.ts Cluster Operations · index.ts HTTP Routes · ring.ts Hash Ring
Components 7
HTTP API
- HTTP Routes
src/index.ts
Cluster Coordination
- Cluster Operations
src/node.ts - Entry Index
src/node.ts - Cluster Types
src/types.ts
Placement and Storage
- Hash Ring
src/ring.ts - Node Data Maps
src/node.ts
Other components
- Client
Connections 6
- Client → HTTP Routes: sends requests
README.md - HTTP Routes → Cluster Operations: delegates operations
src/index.ts - Cluster Operations → Hash Ring: resolves placement
src/node.ts - Cluster Operations → Node Data Maps: reads and writes
src/node.ts - Cluster Operations → Entry Index: tracks entries
src/node.ts - Hash Ring → Node Data Maps: selects node owners
src/node.ts