{"id":24116984,"url":"https://github.com/flynnfc/bagginsdb","last_synced_at":"2026-04-16T04:02:05.734Z","repository":{"id":271441153,"uuid":"905257582","full_name":"FlynnFc/BagginsDB","owner":"FlynnFc","description":"⚡A cassandra inspired distrubuted wide column nosql database⚡","archived":false,"fork":false,"pushed_at":"2025-06-09T19:46:08.000Z","size":94506,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T20:32:32.058Z","etag":null,"topics":["cassandra","database","distrubuted-systems","go","nosql"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/flynnfc/bagginsdb/pkg/bagginsdb/db","language":"Go","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/FlynnFc.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,"zenodo":null}},"created_at":"2024-12-18T13:19:12.000Z","updated_at":"2025-06-09T19:46:12.000Z","dependencies_parsed_at":"2025-01-07T19:51:00.688Z","dependency_job_id":"eb26d947-5c34-45cb-bd2d-cc546e9e19ef","html_url":"https://github.com/FlynnFc/BagginsDB","commit_stats":null,"previous_names":["flynnfc/bagginsdb"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/FlynnFc/BagginsDB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlynnFc%2FBagginsDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlynnFc%2FBagginsDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlynnFc%2FBagginsDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlynnFc%2FBagginsDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlynnFc","download_url":"https://codeload.github.com/FlynnFc/BagginsDB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlynnFc%2FBagginsDB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cassandra","database","distrubuted-systems","go","nosql"],"created_at":"2025-01-11T07:23:03.953Z","updated_at":"2026-04-16T04:02:05.722Z","avatar_url":"https://github.com/FlynnFc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg  width=\"200\" src=\"https://github.com/user-attachments/assets/3bb7c1cc-5c97-4755-aa12-dfa85bc91344\" alt=\"Centered Image\"/\u003e\n  \u003ch1 align=\"center\"\u003eBaggins DB\u003c/h1\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Baggins DB is a simple Cassandra-inspired wide-column db. While not production-ready, it serves as an educational project to explore low-level database internals, concurrency control, and performance-tuning techniques.\n  \u003cbr/\u003e\n  \u003ca href=\"https://flynnfc.dev/work/bagginsdb\"\u003e\n    Learn more on how it's made here\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\n  \u003cimg src=\"https://github.com/flynnfc/bagginsdb/actions/workflows/build.yml/badge.svg\" alt=\"Build badge\"\u003e\n\n  \u003ca href=\"https://github.com/flynnfc/BagginsDB/blob/main/LICENSE.md\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue\" alt=\"MIT\" title=\"MIT License\" /\u003e\n  \u003c/a\u003e\n\n\n\u003c/p\u003e\n  \n\n---\n\n## Features\n\n- **Memtable (In-Memory Index):**  \n  Stores recently written data in a sorted skiplist for quick insertion and retrieval. Once it reaches a certain size threshold, it is flushed to disk as an immutable SSTable.\n\n- **SSTables (On-Disk Storage):**  \n  Writes are organised into append-only, immutable files known as SSTables. Each SSTable is sorted by key and includes:\n  - A Bloom filter to quickly determine if a key might exist.\n  - A sparse index to jump near the desired key without scanning the entire file.\n- **Compaction:**  \n  Over time, multiple SSTables are merged and deduplicated into a single larger SSTable. This process, known as compaction, reduces storage fragmentation and stabilises read performance by limiting the number of SSTables that must be searched.\n\n- **TrueTime Integration (Mocked):**  \n  The code incorporates a `truetime` component, simulating reliable timestamp generation, similar in spirit to [Google’s TrueTime](https://cloud.google.com/spanner/docs/true-time-external-consistency), though far simpler and not distributed. This allows the program to avoid distributed locks and choose the newest value during compactions.\n\n## Project Structure\n\n- `pkg/bagginsdb/db`  \n  Contains the core database logic, including:\n\n  - `database.go`: The `Database` struct that ties together mem-tables, SSTableManager, and timing.\n  - `memtable.go`, `skiplist.go`: In-memory skiplist for quick writes and reads.\n  - `sstable.go`, `sstable_manager.go`: Handling on-disk SSTables, building them from memtables, indexing, and merging them during compaction.\n\n- `pkg/bagginsdb/truetime`  \n  Mock time service that provides timestamps for record inserts.\n\n- `logger/`  \n  A simple logging wrapper configured to produce structured logs via `zap`.\n\n## Performance tuning and improvements\nI've opted to track and log performance at quite a granular level. You can find saved graphs and performance notes in the [Performance](performance) folder\n\n## Roadmap\n\n- Add delete support (tombstones).\n- Implement improved error handling and recovery after crashes.\n- Integrate more benchmarks and profiling tools to guide optimisations.\n\n## License\n\nThis project is distributed under the MIT License. See `LICENSE` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflynnfc%2Fbagginsdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflynnfc%2Fbagginsdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflynnfc%2Fbagginsdb/lists"}