Builds

13 repos

Showing 13 of 13 projects

Screenshot of Golphin

~/builds/golphin

07WIP

Golphin

A key-value database built from scratch in Go

Source

Golphin is a learning project to understand how databases work by building one by hand in Go. It is currently a Bitcask-shaped key-value store: append-only segment files on disk, an in-memory index from key to location, and compaction by copying live records into a fresh segment and renaming it.

The code is layered as cli -> db -> {index, segments} -> fs, where segments own raw byte storage and the index owns key-to-location lookups, with Db as the only component that knows both. The index was recently rebuilt from a plain binary search tree onto a hand-written generic AVL tree, since a plain BST degenerates on sorted key inserts; benchmarks are tracked in CI on every push. The stated long-term goal is an embedded, SQLite-shaped relational database once ordered range scans over the storage engine are solid.

Highlights

  • Append-only segmented log storage with copy-and-rename compaction
  • In-memory index rebuilt on a hand-written generic AVL tree, replacing an earlier plain BST
  • Index snapshots persisted to disk with a marker-verified recovery fallback
  • Ordered range queries over the index, with benchmarks tracked in CI and published to a public dashboard
  • Roadmap (per project docs) targets a TUI, a background daemon, and eventually an embedded SQL engine