Search in sources :

Example 1 with StorageTierAssoc

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);
    }
}
Also used : StorageTierAssoc(alluxio.StorageTierAssoc) WorkerStorageTierAssoc(alluxio.WorkerStorageTierAssoc) WorkerStorageTierAssoc(alluxio.WorkerStorageTierAssoc) IOException(java.io.IOException) AlluxioException(alluxio.exception.AlluxioException)

Example 2 with StorageTierAssoc

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()]);
}
Also used : StorageTierAssoc(alluxio.StorageTierAssoc) ArrayList(java.util.ArrayList)

Aggregations

StorageTierAssoc (alluxio.StorageTierAssoc)2 WorkerStorageTierAssoc (alluxio.WorkerStorageTierAssoc)1 AlluxioException (alluxio.exception.AlluxioException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1