Expand description
Block cache — an LRU cache of decompressed SSTable data blocks.
LevelDB uses a generic sharded LRU cache with custom deleters and opaque
handles (util/cache.cc). In Rust, Arc<Block> replaces the handle +
deleter pattern: dropping the cache’s copy is enough; any BlockIter that
already cloned the Arc<Vec<u8>> remains valid independently.
The key is (cache_id, block_offset). Each Table gets a unique cache_id
from BlockCache::new_id so blocks from different files never collide even
when file numbers are reused after compaction.
Default capacity: 8 MiB (matching LevelDB’s Options::block_cache default).
Structs§
- Block
Cache - An LRU cache of decompressed SSTable data blocks, keyed by
(cache_id, block_offset).
Constants§
- DEFAULT_
BLOCK_ CACHE_ CAPACITY - Default block cache capacity in bytes.