Hasty Briefsbeta

Bilingual

Filedb: Disk Based Key-Value Store Inspired by Bitcask

a year ago
  • #Zig
  • #database
  • #Bitcask
  • FileDB is a Zig-implementation of Bitcask, inspired by the Riak1 paper.
  • It stores record metadata in a log-structured hashtable and keeps one disk file open for appending records.
  • On restarts or when MAX_FILE_REACHED, the disk file is rotated, with old files kept open for reading only.
  • Compaction runs periodically to combine disk files into one and update the metadata hashtable.
  • Sync process syncs open disk files at configurable intervals or on every request if configured.
  • Metadata allows O(1) record fetching by tracking exact file and position.
  • In-memory metadata is constant size, regardless of record value size.
  • High throughput is achieved via append-only mode.
  • Provides functions like init, deinit, put, get, delete, list, sync, storeHashMap, and loadKeyDir.
  • Includes a Redis-compatible client with demonstrated performance benchmarks.
  • Benchmarks show high throughput for set and get operations.
  • References to Zig programming resources are provided.