Class LatestBlockCache
java.lang.Object
io.datarouter.filesystem.snapshot.cache.LatestBlockCache
- All Implemented Interfaces:
BlockLoader
public class LatestBlockCache extends Object implements BlockLoader
Simple implementation holds the most recent block of each type accessed. For sequential access we may read the same
block many times in a row, in which case this cache allows skipping path generation, block loading, and checksumming.
This is extremely optimized so the SnapshotReader doesn't need to think about caching. Numeric block indexes are
stored to avoid path-building String concatenation.
-
Constructor Summary
Constructors Constructor Description LatestBlockCache(SnapshotKey snapshotKey, BlockLoader blockLoader) -
Method Summary
Modifier and Type Method Description BranchBlockbranch(BlockKey key)LeafBlockleaf(BlockKey key)io.datarouter.scanner.Scanner<LeafBlock>leafRange(LeafBlockRangeLoader.LeafBlockRange range)RootBlockroot(BlockKey key)ValueBlockvalue(BlockKey key)
-
Constructor Details
-
Method Details
-
root
- Specified by:
rootin interfaceBlockLoader
-
branch
- Specified by:
branchin interfaceBlockLoader
-
leaf
- Specified by:
leafin interfaceBlockLoader
-
leafRange
public io.datarouter.scanner.Scanner<LeafBlock> leafRange(LeafBlockRangeLoader.LeafBlockRange range)- Specified by:
leafRangein interfaceBlockLoader
-
value
- Specified by:
valuein interfaceBlockLoader
-