Class CachedBlock
- java.lang.Object
-
- org.apache.accumulo.core.file.blockfile.cache.lru.CachedBlock
-
- All Implemented Interfaces:
Comparable<CachedBlock>
,HeapSize
public class CachedBlock extends Object implements HeapSize, Comparable<CachedBlock>
Represents an entry in the configurable block cache.Makes the block memory-aware with
HeapSize
and Comparable to sort by access time for the LRU. It also takes care of priority by either instantiating as in-memory or handling the transition from single to multiple access.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CachedBlock.BlockPriority
-
Field Summary
Fields Modifier and Type Field Description static long
PER_BLOCK_OVERHEAD
-
Constructor Summary
Constructors Constructor Description CachedBlock(String blockName, byte[] buf, long accessTime, boolean inMemory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
access(long accessTime)
Block has been accessed.int
compareTo(CachedBlock that)
boolean
equals(Object obj)
long
evicted(AtomicLong totalSize)
byte[]
getBuffer()
<T extends CacheEntry.Weighable>
TgetIndex(Supplier<T> supplier)
String
getName()
CachedBlock.BlockPriority
getPriority()
int
hashCode()
long
heapSize()
long
recordSize(AtomicLong totalSize)
-
-
-
Constructor Detail
-
CachedBlock
public CachedBlock(String blockName, byte[] buf, long accessTime, boolean inMemory)
-
-
Method Detail
-
access
public void access(long accessTime)
Block has been accessed. Update its local access time.
-
heapSize
public long heapSize()
-
compareTo
public int compareTo(CachedBlock that)
- Specified by:
compareTo
in interfaceComparable<CachedBlock>
-
getName
public String getName()
-
getPriority
public CachedBlock.BlockPriority getPriority()
-
getBuffer
public byte[] getBuffer()
-
getIndex
public <T extends CacheEntry.Weighable> T getIndex(Supplier<T> supplier)
-
recordSize
public long recordSize(AtomicLong totalSize)
-
evicted
public long evicted(AtomicLong totalSize)
-
-