Class CachedBlock
- java.lang.Object
-
- org.apache.accumulo.core.file.blockfile.cache.CachedBlock
-
- All Implemented Interfaces:
Comparable<CachedBlock>
,CacheEntry
,HeapSize
public class CachedBlock extends Object implements HeapSize, Comparable<CachedBlock>, CacheEntry
Represents an entry in theLruBlockCache
.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.
-
-
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)
byte[]
getBuffer()
Object
getIndex()
String
getName()
org.apache.accumulo.core.file.blockfile.cache.CachedBlock.BlockPriority
getPriority()
int
hashCode()
long
heapSize()
void
setIndex(Object idx)
-
-
-
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>
-
getBuffer
public byte[] getBuffer()
- Specified by:
getBuffer
in interfaceCacheEntry
-
getName
public String getName()
-
getPriority
public org.apache.accumulo.core.file.blockfile.cache.CachedBlock.BlockPriority getPriority()
-
getIndex
public Object getIndex()
- Specified by:
getIndex
in interfaceCacheEntry
-
setIndex
public void setIndex(Object idx)
- Specified by:
setIndex
in interfaceCacheEntry
-
-