org.apache.accumulo.core.file.blockfile.cache
public class CachedBlock extends Object implements HeapSize, Comparable<CachedBlock>, CacheEntry
LruBlockCache
.
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.
Modifier and Type | Field and Description |
---|---|
static long |
PER_BLOCK_OVERHEAD |
Constructor and Description |
---|
CachedBlock(String blockName,
byte[] buf,
long accessTime) |
CachedBlock(String blockName,
byte[] buf,
long accessTime,
boolean inMemory) |
Modifier and Type | Method and Description |
---|---|
void |
access(long accessTime)
Block has been accessed.
|
int |
compareTo(CachedBlock that) |
byte[] |
getBuffer() |
Object |
getIndex() |
String |
getName() |
org.apache.accumulo.core.file.blockfile.cache.CachedBlock.BlockPriority |
getPriority() |
long |
heapSize() |
void |
setIndex(Object idx) |
public CachedBlock(String blockName, byte[] buf, long accessTime)
public CachedBlock(String blockName, byte[] buf, long accessTime, boolean inMemory)
public void access(long accessTime)
public long heapSize()
public int compareTo(CachedBlock that)
compareTo
in interface Comparable<CachedBlock>
public byte[] getBuffer()
getBuffer
in interface CacheEntry
public String getName()
public org.apache.accumulo.core.file.blockfile.cache.CachedBlock.BlockPriority getPriority()
public Object getIndex()
getIndex
in interface CacheEntry
public void setIndex(Object idx)
setIndex
in interface CacheEntry
Copyright © 2011-2015 The Apache Software Foundation. All Rights Reserved.