Crash-safe page store
A file of 4 KiB pages. Commits write the inactive meta page last and fsync it, so a crash always leaves one valid root to recover from.
A relational database built from scratch in Go. A crash-safe page store, a copy-on-write B+tree, transactions, SQL and vector search, served to Rust and C++ through a stable C ABI.
Every layer is written from the page up, with tests against an in-memory oracle. No borrowed storage engine, no magic.
A file of 4 KiB pages. Commits write the inactive meta page last and fsync it, so a crash always leaves one valid root to recover from.
Lookups, ordered range scans, splits and merges. A mutation never touches a committed page; freed pages return through a persistent free list.
BEGIN, COMMIT, ROLLBACK. Writes are buffered and published as one batch behind a single meta-page flip.
Hand-written lexer and recursive-descent parser. Filters, ORDER BY, LIMIT, aggregates, GROUP BY / HAVING, primary keys, UNIQUE, NOT NULL and defaults.
Fixed-dimension VECTOR(n) columns and distance functions, so you can rank rows by similarity right in SQL.
A handle-based C ABI with clear memory ownership, wrapped by a safe Rust crate and an RAII C++ client. Each has its own CLI.
Orders travel down, results report up. Each layer owns one job and trusts the one beneath it.
cmd/ · capi/ · clients/SQL REPL, C ABI, Rust and C++ wrappersengine/sqlLexer, parser, catalog, executorengine/dbDurable KV facade, BEGIN / COMMIT / ROLLBACKengine/btreeCopy-on-write nodes, search, insert, deleteengine/pagerFixed-size pages, meta pages, fsyncRequires Go 1.24+. Rust and a C++20 toolchain are only needed for the clients.
# clone, test and start the SQL shell
git clone https://github.com/Youssef-joe/SoldierDB
cd SoldierDB
make test
make runCREATE TABLE users ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, age INTEGER); INSERT INTO users VALUES (1, 'Ada', 36), (2, 'Grace', 45); SELECT name, age FROM users WHERE age > 40;
CREATE TABLE docs (id INTEGER PRIMARY KEY, embedding VECTOR(3)); SELECT id FROM docs ORDER BY cosine_distance(embedding, VECTOR(1, 0, 0)) LIMIT 10;
# fmt check, Go tests, then the C, Rust and C++ clients make check # or build just the shared library + header make shared
Ground taken and the objectives ahead. The full plan lives in ROADMAP.md.
soldierdb serve