brk_store
Key-value storage layer built on fjall for Bitcoin indexing.
What It Enables
Persist and query Bitcoin index data (address→outputs, txid→height, etc.) with access patterns optimized for different workloads: random lookups, sequential scans, and recent-data queries.
Key Features
- Workload-optimized configs:
Kind::Random(bloom filters, pinned blocks),Kind::Recent(point-read optimized),Kind::Sequential(scan-friendly),Kind::Vec(append-heavy) - Write batching: Accumulate puts/deletes in memory, commit atomically
- Tiered caching: In-memory LRU cache layers before hitting disk
- Version management: Automatic schema versioning with
StoreMeta - Height-aware operations:
insert_if_needed/remove_if_neededskip work at heights already processed
Core API
let store: = import?;
store.insert;
store.commit?;
let height = store.get?;
Access Patterns
| Kind | Use Case | Optimization |
|---|---|---|
Random |
UTXO lookups, txid queries | Aggressive bloom filters |
Recent |
Mempool, recent blocks | Point-read hints |
Sequential |
Full chain scans | Minimal indexing |
Vec |
Append-only series | Large memtables, no filters |
Built On
brk_errorfor error handlingbrk_typesforHeight,Version