private void initBlockMetadataManager(TachyonConf tachyonConf)
     throws AlreadyExistsException, IOException, OutOfSpaceException {
   // Initialize storage tiers
   int totalTiers = tachyonConf.getInt(Constants.WORKER_MAX_TIERED_STORAGE_LEVEL, 1);
   mAliasToTiers = new HashMap<Integer, StorageTier>(totalTiers);
   mTiers = new ArrayList<StorageTier>(totalTiers);
   for (int level = 0; level < totalTiers; level++) {
     StorageTier tier = StorageTier.newStorageTier(tachyonConf, level);
     mTiers.add(tier);
     mAliasToTiers.put(tier.getTierAlias(), tier);
   }
 }
Esempio n. 2
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());
     }
   }
 }
Esempio n. 3
0
 public BlockStoreLocation toBlockStoreLocation() {
   return new BlockStoreLocation(mTier.getTierAlias(), mTier.getTierLevel(), mDirIndex);
 }
Esempio n. 4
0
 // TODO: deprecate this method.
 public long getStorageDirId() {
   int level = mTier.getTierLevel();
   int storageLevelAliasValue = mTier.getTierAlias();
   return StorageDirId.getStorageDirId(level, storageLevelAliasValue, mDirIndex);
 }