@Test public void updateUsedBytes() { assertEquals(Constants.KB * 2L, mInfo.getUsedBytes()); Map<String, Long> usedBytesOnTiers = ImmutableMap.of("MEM", Constants.KB * 2L, "SSD", (long) Constants.KB); mInfo.updateUsedBytes(usedBytesOnTiers); assertEquals(usedBytesOnTiers, mInfo.getUsedBytesOnTiers()); assertEquals(Constants.KB * 3L, mInfo.getUsedBytes()); }
public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } }
MasterWorkerInfo { public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } } }
MasterWorkerInfo { public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } } MasterWorkerInfo(long id, WorkerNetAddress address); }
MasterWorkerInfo { public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } } MasterWorkerInfo(long id, WorkerNetAddress address); Set<Long> register(final StorageTierAssoc globalStorageTierAssoc,
      final List<String> storageTierAliases, final Map<String, Long> totalBytesOnTiers,
      final Map<String, Long> usedBytesOnTiers, final Set<Long> blocks); void addBlock(long blockId); void removeBlock(long blockId); void addLostStorage(String tierAlias, String dirPath); void addLostStorage(Map<String, StorageList> lostStorage); WorkerInfo generateWorkerInfo(Set<WorkerInfoField> fieldRange, boolean isLiveWorker); WorkerNetAddress getWorkerAddress(); long getAvailableBytes(); Set<Long> getBlocks(); long getCapacityBytes(); long getId(); long getLastUpdatedTimeMs(); List<Long> getToRemoveBlocks(); long getUsedBytes(); StorageTierAssoc getStorageTierAssoc(); Map<String, Long> getTotalBytesOnTiers(); Map<String, Long> getUsedBytesOnTiers(); long getStartTime(); boolean isRegistered(); Map<String, Long> getFreeBytesOnTiers(); Map<String, List<String>> getLostStorage(); boolean hasLostStorage(); @Override String toString(); void updateLastUpdatedTimeMs(); void updateToRemovedBlock(boolean add, long blockId); void updateCapacityBytes(Map<String, Long> capacityBytesOnTiers); void updateUsedBytes(Map<String, Long> usedBytesOnTiers); void updateUsedBytes(String tierAlias, long usedBytesOnTier); }
MasterWorkerInfo { public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } } MasterWorkerInfo(long id, WorkerNetAddress address); Set<Long> register(final StorageTierAssoc globalStorageTierAssoc,
      final List<String> storageTierAliases, final Map<String, Long> totalBytesOnTiers,
      final Map<String, Long> usedBytesOnTiers, final Set<Long> blocks); void addBlock(long blockId); void removeBlock(long blockId); void addLostStorage(String tierAlias, String dirPath); void addLostStorage(Map<String, StorageList> lostStorage); WorkerInfo generateWorkerInfo(Set<WorkerInfoField> fieldRange, boolean isLiveWorker); WorkerNetAddress getWorkerAddress(); long getAvailableBytes(); Set<Long> getBlocks(); long getCapacityBytes(); long getId(); long getLastUpdatedTimeMs(); List<Long> getToRemoveBlocks(); long getUsedBytes(); StorageTierAssoc getStorageTierAssoc(); Map<String, Long> getTotalBytesOnTiers(); Map<String, Long> getUsedBytesOnTiers(); long getStartTime(); boolean isRegistered(); Map<String, Long> getFreeBytesOnTiers(); Map<String, List<String>> getLostStorage(); boolean hasLostStorage(); @Override String toString(); void updateLastUpdatedTimeMs(); void updateToRemovedBlock(boolean add, long blockId); void updateCapacityBytes(Map<String, Long> capacityBytesOnTiers); void updateUsedBytes(Map<String, Long> usedBytesOnTiers); void updateUsedBytes(String tierAlias, long usedBytesOnTier);  }