Example #1
0
 public BlockStoreMeta(BlockMetadataManager manager) {
   Preconditions.checkNotNull(manager);
   for (StorageTier tier : manager.getTiers()) {
     int aliasIndex = tier.getTierAlias() - 1;
     mCapacityBytesOnTiers.set(
         aliasIndex, mCapacityBytesOnTiers.get(aliasIndex) + tier.getCapacityBytes());
     mUsedBytesOnTiers.set(
         aliasIndex,
         mUsedBytesOnTiers.get(aliasIndex) + (tier.getCapacityBytes() - tier.getAvailableBytes()));
     for (StorageDir dir : tier.getStorageDirs()) {
       mBlockIdsOnDirs.put(dir.getStorageDirId(), dir.getBlockIds());
       mCapacityBytesOnDirs.put(dir.getStorageDirId(), dir.getCapacityBytes());
       mUsedBytesOnDirs.put(
           dir.getStorageDirId(), dir.getCapacityBytes() - dir.getAvailableBytes());
       mDirPaths.put(dir.getStorageDirId(), dir.getDirPath());
     }
   }
 }
Example #2
0
 private void cache(long sessionId, long blockId, long bytes, int tierLevel, int dirIdx)
     throws Exception {
   StorageDir dir = mMetaManager.getTiers().get(tierLevel).getDir(dirIdx);
   TieredBlockStoreTestUtils.cache(sessionId, blockId, bytes, dir, mMetaManager, mEvictor);
 }