aki

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: BSD-3-Clause

README

aki

A modern, high-performance, low-latency database that speaks Redis on the wire and stores everything in a single file, the way SQLite does. aki (赤, "red" in Japanese, a nod to the colour Redis made famous) is to an in-memory key/value server what SQLite is to a client/server SQL database: you point any Redis client at it and it answers byte-for-byte like Redis, but underneath there is one .aki file, an optional write-ahead log sidecar, a buffer-pool pager, MVCC snapshots, and atomic crash-safe commits.

Redis is the API; SQLite is the file. aki implements the Redis command surface and the RESP2/RESP3 wire protocol on top of a single-file, write-ahead-logged, MVCC paged storage engine, so you get Redis compatibility and Redis latency with SQLite durability, SQLite operational simplicity, and larger-than-RAM datasets.

The design is captured in a detailed multi-document specification, and implementation notes track what has actually been built milestone by milestone.

Status

Early development. The storage substrate (the virtual-filesystem seam, CRC-32C checksums, the varint/record encoding, the single-file format, the pager and buffer pool, the write-ahead log, group commit, and crash recovery) is the M0 milestone and lands first; the Redis personality (RESP server, command dispatch, data types) follows on top of it.

Layout

  • vfs — the virtual-filesystem seam: open/read/write/sync/truncate over a named file, with an in-memory and a fault-injecting backend for crash testing.
  • checksum — CRC-32C (Castagnoli) used by the file header, page headers, and WAL frames.
  • encoding — varint (LEB128), zigzag, and fixed-width little-endian integer codecs.
  • format — the on-disk .aki format: the 16-byte magic, the file header, page types, the slotted page layout, and the double-buffered meta pages.
  • pager — the pager and buffer pool: page allocation, the freelist, pin/unpin, dirty write-back under WAL discipline.
  • wal — the write-ahead log, group commit, the fsync model, checkpointing, and crash recovery.
  • cmd/aki — the aki binary (server, cli, check, dump, import, bench).

Build

make build      # build bin/aki
make test       # go test ./...
make race       # go test -race ./...

Pure Go, no cgo. The file extension is .aki; sidecars are .aki-wal and .aki-shm.

License

BSD-3-Clause. aki is a clean-room reimplementation of the Redis wire protocol and semantics; it is not derived from Redis source.

Directories

Path Synopsis
Package bench holds the aki benchmark harness: the latency histogram the workload generator records into and the helpers that report percentiles.
Package bench holds the aki benchmark harness: the latency histogram the workload generator records into and the helpers that report percentiles.
Package btree implements a paged, ordered byte-string map on top of the pager.
Package btree implements a paged, ordered byte-string map on top of the pager.
Package checksum provides the CRC-32C (Castagnoli) checksum used throughout aki's on-disk format: the file header, every page header, the double-buffered meta pages, and every WAL frame (spec 2064 doc 02 §4, doc 03 §5, doc 04 §3).
Package checksum provides the CRC-32C (Castagnoli) checksum used throughout aki's on-disk format: the file header, every page header, the double-buffered meta pages, and every WAL frame (spec 2064 doc 02 §4, doc 03 §5, doc 04 §3).
cmd
aki command
Command aki is the aki server and toolbox.
Command aki is the aki server and toolbox.
Package command implements aki's command table and dispatch pipeline.
Package command implements aki's command table and dispatch pipeline.
Package encoding holds the byte-level integer codecs aki uses on disk and on the WAL (spec 2064 doc 02 §5, doc 04 §3).
Package encoding holds the byte-level integer codecs aki uses on disk and on the WAL (spec 2064 doc 02 §5, doc 04 §3).
Package format is the byte-level on-disk layout of the .aki file (spec 2064 doc 02).
Package format is the byte-level on-disk layout of the .aki file (spec 2064 doc 02).
Package keyspace is aki's logical key dictionary (spec 2064 doc 05).
Package keyspace is aki's logical key dictionary (spec 2064 doc 05).
Package networking drives the RESP codec over real connections.
Package networking drives the RESP codec over real connections.
Package pager is aki's single-file pager and buffer pool (spec 2064 doc 03).
Package pager is aki's single-file pager and buffer pool (spec 2064 doc 03).
Package rdb serializes and deserializes values in Redis RDB wire form.
Package rdb serializes and deserializes values in Redis RDB wire form.
Package resp implements the Redis Serialization Protocol in both its RESP2 and RESP3 variants.
Package resp implements the Redis Serialization Protocol in both its RESP2 and RESP3 variants.
Package respclient is a minimal blocking RESP client for talking to a running aki or Redis instance over the wire.
Package respclient is a minimal blocking RESP client for talking to a running aki or Redis instance over the wire.
Package vfs is the virtual-filesystem seam (spec 2064 doc 03, doc 23).
Package vfs is the virtual-filesystem seam (spec 2064 doc 03, doc 23).
Package wal is aki's write-ahead log (spec 2064 doc 04).
Package wal is aki's write-ahead log (spec 2064 doc 04).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL