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()); } } }
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); }