@Test public void getBlockLocations() { mInfo.addWorker(1, "MEM"); mInfo.addWorker(2, "MEM"); mInfo.addWorker(3, "HDD"); List<MasterBlockLocation> locations = mInfo.getBlockLocations(); Set<MasterBlockLocation> expectedLocations = ImmutableSet.of( new MasterBlockLocation(1, "MEM"), new MasterBlockLocation(2, "MEM"), new MasterBlockLocation(3, "HDD")); assertEquals(expectedLocations, ImmutableSet.copyOf(locations)); }
public List<MasterBlockLocation> getBlockLocations() { List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size()); for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) { ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue())); } return ret; }
MasterBlockInfo { public List<MasterBlockLocation> getBlockLocations() { List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size()); for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) { ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue())); } return ret; } }
MasterBlockInfo { public List<MasterBlockLocation> getBlockLocations() { List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size()); for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) { ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue())); } return ret; } MasterBlockInfo(long blockId, long length); }
MasterBlockInfo { public List<MasterBlockLocation> getBlockLocations() { List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size()); for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) { ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue())); } return ret; } MasterBlockInfo(long blockId, long length); long getLength(); synchronized void updateLength(long length); long getBlockId(); void addWorker(long workerId, String tierAlias); void removeWorker(long workerId); Set<Long> getWorkers(); int getNumLocations(); List<MasterBlockLocation> getBlockLocations(); boolean isInTier(String targetTierAlias); @Override String toString(); }
MasterBlockInfo { public List<MasterBlockLocation> getBlockLocations() { List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size()); for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) { ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue())); } return ret; } MasterBlockInfo(long blockId, long length); long getLength(); synchronized void updateLength(long length); long getBlockId(); void addWorker(long workerId, String tierAlias); void removeWorker(long workerId); Set<Long> getWorkers(); int getNumLocations(); List<MasterBlockLocation> getBlockLocations(); boolean isInTier(String targetTierAlias); @Override String toString();  }