MCPcopy Index your code
hub / github.com/Lagrang/bztree-rs

github.com/Lagrang/bztree-rs @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
283 symbols 1,228 edges 10 files 37 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Crate API

BzTree

BzTree(concurrent B-tree) implementation for Rust based on paper BzTree: A High-Performance Latch-free Range Index for Non-Volatile Memory.
Current implementation doesn't support non-volatile memory and supposed to be used only as in-memory(not persistent) data structure.
BzTree uses MwCAS crate to get access to multi-word CAS.

Examples

use bztree::BzTree;

let tree = BzTree::new();
let guard = crossbeam_epoch::pin();

let key1 = "key_1".to_string();
assert!(tree.insert(key1.clone(), 1, &guard));
assert!(!tree.insert(key1.clone(), 5, &guard));
tree.upsert(key1.clone(), 10, &guard);

assert!(matches!(tree.delete(&key1, &guard), Some(&10)));

let key2 = "key_2".to_string();
tree.insert(key2.clone(), 2, &guard);
assert!(tree.compute(&key2, |(_, v)| Some(v + 1), &guard));
assert!(matches!(tree.get(&key2, &guard), Some(&3)));

assert!(tree.compute(&key2, |(_, v)| {
 if *v == 3 {
     None
 } else {
     Some(v + 1)
 }
}, &guard));
assert!(matches!(tree.get(&key2, &guard), None));

Core symbols most depended-on inside this repo

insert
called by 90
src/lib.rs
clone
called by 87
src/lib.rs
clone
called by 68
tests/single_threaded.rs
insert
called by 48
tests/history_verifier.rs
range
called by 47
src/lib.rs
iter
called by 37
src/lib.rs
iter
called by 34
src/node/mod.rs
insert
called by 33
src/node/mod.rs

Shape

Method 157
Function 92
Class 25
Enum 9

Languages

Rust100%

Modules by API surface

src/lib.rs87 symbols
src/node/mod.rs80 symbols
tests/single_threaded.rs31 symbols
src/node/status_word.rs26 symbols
tests/concurrent.rs15 symbols
src/scanner.rs15 symbols
tests/history_verifier.rs11 symbols
src/node/metadata.rs9 symbols
src/node/scanner.rs7 symbols
benches/bztree_bench.rs2 symbols

For agents

$ claude mcp add bztree-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact