Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.28 KB

File metadata and controls

29 lines (22 loc) · 1.28 KB

Persist

  • A log-structured key-value storage engine, written in C, inspired by Riak's Bitcask paper
  • Designed to store variable-length key-value pairs
  • Supports the following operations: put, get, delete

How it works

  • Key-value pairs are represented as byte-arrays, and stored on disk for persistence A disk entry
  • Keys are additionally stored in an in-memory hashtable (keydir) for quick lookups Working of a lookup
  • All writes are append-only operations, to minimize IOs
  • Deletes create tombstones, which are cleaned up by the merge operation
  • Each persist directory contains a .metadata file to keep track of the latest file being written to

Usage

  • make persist - creates the persist binary
  • open <dirname> - opens a persist directory
  • put <key> <value> - stores key-value pair
  • get <key> - retrieves the value for a key
  • delete <key> - deletes key-value pair
  • merge - removes stale entries from the directory
  • exit - stops the storage engine

Credit

  • Images taken shamelessly from the Bitcask paper and from Arpit Bhayani's blog