About the project
cobalt is an embedded key-value store in Zig: a database that runs inside a program and keeps data as pairs of a key and a value. It has an LSM (log-structured merge) design: fresh writes go to a skiplist (a sorted in-memory structure) backed by a WAL (a write-ahead log that protects data in a crash). They are then flushed to disk as immutable SSTable files, and the space left by old data is reclaimed by leveled compaction, which merges files level by level.
The challenge
An LSM store has to reconcile fast writes with reclaiming disk space. The hardest part was not losing data on the way between memory and disk: a write has to survive a crash before it reaches an SSTable file.