|
||||||||||
| 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
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(String blockName,
Cacheable cachedItem)
Cache the block with the specified name and buffer. |
void |
cacheBlock(String blockName,
Cacheable buf,
boolean inMemory)
We don't care about whether its in memory or not, so we just pass the call through. |
boolean |
evictBlock(String key)
Evicts a block from the cache. |
int |
evictBlocksByPrefix(String prefix)
Evicts all blocks with name starting with the given prefix. |
Cacheable |
getBlock(String key,
boolean caching)
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(String key,
SingleSizeCache notifier)
This is called as a callback when an item is removed from a SingleSizeCache. |
void |
onInsertion(String 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(String blockName,
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 BlockCacheblockName - block namecachedItem - block buffer
public void cacheBlock(String blockName,
Cacheable buf,
boolean inMemory)
cacheBlock in interface BlockCacheblockName - Zero-based file block number.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(String key,
boolean caching)
getBlock in interface BlockCachekey - caching -
public boolean evictBlock(String key)
evictBlock in interface BlockCachekey - Block name to evict
public void onEviction(String key,
SingleSizeCache notifier)
key - the key of the item being evictednotifier - the object notifying the SlabCache of the eviction.
public void onInsertion(String 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 evictBlocksByPrefix(String prefix)
BlockCache
evictBlocksByPrefix 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 | |||||||||