public static BlockMetadataManager newBlockMetadataManager(TachyonConf tachyonConf) { BlockMetadataManager ret = new BlockMetadataManager(); try { ret.initBlockMetadataManager(tachyonConf); // caller of newBlockMetadataManager should not be forced to catch and handle these exceptions // since it is the responsibility of BlockMetadataManager. } catch (AlreadyExistsException aee) { throw new RuntimeException(aee); } catch (IOException ioe) { throw new RuntimeException(ioe); } catch (OutOfSpaceException ooe) { throw new RuntimeException(ooe); } return ret; }
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); }