org.apache.hadoop.hbase.io.hfile
Class CachedBlock

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.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, ByteBuffer buf, long accessTime)
           
CachedBlock(String blockName, ByteBuffer buf, long accessTime, boolean inMemory)
           
 
Method Summary
 void access(long accessTime)
          Block has been accessed.
 int compareTo(CachedBlock that)
           
 ByteBuffer getBuffer()
           
 String getName()
           
 org.apache.hadoop.hbase.io.hfile.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,
                   ByteBuffer buf,
                   long accessTime)

CachedBlock

public CachedBlock(String blockName,
                   ByteBuffer 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 ByteBuffer getBuffer()

getName

public String getName()

getPriority

public org.apache.hadoop.hbase.io.hfile.CachedBlock.BlockPriority getPriority()


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