private void addLocations(FileBlockInfo fileBlockInfo) { Set<String> locations = Sets.newHashSet(); // add tachyon locations for (BlockLocation location : fileBlockInfo.getBlockInfo().getLocations()) { locations.add(location.getWorkerAddress().getHost()); } // add underFS locations for (NetAddress address : fileBlockInfo.getUfsLocations()) { locations.add(address.getHost()); } mLocations.addAll(locations); }
for (int k = 0; k < blocks.size(); k ++) { FileBlockInfo info = blocks.get(k); long offset = info.getOffset(); long end = offset + info.blockInfo.getLength(); List<NetAddress> addrs = Lists.newArrayList(); for (tachyon.thrift.BlockLocation location : info.getBlockInfo().getLocations()) { addrs.add(location.getWorkerAddress()); addrs.addAll(info.getUfsLocations()); for (NetAddress addr : addrs) {
public UiBlockInfo(FileBlockInfo fileBlockInfo) { Preconditions.checkNotNull(fileBlockInfo); mId = fileBlockInfo.getBlockInfo().getBlockId(); mBlockLength = fileBlockInfo.getBlockInfo().getLength(); mInMemory = isInMemory(fileBlockInfo.getBlockInfo()); mLastAccessTimeMs = -1; addLocations(fileBlockInfo); }
throws InvalidPathException { FileBlockInfo fileBlockInfo = new FileBlockInfo(); fileBlockInfo.blockInfo = blockInfo; fileBlockInfo.ufsLocations = new ArrayList<NetAddress>();
/** * Returns the net address of all the location hosts * * @return the list of those net address, in String * @throws IOException if the underlying file does not exist or its metadata is corrupted */ public List<String> getLocationHosts() throws IOException { List<String> ret = Lists.newArrayList(); if (getNumberOfBlocks() > 0) { // add tachyon locations first List<BlockLocation> blockLocations = getClientBlockInfo(0).getBlockInfo().getLocations(); if (blockLocations != null) { for (BlockLocation location : blockLocations) { ret.add(location.workerAddress.host); } } // under FS locations List<NetAddress> underFsLocations = getClientBlockInfo(0).getUfsLocations(); if (underFsLocations != null) { for (NetAddress location : underFsLocations) { ret.add(location.host); } } } return ret; }
List<NetAddress> addrs = Lists.newArrayList(); for (BlockLocation location : blockInfo.getBlockInfo().getLocations()) { addrs.add(location.getWorkerAddress()); addrs.addAll(blockInfo.getUfsLocations()); toAdd.setFileLocations(addrs);