{"id":51514729,"url":"https://github.com/jamesgober/index-db","last_synced_at":"2026-07-08T10:01:45.491Z","repository":{"id":363335701,"uuid":"1260448291","full_name":"jamesgober/index-db","owner":"jamesgober","description":"B+tree indexing primitive for Rust storage engines - ordered keys, range scans, and concurrent access over paged storage.","archived":false,"fork":false,"pushed_at":"2026-06-17T07:05:36.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-17T07:22:57.602Z","etag":null,"topics":["b-plus-tree","btree","database","index","range-scan","reps","rust","storage-engine"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesgober.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["jamesgober"]}},"created_at":"2026-06-05T13:59:44.000Z","updated_at":"2026-06-17T07:05:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jamesgober/index-db","commit_stats":null,"previous_names":["jamesgober/index-db"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jamesgober/index-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2Findex-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2Findex-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2Findex-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2Findex-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesgober","download_url":"https://codeload.github.com/jamesgober/index-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2Findex-db/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35260671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"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":["b-plus-tree","btree","database","index","range-scan","reps","rust","storage-engine"],"created_at":"2026-07-08T10:01:42.884Z","updated_at":"2026-07-08T10:01:45.398Z","avatar_url":"https://github.com/jamesgober.png","language":"Rust","funding_links":["https://github.com/sponsors/jamesgober"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cimg width=\"99\" alt=\"Rust logo\" src=\"https://raw.githubusercontent.com/jamesgober/rust-collection/72baabd71f00e14aa9184efcb16fa3deddda3a0a/assets/rust-logo.svg\"\u003e\n    \u003cbr\u003e\n    \u003cb\u003eindex-db\u003c/b\u003e\n    \u003cbr\u003e\n    \u003csub\u003e\u003csup\u003eB+TREE INDEXING PRIMITIVE\u003c/sup\u003e\u003c/sub\u003e\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://crates.io/crates/index-db\"\u003e\u003cimg alt=\"Crates.io\" src=\"https://img.shields.io/crates/v/index-db\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/index-db\" alt=\"Download index-db\"\u003e\u003cimg alt=\"Crates.io Downloads\" src=\"https://img.shields.io/crates/d/index-db?color=%230099ff\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/index-db\" title=\"index-db Documentation\"\u003e\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/docsrs/index-db\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/jamesgober/index-db/actions\"\u003e\u003cimg alt=\"GitHub CI\" src=\"https://github.com/jamesgober/index-db/actions/workflows/ci.yml/badge.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/rust-lang/rfcs/blob/master/text/2495-min-rust-version.md\" title=\"MSRV\"\u003e\u003cimg alt=\"MSRV\" src=\"https://img.shields.io/badge/MSRV-1.85%2B-blue\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n\u003cdiv align=\"left\"\u003e\n    \u003cp\u003e\n        \u003cstrong\u003eindex-db\u003c/strong\u003e is a \u003cb\u003eB+tree indexing primitive\u003c/b\u003e for storage engines: ordered keys mapped to values, with fast point lookups and \u003cb\u003eefficient range scans\u003c/b\u003e, laid out over \u003cb\u003epaged storage\u003c/b\u003e rather than the heap.\n    \u003c/p\u003e\n    \u003cp\u003e\n        Nodes are pages, so the tree persists and caches through a pager (it pairs with \u003ccode\u003epage-db\u003c/code\u003e), and it supports \u003cb\u003econcurrent access\u003c/b\u003e via latch coupling (crabbing) so many readers and writers can traverse at once without locking the whole tree.\n    \u003c/p\u003e\n    \u003cbr\u003e\n    \u003chr\u003e\n    \u003cp\u003e\n        \u003cstrong\u003eMSRV is 1.85+\u003c/strong\u003e (Rust 2024 edition). Ordered B+tree. Range scans. Latch-coupled concurrent access.\n    \u003c/p\u003e\n    \u003cblockquote\u003e\n        \u003cstrong\u003eStatus: 1.0 \u0026mdash; stable, API frozen until 2.0.\u003c/strong\u003e \u003ccode\u003ev1.0.0\u003c/code\u003e is the stable in-memory ordered map \u0026mdash; ordered storage, point lookups, deletion, forward and reverse range scans, and bulk construction from sorted input \u0026mdash; hardened with adversarial, large-scale, and sustained soak tests. The tree is \u003ccode\u003eSync\u003c/code\u003e, so any number of threads may read it at once. Node access runs through an internal storage seam so a page-backed, concurrent (write-side) backend over \u003ccode\u003epage-db\u003c/code\u003e arrives additively in a 1.x release without breaking this API. See \u003ca href=\"./dev/ROADMAP.md\"\u003e\u003ccode\u003edev/ROADMAP.md\u003c/code\u003e\u003c/a\u003e.\n    \u003c/blockquote\u003e\n\u003c/div\u003e\n\n\u003chr\u003e\n\u003cbr\u003e\n\n\u003ch2\u003eWhat it does\u003c/h2\u003e\n\n**Available now (`v1.0.0`):**\n\n- **Ordered B+tree** \u0026mdash; keys kept in sorted order; logarithmic point lookup, insert, and delete\n- **Self-balancing** \u0026mdash; nodes split on insert and borrow or merge on delete, so the tree stays balanced at every depth on its own\n- **Range scans** \u0026mdash; forward and reverse iteration over a key range, the operation B+trees exist for\n- **Bulk load** \u0026mdash; build a balanced tree bottom-up from sorted input in one fast pass\n- **Storage seam** \u0026mdash; nodes are addressed by id through an internal node store, so the same algorithm can later run over a paged, persistent backend\n- **`no_std` support** \u0026mdash; depends only on `alloc`; the `std` feature is optional\n\n**On the roadmap** (see [`dev/ROADMAP.md`](./dev/ROADMAP.md)):\n\n- **Page-backed, concurrent backend** \u0026mdash; nodes as `page-db` pages, with latch coupling (crabbing) over the pager's frame guards for many-reader / many-writer traversal. Concurrency is a property of the storage backend, not of the in-memory tree.\n\n\u003cbr\u003e\n\u003chr\u003e\n\u003cbr\u003e\n\n## Installation\n\n```toml\n[dependencies]\nindex-db = \"1\"\n```\n\n\u003cbr\u003e\n\n## Quick Start\n\n```rust\nuse index_db::BPlusTree;\n\nlet mut index = BPlusTree::new();\n\n// Insert key/value pairs in any order; the tree keeps them sorted.\nindex.insert(3_u32, \"three\");\nindex.insert(1, \"one\");\nindex.insert(2, \"two\");\n\n// Point lookups return a reference to the value, or None.\nassert_eq!(index.get(\u00262), Some(\u0026\"two\"));\nassert_eq!(index.get(\u00269), None);\n\n// Re-inserting a key replaces and returns the old value.\nassert_eq!(index.insert(1, \"ONE\"), Some(\"one\"));\n\n// Scan a key range in order (and in reverse).\nlet keys: Vec\u003c_\u003e = index.range(1..3).map(|(\u0026k, _)| k).collect();\nassert_eq!(keys, vec![1, 2]);\n\n// Remove returns the value that was there.\nassert_eq!(index.remove(\u00262), Some(\"two\"));\nassert_eq!(index.len(), 2);\n```\n\nBuild a large index in one pass from sorted data:\n\n```rust\nuse index_db::BPlusTree;\n\nlet index = BPlusTree::from_sorted((0..1_000_u32).map(|k| (k, k * k)));\nassert_eq!(index.get(\u002630), Some(\u0026900));\nassert_eq!(index.len(), 1_000);\n```\n\n\u003cbr\u003e\n\n## API Overview\n\nFor the complete reference with examples for every method, see [`docs/API.md`](./docs/API.md). For benchmark baselines, see [`docs/PERFORMANCE.md`](./docs/PERFORMANCE.md).\n\n| Method | Purpose |\n|--------|---------|\n| [`BPlusTree::new`](./docs/API.md#bplustreenew) | Create an empty tree |\n| [`from_sorted`](./docs/API.md#bplustreefrom_sorted) | Bulk-build from sorted entries |\n| [`insert`](./docs/API.md#bplustreeinsert) | Insert or replace a key's value |\n| [`get`](./docs/API.md#bplustreeget) / [`contains_key`](./docs/API.md#bplustreecontains_key) | Point lookup / membership test |\n| [`remove`](./docs/API.md#bplustreeremove) | Delete a key, returning its value |\n| [`iter`](./docs/API.md#bplustreeiter) / [`range`](./docs/API.md#bplustreerange) | Ordered iteration / range scan, forward or reverse |\n| [`len`](./docs/API.md#bplustreelen) / [`is_empty`](./docs/API.md#bplustreeis_empty) / [`height`](./docs/API.md#bplustreeheight) | Size and shape |\n| [`clear`](./docs/API.md#bplustreeclear) | Remove every entry |\n\n\u003cbr\u003e\n\u003chr\u003e\n\u003cbr\u003e\n\n## Where It Fits\n\n`index-db` is the ordered-index layer. It builds on / pairs with:\n\n- [`page-db`](https://github.com/jamesgober/page-db) \u0026mdash; B+tree nodes are pages allocated and cached by the pager\n- [`lock-db`](https://github.com/jamesgober/lock-db) \u0026mdash; range locks protect scanned key ranges\n- storage engines \u0026mdash; the secondary-index and ordered-access structure above the pager\n- [`lsm-db`](https://github.com/jamesgober/lsm-db) \u0026mdash; a B-tree alternative to the LSM index for read-heavy workloads\n\nIt has no first-party dependencies, so it builds and tests standalone today.\n\n\u003cbr\u003e\n\n## Cross-Platform Support\n\nLinux (x86_64, aarch64), macOS (x86_64, Apple Silicon), and Windows (x86_64) are first-class and verified by the CI matrix.\n\n\u003cbr\u003e\n\n## Contributing\n\nSee [`CONTRIBUTING.md`](./CONTRIBUTING.md) and [`dev/DIRECTIVES.md`](./dev/DIRECTIVES.md). Before a PR: `cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test --all-features` must be clean.\n\n\u003cbr\u003e\n\n\u003cdiv id=\"license\"\u003e\n    \u003ch2\u003eLicense\u003c/h2\u003e\n    \u003cp\u003eLicensed under either of\u003c/p\u003e\n    \u003cul\u003e\n        \u003cli\u003e\u003cb\u003eApache License, Version 2.0\u003c/b\u003e \u0026mdash; \u003ca href=\"./LICENSE-APACHE\"\u003eLICENSE-APACHE\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003cb\u003eMIT License\u003c/b\u003e \u0026mdash; \u003ca href=\"./LICENSE-MIT\"\u003eLICENSE-MIT\u003c/a\u003e\u003c/li\u003e\n    \u003c/ul\u003e\n    \u003cp\u003eat your option.\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch2\u003e\u003c/h2\u003e\n  \u003csup\u003eCOPYRIGHT \u003csmall\u003e\u0026copy;\u003c/small\u003e 2026 \u003cstrong\u003eJAMES GOBER.\u003c/strong\u003e\u003c/sup\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesgober%2Findex-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesgober%2Findex-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesgober%2Findex-db/lists"}