org.apache.accumulo.core.file.blockfile.cache
Class CachedBlock
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PER_BLOCK_OVERHEAD
public static final long PER_BLOCK_OVERHEAD
CachedBlock
public CachedBlock(String blockName,
byte[] buf,
long accessTime)
CachedBlock
public CachedBlock(String blockName,
byte[] buf,
long accessTime,
boolean inMemory)
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.