private void addLocations(FileBlockInfo fileBlockInfo) { Set<String> locations = new HashSet<>(); // add alluxio locations for (BlockLocation location : fileBlockInfo.getBlockInfo().getLocations()) { locations.add(location.getWorkerAddress().getHost()); } // add underFS locations for (String location : fileBlockInfo.getUfsLocations()) { locations.add(HostAndPort.fromString(location).getHost()); } mLocations.addAll(locations); }
.stream().map(alluxio.wire.BlockLocation::getWorkerAddress).collect(toList()); if (locations.isEmpty()) { // No in-Alluxio location if (!fileBlockInfo.getUfsLocations().isEmpty()) { locations = fileBlockInfo.getUfsLocations().stream().map( location -> finalWorkerHosts.get(HostAndPort.fromString(location).getHost())) .filter(Objects::nonNull).collect(toList());
/** * Converts wire type to proto type. * * @param fileBlockInfo the wire representation to convert * @return converted proto representation */ public static alluxio.grpc.FileBlockInfo toProto(FileBlockInfo fileBlockInfo) { List<alluxio.grpc.WorkerNetAddress> ufsLocations = new ArrayList<>(); for (String ufsLocation : fileBlockInfo.getUfsLocations()) { HostAndPort address = HostAndPort.fromString(ufsLocation); ufsLocations.add(alluxio.grpc.WorkerNetAddress.newBuilder().setHost(address.getHost()) .setDataPort(address.getPortOrDefault(-1)).build()); } return alluxio.grpc.FileBlockInfo.newBuilder() .setBlockInfo(toProto(fileBlockInfo.getBlockInfo())).setOffset(fileBlockInfo.getOffset()) .addAllUfsLocations(ufsLocations).addAllUfsStringLocations(fileBlockInfo.getUfsLocations()) .build(); }
public void checkEquality(FileBlockInfo a, FileBlockInfo b) { Assert.assertEquals(a.getBlockInfo(), b.getBlockInfo()); Assert.assertEquals(a.getOffset(), b.getOffset()); Assert.assertEquals(a.getUfsLocations(), b.getUfsLocations()); Assert.assertEquals(a, b); }
locations.addAll(blockInfo.getUfsLocations()); toAdd.setFileLocations(locations);
private void addLocations(FileBlockInfo fileBlockInfo) { Set<String> locations = new HashSet<>(); // add alluxio locations for (BlockLocation location : fileBlockInfo.getBlockInfo().getLocations()) { locations.add(location.getWorkerAddress().getHost()); } // add underFS locations for (String location : fileBlockInfo.getUfsLocations()) { locations.add(HostAndPort.fromString(location).getHostText()); } mLocations.addAll(locations); }
locations = fileBlockInfo.getUfsLocations().stream() .map(location -> finalWorkerHosts.get(HostAndPort.fromString(location).getHostText())) .filter(Objects::nonNull).collect(toList());
addrs.addAll(info.getUfsLocations()); for (WorkerNetAddress addr : addrs) {
locations.addAll(blockInfo.getUfsLocations()); toAdd.setFileLocations(locations);