use of alluxio.StorageTierAssoc in project alluxio by Alluxio.
the class BlockMasterSync method registerWithMaster.
/**
* Registers with the Alluxio master. This should be called before the continuous heartbeat thread
* begins.
*
* @throws IOException when workerId cannot be found
* @throws ConnectionFailedException if network connection failed
*/
private void registerWithMaster() throws IOException, ConnectionFailedException {
BlockStoreMeta storeMeta = mBlockWorker.getStoreMetaFull();
try {
StorageTierAssoc storageTierAssoc = new WorkerStorageTierAssoc();
mMasterClient.register(mWorkerId.get(), storageTierAssoc.getOrderedStorageAliases(), storeMeta.getCapacityBytesOnTiers(), storeMeta.getUsedBytesOnTiers(), storeMeta.getBlockList());
} catch (IOException e) {
LOG.error("Failed to register with master.", e);
throw e;
} catch (AlluxioException e) {
LOG.error("Failed to register with master.", e);
throw new IOException(e);
}
}
use of alluxio.StorageTierAssoc in project alluxio by Alluxio.
the class WebInterfaceGeneralServlet method generateOrderedStorageTierInfo.
/**
* Lists the {@link StorageTierInfo} objects of each storage level alias.
*
* @return the list of {@link StorageTierInfo} objects, in order from highest tier to lowest
*/
private StorageTierInfo[] generateOrderedStorageTierInfo() {
StorageTierAssoc globalStorageTierAssoc = mMaster.getBlockMaster().getGlobalStorageTierAssoc();
List<StorageTierInfo> infos = new ArrayList<>();
Map<String, Long> totalBytesOnTiers = mMaster.getBlockMaster().getTotalBytesOnTiers();
Map<String, Long> usedBytesOnTiers = mMaster.getBlockMaster().getUsedBytesOnTiers();
for (int ordinal = 0; ordinal < globalStorageTierAssoc.size(); ordinal++) {
String tierAlias = globalStorageTierAssoc.getAlias(ordinal);
if (totalBytesOnTiers.containsKey(tierAlias) && totalBytesOnTiers.get(tierAlias) > 0) {
StorageTierInfo info = new StorageTierInfo(tierAlias, totalBytesOnTiers.get(tierAlias), usedBytesOnTiers.get(tierAlias));
infos.add(info);
}
}
return infos.toArray(new StorageTierInfo[infos.size()]);
}
Aggregations