|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.io.hfile.slab.SlabCache
@InterfaceAudience.Private public class SlabCache
SlabCache is composed of multiple SingleSizeCaches. It uses a TreeMap in order to determine where a given element fits. Redirects gets and puts to the correct SingleSizeCache.
| Constructor Summary | |
|---|---|
SlabCache(long size,
long avgBlockSize)
Default constructor, creates an empty SlabCache. |
|
| Method Summary | |
|---|---|
void |
addSlabByConf(org.apache.hadoop.conf.Configuration conf)
A way of allocating the desired amount of Slabs of each particular size. |
void |
cacheBlock(BlockCacheKey cacheKey,
Cacheable cachedItem)
Cache the block with the specified key and buffer. |
void |
cacheBlock(BlockCacheKey cacheKey,
Cacheable buf,
boolean inMemory)
We don't care about whether its in memory or not, so we just pass the call through. |
boolean |
evictBlock(BlockCacheKey cacheKey)
Evicts a block from the cache. |
int |
evictBlocksByHfileName(String hfileName)
Evicts all blocks for the given HFile. |
Cacheable |
getBlock(BlockCacheKey key,
boolean caching,
boolean repeat)
Get the buffer of the block with the specified name. |
List<BlockCacheColumnFamilySummary> |
getBlockCacheColumnFamilySummaries(org.apache.hadoop.conf.Configuration conf)
Performs a BlockCache summary and returns a List of BlockCacheColumnFamilySummary objects. |
long |
getBlockCount()
Returns the number of blocks currently cached in the block cache. |
long |
getCurrentSize()
Returns the occupied size of the block cache, in bytes. |
long |
getEvictedCount()
Returns the number of evictions that have occurred. |
long |
getFreeSize()
Returns the free size of the block cache, in bytes. |
CacheStats |
getStats()
Get the statistics for this block cache. |
long |
heapSize()
|
void |
onEviction(BlockCacheKey key,
SingleSizeCache notifier)
This is called as a callback when an item is removed from a SingleSizeCache. |
void |
onInsertion(BlockCacheKey key,
SingleSizeCache notifier)
This is called as a callback when an item is inserted into a SingleSizeCache. |
void |
shutdown()
Sends a shutdown to all SingleSizeCache's contained by this cache. |
long |
size()
Returns the total size of the block cache, in bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SlabCache(long size,
long avgBlockSize)
size - Total size allocated to the SlabCache. (Bytes)avgBlockSize - Average size of a block being cached.| Method Detail |
|---|
public void addSlabByConf(org.apache.hadoop.conf.Configuration conf)
conf - Configuration file.
public void cacheBlock(BlockCacheKey cacheKey,
Cacheable cachedItem)
It is assumed this will NEVER be called on an already cached block. If that is done, it is assumed that you are reinserting the same exact block due to a race condition, and will throw a runtime exception.
cacheBlock in interface BlockCachecacheKey - block cache keycachedItem - block buffer
public void cacheBlock(BlockCacheKey cacheKey,
Cacheable buf,
boolean inMemory)
cacheBlock in interface BlockCachecacheKey - The block's cache key.buf - The block contents wrapped in a ByteBuffer.inMemory - Whether block should be treated as in-memorypublic CacheStats getStats()
BlockCache
getStats in interface BlockCache
public Cacheable getBlock(BlockCacheKey key,
boolean caching,
boolean repeat)
getBlock in interface BlockCachecaching - key - repeat - Whether this is a repeat lookup for the same block
(used to avoid double counting cache misses when doing double-check locking)
HFileReaderV2.readBlock(long, long, boolean, boolean, boolean, BlockType)public boolean evictBlock(BlockCacheKey cacheKey)
evictBlock in interface BlockCachecacheKey - Block to evict
public void onEviction(BlockCacheKey key,
SingleSizeCache notifier)
key - the key of the item being evictednotifier - the object notifying the SlabCache of the eviction.
public void onInsertion(BlockCacheKey key,
SingleSizeCache notifier)
key - the key of the item being addednotifier - the object notifying the SlabCache of the insertion..public void shutdown()
shutdown in interface BlockCachepublic long heapSize()
heapSize in interface HeapSizepublic long size()
BlockCache
size in interface BlockCachepublic long getFreeSize()
BlockCache
getFreeSize in interface BlockCachepublic long getBlockCount()
BlockCache
getBlockCount in interface BlockCachepublic long getCurrentSize()
BlockCache
getCurrentSize in interface BlockCachepublic long getEvictedCount()
BlockCache
getEvictedCount in interface BlockCachepublic int evictBlocksByHfileName(String hfileName)
BlockCache
evictBlocksByHfileName in interface BlockCachepublic List<BlockCacheColumnFamilySummary> getBlockCacheColumnFamilySummaries(org.apache.hadoop.conf.Configuration conf)
BlockCache
getBlockCacheColumnFamilySummaries in interface BlockCacheconf - HBaseConfiguration
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||