@InterfaceAudience.Private public final class BucketAllocator extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BucketAllocator.Bucket |
| Modifier and Type | Field and Description |
|---|---|
static int |
FEWEST_ITEMS_IN_BUCKET
So, what is the minimum amount of items we'll tolerate in a single bucket?
|
| Modifier and Type | Method and Description |
|---|---|
long |
allocateBlock(int blockSize)
Allocate a block with specified size.
|
int |
freeBlock(long offset,
int length)
Free a block with the offset
|
int |
getBucketIndex(long offset) |
BucketAllocator.Bucket[] |
getBuckets() |
long |
getFreeSize() |
Set<Integer> |
getLeastFilledBuckets(Set<Integer> excludedBuckets,
int bucketCount)
Returns a set of indices of the buckets that are least filled excluding the offsets, we also
the fully free buckets for the BucketSizes where everything is empty and they only have one
completely free bucket as a reserved
|
long |
getTotalSize() |
long |
getUsedSize() |
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
|
int |
sizeIndexOfAllocation(long offset) |
int |
sizeOfAllocation(long offset) |
String |
toString() |
public static final int FEWEST_ITEMS_IN_BUCKET
public org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.BucketSizeInfo roundUpToBucketSizeInfo(int blockSize)
public long getUsedSize()
public long getFreeSize()
public long getTotalSize()
public long allocateBlock(int blockSize)
throws CacheFullException,
BucketAllocatorException
blockSize - size of blockCacheFullExceptionBucketAllocatorExceptionpublic int freeBlock(long offset,
int length)
offset - block's offsetpublic int sizeIndexOfAllocation(long offset)
public int sizeOfAllocation(long offset)
public BucketAllocator.Bucket[] getBuckets()
public int getBucketIndex(long offset)
public Set<Integer> getLeastFilledBuckets(Set<Integer> excludedBuckets, int bucketCount)
excludedBuckets - the buckets that need to be excluded due to currently being in usedbucketCount - max Number of buckets to returnCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.