{"repo":"elliotchenzichang/tiny-bitcask","free":true,"listed":false,"github":"https://github.com/elliotchenzichang/tiny-bitcask","clone":"git clone https://github.com/elliotchenzichang/tiny-bitcask.git","description":"build a tiny kv store base on Bitcask","language":"Go","stars":45,"topics":["bitcask","go","kvstore","database"],"license":null,"category":"databases-storage","readme_excerpt":"tiny-bitcask tiny-bitcask is a small Bitcask-style key/value store in Go: one active append-only data file per directory, an in-memory keydir (hash map) pointing at the latest record per key, and optional merge to drop stale records and reclaim space. Using the database Add this module to your go.mod . From the repository root you can run the bundled example: Minimal program: open a store on a directory, Set / Get bytes, then Close . The same source lives at cmd/demo/main.go . Could clone this repo and give it a try. --- Design (aligned with the paper) Idea Role in this project ------ ---------------------- Append-only active file Writes go to ActiveFile ; when size exceeds SegmentSize , the file is sealed and a new active file is opened ( storage/datafiles.go ). Hint files After rotation, each sealed fid.dat can have a compact fid.hint for faster recovery; invalid or missing hints fall back to scanning the data file ( storage/hint.go , db.go recovery). Keydir index.KeyDir maps string key → DataPosition (file id, offset, key/value sizes, timestamp). Read path One hash lookup + one ReadAt by (fid, offset, length) ; optional CRC32 verification on read ( Options.VerifyCRC , default true ). Merge / compaction Scans immutable files and rewrites entries that are still the live version into the active file, then deletes merged files ( DB.Merge ). Live vs. stale is decided by comparing the keydir’s (fid, offset) to the start offset of each record while scanning. Tombstone delete Dele","default_branch":null,"files":null,"tree":[],"storefront":"/r/elliotchenzichang","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/elliotchenzichang/tiny-bitcask/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}