- BPlusTree Enhancements: Implemented a disk-backed, DFS iterator (BPlusTreeDiskIterator) and its owned variant (BPlusTreeDiskIteratorOwned) for efficient sequential access using the block cache.
- Repository Migration: Refactored m3u_repository.rs, xtream_repository.rs, and playlist_repository.rs to use B+ Trees directly.
- Iterator Refactoring: Updated m3u_playlist_iterator.rs and xtream_playlist_iterator.rs to utilize the new disk-backed iterators.
- Cleanup: Officially removed the IndexedDocument abstraction and associated files/constants, reducing architectural complexity.
- Verification: Confirmed full system integrity with a passing suite of 8 integration/unit tests in the release profile.
- Concurrency Safety: Implemented an advisory FileLock mechanism for all write operations, ensuring only one process can update the tree at a time.
- Strict Error Handling: Replaced all remaining unwrap and default fallback logic with explicit error propagation (?). Invariant violations now return descriptive DataCorruption or InvalidData errors instead of silent failures.
- Locking Recursion Fix: Resolved the recursion issue by allowing internal unlocked access for the compact process while maintaining external protection.
- Full Verification: All 7 integration tests passed, confirming that the system is now 100% memory-safe, crash-safe, and concurrency-robust.
- Atomic & Crash Resistant: Uses COW with a final 8-byte header swap.
- Space Efficient: Features a compact() method to reclaim space from old versions.
- LRU Block Cache: Implemented a manual cache using IndexMap (4MB capacity) to maintain fast query performance.
- Serialization Overflow Protection: Added critical checks to prevent data corruption if node metadata exceeds the 4KB block size.
- Stable Order Calculations: Refined calc_order with safety margins to ensure robust persistence.
- Surgical Overwrites: BPlusTreeUpdate now checks the number of 4KB blocks occupied by the old value. If the new value fits within those same blocks, it is overwritten in-place instead of appending to the end of the file.
- Zero Fragmentation: This optimization keeps the file size stable when updating existing records with same or smaller sized data.
- Predictable Growth: The file only grows to the end when a value truly exceeds its allocated space.
- Performance: We've eliminated redundant vec! allocations in the update loop by reusing internal buffers.