{"id":25173147,"url":"https://github.com/ckampfe/bc2","last_synced_at":"2025-04-03T22:43:28.707Z","repository":{"id":273433328,"uuid":"919711022","full_name":"ckampfe/bc2","owner":"ckampfe","description":"Yet another Bitcask implementation.","archived":false,"fork":false,"pushed_at":"2025-01-25T22:21:23.000Z","size":338,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T10:31:32.182Z","etag":null,"topics":["bitcask","database","elixir"],"latest_commit_sha":null,"homepage":"https://en.wikipedia.org/wiki/Bitcask","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ckampfe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-20T21:36:54.000Z","updated_at":"2025-01-31T17:50:58.000Z","dependencies_parsed_at":"2025-01-20T22:48:43.814Z","dependency_job_id":"5c1bc800-b14e-4338-90ef-39a6354c4afc","html_url":"https://github.com/ckampfe/bc2","commit_stats":null,"previous_names":["ckampfe/bc2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fbc2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fbc2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fbc2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fbc2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckampfe","download_url":"https://codeload.github.com/ckampfe/bc2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247092374,"owners_count":20882217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcask","database","elixir"],"created_at":"2025-02-09T10:30:06.791Z","updated_at":"2025-04-03T22:43:28.690Z","avatar_url":"https://github.com/ckampfe.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bc2\n\n[![Elixir CI](https://github.com/ckampfe/bc2/actions/workflows/elixir.yml/badge.svg)](https://github.com/ckampfe/bc2/actions/workflows/elixir.yml)\n\nYet another [Bitcask](https://en.wikipedia.org/wiki/Bitcask) implementation.\n\n## What\n\n[The paper](bitcask-intro.pdf) describes Bitcask as \"A Log-Structured Hash Table for Fast Key/Value Data\".\n\nIn other words, Bitcask is a key-value database where values are appended to files on disk,\nand an in-memory hash table contains pointers to the locations of those on-disk values.\n\nThis conceptual model has some compelling attributes:\n- it is simple to understand (the paper is very short)\n- it is simple to implement (really: go look at the code)\n- it has low read and write latency\n- its performance is predictable\n- readers and writers do not block each other\n\n## Example\n\n```elixir\ndirectory = \".\"\n# open a new (or existing) database\n:ok = Bc2.new(directory)\n\n# store a key-value pair\n:ok = Bc2.put(directory, :hello, :world)\n\n# read a value for a given key\n{:ok, :world} = Bc2.fetch(directory, :hello)\n\n# delete the value stored at a key\n:ok = Bc2.delete(directory, :hello)\n\n# the key (and value) are deleted\n{:error, :not_found} = Bc2.fetch(directory, :hello)\n```\n\n## A little more detail\n\nBitcask works by storing the location of on-disk key-value pairs in an in-memory hash table.\n\nFor reads, you have a key \"hello\".\nYou want to know what value \"hello\" points to.\nYou look up \"hello\" in the in-memory hash table.\nIt gives you a file and a byte location in that file.\nYou read those bytes from that file and they say \"world\".\n\nFor writes, you want to store the value \"world\" associated with the key \"hello\".\nYou append \"world\" and some metadata to a file.\nWhen appending to that file completes, you insert the file id and the byte location of that\nappend in that file into the in-memory hash table at the key \"hello\".\n\nDeletes are just like writes, but you write a special tombstone value instead of a real value.\n\nIn Bitcask, all disk write operations are append-only, so files only grow.\nThis is not ideal long term, so there is a special merge process\nthat goes through all database files and writes new files that only contain\nlive data.\n\nThere's more to it, but that's basically how reads, writes, and deletes work in Bitcask.\n\nSee [the paper](bitcask-intro.pdf).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fbc2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckampfe%2Fbc2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fbc2/lists"}