{"id":23394835,"url":"https://github.com/dineshgowda24/bitcask-rb","last_synced_at":"2025-04-11T12:54:11.879Z","repository":{"id":65898508,"uuid":"582108504","full_name":"dineshgowda24/bitcask-rb","owner":"dineshgowda24","description":"📁 Build your own fast, persistent KV store(Based on bitcask paper) ","archived":false,"fork":false,"pushed_at":"2022-12-28T18:09:34.000Z","size":1087,"stargazers_count":64,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T09:12:02.582Z","etag":null,"topics":["bitcask","bitcask-like","database","keyvalue-db","keyvaluestore","ruby"],"latest_commit_sha":null,"homepage":"https://dineshgowda.com/posts/build-your-own-persistent-kv-store/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dineshgowda24.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-25T17:56:18.000Z","updated_at":"2025-03-18T19:27:31.000Z","dependencies_parsed_at":"2023-02-15T05:25:33.843Z","dependency_job_id":null,"html_url":"https://github.com/dineshgowda24/bitcask-rb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshgowda24%2Fbitcask-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshgowda24%2Fbitcask-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshgowda24%2Fbitcask-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshgowda24%2Fbitcask-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dineshgowda24","download_url":"https://codeload.github.com/dineshgowda24/bitcask-rb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248403916,"owners_count":21097615,"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","bitcask-like","database","keyvalue-db","keyvaluestore","ruby"],"created_at":"2024-12-22T06:18:18.115Z","updated_at":"2025-04-11T12:54:11.855Z","avatar_url":"https://github.com/dineshgowda24.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bitcask-rb: A Log-Structured Hash Table for Fast Key/Value Data\n\n[![Ruby](https://img.shields.io/badge/ruby-3.1.1-brightgreen)](https://www.ruby-lang.org/en/)\n[![BDD](https://img.shields.io/badge/rspec-3.1-green)](https://rspec.info/)\n[![Ruby Style Guide](https://img.shields.io/badge/code%20style-rubocop-red)](https://github.com/rubocop/rubocop)\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/dineshgowda24/bitcask-rb/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/dineshgowda24/bitcask-rb/tree/main)\n[![codecov](https://codecov.io/gh/dineshgowda24/bitcask-rb/branch/main/graph/badge.svg?token=HY8IQSEKCA)](https://codecov.io/gh/dineshgowda24/bitcask-rb)\n[![DeepSource](https://deepsource.io/gh/dineshgowda24/bitcask-rb.svg/?label=active+issues\u0026token=aISrLFG-Rwka_9MMiZixX_NT)](https://deepsource.io/gh/dineshgowda24/bitcask-rb/?ref=repository-badge)\n\n\u003cimg src=\"image.png\"/\u003e\n\nFast, Persistent key/value store based on [bitcask paper](https://riak.com/assets/bitcask-intro.pdf) written in Ruby.\nAn attempt to understand and build our persistent key/value store capable of storing data enormous than the RAM. This, in any way, is not intended for production. For simplicity, implementation has ignored a few specifications from the paper.\n\n## Prerequisites\n\n- Ruby\n- bundler\n\n## Setup\n\n```shell\nbundle install\n```\n\n## Usage\n\n```ruby\ndb_store = Bitcask::DiskStore.new('bitcask.db')\n\n# Setting values in store using put or hash style\ndb_store.put(\"Anime\", \"One Piece\")\ndb_store[\"Luffy\"] = \"Straw Hat\"\ndb_store[2020] = \"Leap Year\"\ndb_store.put(\"pie\", 3.1415)\n\n# Getting values from store using get or hash style\ndb_store[\"Anime\"]\ndb_store.get(\"Luffy\")\ndb_store[\"pie\"]\ndb_store.get(2020)\n\n# Listing keys\ndb_store.keys\n\n# Size of the store\ndb_store.store\n```\n\n## Tests\n\n```shell\nbundle exec rspec\n```\n\n## Advantages\n\n- Simple yet powerful\n- Easy to use\n- Store data enormous than RAM\n- Data file is OS agnostic\n- Portable\n- Faster read/writes\n- Minimal dependecies\n\n## Features\n\n| Feature                               | Support            |\n|---------------------------------------|--------------------|\n| Persisted in disk                     | :white_check_mark: |\n| Get API                               | :white_check_mark: |\n| Put API                               | :white_check_mark: |\n| Int, Float and String for k/v         | :white_check_mark: |\n| CRC                                   | :white_check_mark: |\n| Directory Support                     | :x:                |\n| Delete API                            | :x:                |\n| Files Merge and LSM Trees             | :x:                |\n\n## Benchmarks\n\n### CPU Cycles\n\n```ruby\nBenchmarked with value_size of 78 bytes\n                                                         user     system      total        real\nDiskStore.put : 10k records                          0.026963   0.018983   0.045946 (  0.046078)\nDiskStore.get : 10k records                          0.031211   0.009727   0.040938 (  0.041154)\nDiskStore.put : 100k records                         0.367399   0.196536   0.563935 (  0.566659)\nDiskStore.get : 100k records                         0.313556   0.102338   0.415894 (  0.416280)\nDiskStore.put : 1M records                           4.649307   2.209731   6.859038 (  6.887667)\nDiskStore.get : 1M records                           3.357120   1.047637   4.404757 (  4.409732)\navg_put:                                             0.000005   0.000002   0.000007 (  0.000007)\navg_get:                                             0.000003   0.000001   0.000004 (  0.000004)\n```\n\n### Iterations Per Second\n\n```ruby\nWarming up --------------------------------------\nDiskStore.put : 100 records with data size: 702 Bytes\n                       149.000  i/100ms\nDiskStore.get : 100 records, value size: 702 Bytes\n                         2.389k i/100ms\nDiskStore.put : 100 records, value size: 6 Kb\n                        22.000  i/100ms\nDiskStore.get : 100 records, value size: 6 Kb\n                         2.098k i/100ms\nDiskStore.put : 100 records, value size: 660 Kb\n                         1.000  i/100ms\nDiskStore.get : 100 records, value size: 660 Kb\n                       148.000  i/100ms\nCalculating -------------------------------------\nDiskStore.put : 100 records with data size: 702 Bytes\n                          1.552k (±15.7%) i/s -      7.450k in   5.008519s\nDiskStore.get : 100 records, value size: 702 Bytes\n                         24.100k (± 3.7%) i/s -    121.839k in   5.062195s\nDiskStore.put : 100 records, value size: 6 Kb\n                        655.280  (±53.4%) i/s -      1.716k in   5.272456s\nDiskStore.get : 100 records, value size: 6 Kb\n                         19.883k (± 7.1%) i/s -    100.704k in   5.090910s\nDiskStore.put : 100 records, value size: 660 Kb\n                          4.479  (± 0.0%) i/s -     23.000  in   5.166651s\nDiskStore.get : 100 records, value size: 660 Kb\n                          3.286k (±39.4%) i/s -      8.140k in   5.272424s\n```\n\n## Contributing\n\nIf you wish to contribute in any way, please fork the repo and raise a PR.\n\n[![CircleCI](https://dl.circleci.com/insights-snapshot/gh/dineshgowda24/bitcask-rb/main/workflow/badge.svg?window=30d)](https://app.circleci.com/insights/github/dineshgowda24/bitcask-rb/workflows/workflow/overview?branch=main\u0026reporting-window=last-30-days\u0026insights-snapshot=true)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshgowda24%2Fbitcask-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdineshgowda24%2Fbitcask-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshgowda24%2Fbitcask-rb/lists"}