How tejas544/distributed-kv works
Anvil combines a distributed key-value database with its deterministic simulation-testing harness. A workload issues client operations; the simulator runs the cluster against controlled time, network, disk, and process behavior, while protocol invariants and transactional-history checking detect failures and the minimiser reduces fault schedules. The database path spans range routing, shard storage, transaction coordination, MVCC, Raft, and LSM persistence. README-described capabilities are included even where implementation files were not sampled; edges relying on those descriptions cite the README.
Main entry points: store.cc Shard store · simulation.h Simulation runner · txn_bank.cc Transaction workload · coordinator.cc Transaction coordinator
Components 20
Database
- Range cache
anvil/core/shard/router.cc - Shard store
anvil/core/shard/store.cc - Placement and topology
anvil/core/shard/topology.cc - Transaction coordinator
anvil/core/txn/coordinator.cc - Transaction store
anvil/core/txn/store.cc - MVCC and locks
anvil/core/mvcc/mvcc.cc
Storage and consensus
- Raft consensus
anvil/core/raft/raft.cc - Raft persistence
anvil/core/raft/storage.cc - LSM database
anvil/core/lsm/db.cc - Write-ahead log
anvil/core/lsm/wal.h
Deterministic simulation
- Runtime seam
anvil/core/runtime/runtime.h - Simulation runner
anvil/sim/simulation.h - Virtual scheduler
anvil/sim/scheduler.cc - Fault models
anvil/sim/disk_model.cc
Verification
- Protocol invariants
anvil/checker/raft_invariants.cc - History checker
anvil/checker/elle.cc - Fault minimiser
anvil/sim/minimiser.cc
Workloads
- Transaction workload
workloads/txn_bank.cc - Shard workload
workloads/shard_kv.cc
Other components
- Client
Connections 21
- Client → Range cache: routes requests
- Range cache → Shard store: targets ranges
- Shard workload → Shard store: exercises shards
- Transaction workload → Transaction coordinator: issues transactions
workloads/txn_bank.cc - Transaction workload → Shard store: creates store
workloads/txn_bank.cc - Transaction coordinator → Shard store: coordinates operations
- Transaction coordinator → Transaction store: uses transaction records
- Shard store → MVCC and locks: serves MVCC
- Placement and topology → Shard store: manages ranges
- Shard store → Raft consensus: replicates ranges
- Raft consensus → Raft persistence: persists state
- Raft persistence → Write-ahead log: uses WAL framing
anvil/core/raft/storage.cc - LSM database → Write-ahead log: logs writes
- Runtime seam → Simulation runner: abstracts execution
anvil/core/runtime/runtime.h - Simulation runner → Virtual scheduler: runs scheduled events
- Simulation runner → Fault models: injects modeled faults
- Simulation runner → Transaction workload: runs workload
- Simulation runner → Protocol invariants: checks protocol state
- Transaction workload → History checker: checks recorded history
- Simulation runner → Fault minimiser: minimises failures
- Protocol invariants → Raft consensus: examines Raft state