@Test public void testBucketAllocator() throws BucketAllocatorException { BucketAllocator mAllocator = cache.getAllocator(); int[] blockSizes = new int[2]; blockSizes[0] = 4 * 1024; blockSizes[1] = 8 * 1024; boolean full = false; int i = 0; ArrayList<Long> allocations = new ArrayList<Long>(); while (!full) { try { allocations.add(new Long(mAllocator.allocateBlock(blockSizes[i % blockSizes.length]))); ++i; } catch (CacheFullException cfe) { full = true; } } for (i = 0; i < blockSizes.length; i++) { BucketSizeInfo bucketSizeInfo = mAllocator .roundUpToBucketSizeInfo(blockSizes[0]); IndexStatistics indexStatistics = bucketSizeInfo.statistics(); assertTrue(indexStatistics.freeCount() == 0); } for (long offset : allocations) { assertTrue(mAllocator.sizeOfAllocation(offset) == mAllocator .freeBlock(offset)); } assertTrue(mAllocator.getUsedSize() == 0); }
BucketAllocator getAllocator() { return this.bucketAllocator; }
BucketCache implements BlockCache, HeapSize { BucketAllocator getAllocator() { return this.bucketAllocator; } }
BucketCache implements BlockCache, HeapSize { BucketAllocator getAllocator() { return this.bucketAllocator; } BucketCache(String ioEngineName, long capacity, int blockSize, int writerThreadNum,
      int writerQLen, String persistencePath);  BucketCache(String ioEngineName, long capacity, int blockSize, int writerThreadNum,
      int writerQLen, String persistencePath, int ioErrorsTolerationDuration); }
BucketCache implements BlockCache, HeapSize { BucketAllocator getAllocator() { return this.bucketAllocator; } BucketCache(String ioEngineName, long capacity, int blockSize, int writerThreadNum,
      int writerQLen, String persistencePath);  BucketCache(String ioEngineName, long capacity, int blockSize, int writerThreadNum,
      int writerQLen, String persistencePath, int ioErrorsTolerationDuration); @Override void cacheBlock(BlockCacheKey cacheKey, Cacheable buf); @Override void cacheBlock(BlockCacheKey cacheKey, Cacheable cachedItem, boolean inMemory); void cacheBlockWithWait(BlockCacheKey cacheKey, Cacheable cachedItem,
      boolean inMemory, boolean wait); @Override Cacheable getBlock(BlockCacheKey key, boolean caching, boolean repeat,
      boolean updateCacheMetrics); @Override boolean evictBlock(BlockCacheKey cacheKey); void logStats(); @Override void shutdown(); @Override CacheStats getStats(); @Override long heapSize(); @Override long size(); @Override long getFreeSize(); @Override long getBlockCount(); @Override long getCurrentSize(); @Override long getEvictedCount(); @Override int evictBlocksByHfileName(String hfileName); @Override List<BlockCacheColumnFamilySummary> getBlockCacheColumnFamilySummaries(
      Configuration conf); }
BucketCache implements BlockCache, HeapSize { BucketAllocator getAllocator() { return this.bucketAllocator; } BucketCache(String ioEngineName, long capacity, int blockSize, int writerThreadNum,
      int writerQLen, String persistencePath);  BucketCache(String ioEngineName, long capacity, int blockSize, int writerThreadNum,
      int writerQLen, String persistencePath, int ioErrorsTolerationDuration); @Override void cacheBlock(BlockCacheKey cacheKey, Cacheable buf); @Override void cacheBlock(BlockCacheKey cacheKey, Cacheable cachedItem, boolean inMemory); void cacheBlockWithWait(BlockCacheKey cacheKey, Cacheable cachedItem,
      boolean inMemory, boolean wait); @Override Cacheable getBlock(BlockCacheKey key, boolean caching, boolean repeat,
      boolean updateCacheMetrics); @Override boolean evictBlock(BlockCacheKey cacheKey); void logStats(); @Override void shutdown(); @Override CacheStats getStats(); @Override long heapSize(); @Override long size(); @Override long getFreeSize(); @Override long getBlockCount(); @Override long getCurrentSize(); @Override long getEvictedCount(); @Override int evictBlocksByHfileName(String hfileName); @Override List<BlockCacheColumnFamilySummary> getBlockCacheColumnFamilySummaries(
      Configuration conf); static final int DEFAULT_ERROR_TOLERATION_DURATION; }