@Test public void updateToRemovedBlock() { mInfo.updateToRemovedBlock(true, 10L); assertTrue(mInfo.getToRemoveBlocks().isEmpty()); mInfo.updateToRemovedBlock(true, 1L); assertTrue(mInfo.getToRemoveBlocks().contains(1L)); mInfo.updateToRemovedBlock(false, 1L); assertTrue(mInfo.getToRemoveBlocks().isEmpty()); mInfo.updateToRemovedBlock(true, 1L); mInfo.removeBlock(1L); assertTrue(mInfo.getToRemoveBlocks().isEmpty()); }
public void updateToRemovedBlock(boolean add, long blockId) { if (add) { if (mBlocks.contains(blockId)) { mToRemoveBlocks.add(blockId); } } else { mToRemoveBlocks.remove(blockId); } }
MasterWorkerInfo { public void updateToRemovedBlock(boolean add, long blockId) { if (add) { if (mBlocks.contains(blockId)) { mToRemoveBlocks.add(blockId); } } else { mToRemoveBlocks.remove(blockId); } } }
MasterWorkerInfo { public void updateToRemovedBlock(boolean add, long blockId) { if (add) { if (mBlocks.contains(blockId)) { mToRemoveBlocks.add(blockId); } } else { mToRemoveBlocks.remove(blockId); } } MasterWorkerInfo(long id, WorkerNetAddress address); }
MasterWorkerInfo { public void updateToRemovedBlock(boolean add, long blockId) { if (add) { if (mBlocks.contains(blockId)) { mToRemoveBlocks.add(blockId); } } else { mToRemoveBlocks.remove(blockId); } } 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 updateToRemovedBlock(boolean add, long blockId) { if (add) { if (mBlocks.contains(blockId)) { mToRemoveBlocks.add(blockId); } } else { mToRemoveBlocks.remove(blockId); } } 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);  }