org.apache.accumulo.core.file.blockfile.cache
Class CachedBlock

java.lang.Object
  extended by org.apache.accumulo.core.file.blockfile.cache.CachedBlock
All Implemented Interfaces:
Comparable<CachedBlock>, HeapSize

public class CachedBlock
extends Object
implements HeapSize, Comparable<CachedBlock>

Represents an entry in the 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.


Field Summary
static long PER_BLOCK_OVERHEAD
           
 
Constructor Summary
CachedBlock(String blockName, byte[] buf, long accessTime)
           
CachedBlock(String blockName, byte[] buf, long accessTime, boolean inMemory)
           
 
Method Summary
 void access(long accessTime)
          Block has been accessed.
 int compareTo(CachedBlock that)
           
 byte[] getBuffer()
           
 String getName()
           
 org.apache.accumulo.core.file.blockfile.cache.CachedBlock.BlockPriority getPriority()
           
 long heapSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PER_BLOCK_OVERHEAD

public static final long PER_BLOCK_OVERHEAD
Constructor Detail

CachedBlock

public CachedBlock(String blockName,
                   byte[] buf,
                   long accessTime)

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()
Specified by:
heapSize in interface HeapSize
Returns:
Approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.

compareTo

public int compareTo(CachedBlock that)
Specified by:
compareTo in interface Comparable<CachedBlock>

getBuffer

public byte[] getBuffer()

getName

public String getName()

getPriority

public org.apache.accumulo.core.file.blockfile.cache.CachedBlock.BlockPriority getPriority()


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.