org.apache.hadoop.hbase.io.hfile.bucket
Class BucketAllocator
java.lang.Object
org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator
@InterfaceAudience.Private
public final class BucketAllocator
- extends Object
This class is used to allocate a block with specified size and free the block
when evicting. It manages an array of buckets, each bucket is associated with
a size and caches elements up to this size. For completely empty bucket, this
size could be re-specified dynamically.
This class is not thread safe.
FEWEST_ITEMS_IN_BUCKET
public static final int FEWEST_ITEMS_IN_BUCKET
- See Also:
- Constant Field Values
roundUpToBucketSizeInfo
public org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.BucketSizeInfo roundUpToBucketSizeInfo(int blockSize)
- Round up the given block size to bucket size, and get the corresponding
BucketSizeInfo
toString
public String toString()
- Overrides:
toString
in class Object
getUsedSize
public long getUsedSize()
getFreeSize
public long getFreeSize()
getTotalSize
public long getTotalSize()
allocateBlock
public long allocateBlock(int blockSize)
throws CacheFullException,
BucketAllocatorException
- Allocate a block with specified size. Return the offset
- Parameters:
blockSize
- size of block
- Returns:
- the offset in the IOEngine
- Throws:
BucketAllocatorException,CacheFullException
CacheFullException
BucketAllocatorException
freeBlock
public int freeBlock(long offset)
- Free a block with the offset
- Parameters:
offset
- block's offset
- Returns:
- size freed
sizeIndexOfAllocation
public int sizeIndexOfAllocation(long offset)
sizeOfAllocation
public int sizeOfAllocation(long offset)
getBuckets
public BucketAllocator.Bucket[] getBuckets()
dumpToLog
public void dumpToLog()
logStatistics
public void logStatistics()
getIndexStatistics
public org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.IndexStatistics[] getIndexStatistics(org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.IndexStatistics grandTotal)
getIndexStatistics
public org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.IndexStatistics[] getIndexStatistics()
freeBlock
public long freeBlock(long[] freeList)
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.