Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? The landing page stays open — purchase unlocks this gym.

advanced · order 172

Single-node KV + WAL sketch

design-kv-01Related book chapters: 26, 27 (optional — this page is complete on its own)system-design

Slug: design-kv-01 · Paired reading: Chapters 26 and 27

Prompt

struct Kv { wal: Vec<(String,String)>, map: HashMap<String,String> }set appends WAL then map; get from map; fn recover(wal) -> Kv.

Contract

  • set appends one WAL record then updates the map (last write wins for get)
  • recover(wal) rebuilds the map from wal without re-appending WAL entries (restored.wal == wal)
  • Missing keys → None