|
4 | 4 | [](https://crates.io/crates/btree-store) |
5 | 5 | [](./LICENSE) |
6 | 6 |
|
7 | | -**btree_store** is a persistent, embedded key-value storage engine written in Rust. It implements a robust Copy-On-Write (COW) B-Tree architecture to ensure data integrity, crash safety, and efficient concurrent access. |
| 7 | +**btree_store** is a persistent, embedded key-value storage engine written in Rust. It implements a robust Copy-On-Write (COW) B+ Tree architecture to ensure data integrity, crash safety, and efficient concurrent access. |
8 | 8 |
|
9 | 9 | ## Features |
10 | 10 |
|
|
13 | 13 | * **Auto-Refresh:** Every transaction automatically starts from the freshest disk state. No manual snapshot management required. |
14 | 14 | * **Conflict Detection:** Built-in "First-Committer-Wins" strategy for concurrent handles. |
15 | 15 | * **Batch Operations:** `exec_multi` for atomic updates across multiple buckets with a single disk sync, significantly reducing I/O overhead. |
16 | | -* **Crash Safety:** Double-write superblock updates and a `.pending` log recovery mechanism ensure zero-leak recovery even from torn writes. |
| 16 | +* **Crash Safety:** Double-buffered superblock with CRC32C checksums and ordered metadata writes; recovery selects the newest valid meta page. |
17 | 17 | * **Logical Namespaces:** Direct support for multiple buckets within a single database file. |
18 | 18 | * **Zero-Copy Access:** 8-byte aligned memory layouts allow direct pointer-to-reference conversion for maximum performance. |
19 | 19 | * **Robust Data Integrity:** Strengthened physical invariant checks and CRC32C checksum validation for every node and metadata page. |
|
24 | 24 |
|
25 | 25 | ## Architecture |
26 | 26 |
|
27 | | -* **Store (`src/store.rs`):** Low-level page management, sharded LRU caching with mandatory invalidation on sync, and positional I/O. |
| 27 | +* **Store (`src/store.rs`):** Low-level page management, sharded clock cache with explicit invalidation, and positional I/O. |
28 | 28 | * **Node (`src/node.rs`):** 8-byte aligned memory management (`AlignedPage`), zero-copy serialization, and checksumming. |
29 | 29 | * **Tree Logic (`src/lib.rs`):** Core B+ Tree algorithms and Transactional Snapshot Isolation logic. |
30 | 30 |
|
@@ -135,9 +135,9 @@ db.compact(64 * 1024 * 1024)?; |
135 | 135 |
|
136 | 136 | The engine is optimized for high-throughput scenarios: |
137 | 137 | * **8-Byte Alignment:** Every page is allocated with 8-byte alignment, allowing direct casting of raw bytes to internal structures without memory copies. |
138 | | -* **Snapshot Isolation (SI):** Readers and writers operate on stable snapshots without blocking each other (non-blocking reads). |
| 138 | +* **Snapshot Isolation (SI):** Readers use a stable root per transaction; each handle enforces single-writer/multi-reader via an RwLock. |
139 | 139 | * **Automatic Page Reclamation:** Failed or conflicted transactions automatically trigger page reclamation to prevent database bloat. |
140 | | -* **Transmute-based lifetime extension:** Iterators return direct references to internal buffers under a read lock, achieving near-zero allocation. |
| 140 | +* **Lock-Free File I/O:** Positional reads (`pread`/`seek_read`) avoid a global file mutex for concurrent access. |
141 | 141 |
|
142 | 142 | ## Limits |
143 | 143 |
|
|
0 commit comments