/** * Extracts dataPort socket address from Alluxio representation of network address. * * @param netAddress the input network address representation * @param conf Alluxio configuration * @return the socket address */ public static SocketAddress getDataPortSocketAddress(WorkerNetAddress netAddress, AlluxioConfiguration conf) { SocketAddress address; if (NettyUtils.isDomainSocketSupported(netAddress, conf)) { address = new DomainSocketAddress(netAddress.getDomainSocketPath()); } else { String host = netAddress.getHost(); int port = netAddress.getDataPort(); address = new InetSocketAddress(host, port); } return address; }
.map(worker -> HostAndPort.fromParts(worker.getHost(), worker.getDataPort())) .collect(toList()); String[] names = addresses.stream().map(HostAndPort::toString).toArray(String[]::new);
PowerMockito.when(blockStore.getEligibleWorkers()).thenReturn(eligibleWorkerInfos); List<HostAndPort> expectedWorkerNames = expectedWorkers.stream() .map(addr -> HostAndPort.fromParts(addr.getHost(), addr.getDataPort())).collect(toList()); FileSystem alluxioHadoopFs = new FileSystem(alluxioFs); Whitebox.setInternalState(alluxioHadoopFs, "mFsContext", mMockFileSystemContext);
public void checkEquality(WorkerNetAddress a, WorkerNetAddress b) { Assert.assertEquals(a.getHost(), b.getHost()); Assert.assertEquals(a.getRpcPort(), b.getRpcPort()); Assert.assertEquals(a.getDataPort(), b.getDataPort()); Assert.assertEquals(a.getWebPort(), b.getWebPort()); Assert.assertEquals(a.getTieredIdentity(), b.getTieredIdentity()); Assert.assertEquals(a, b); }
AsyncCacheRequest.newBuilder().setBlockId(blockId).setLength(blockLength) .setOpenUfsBlockOptions(mOptions.getOpenUfsBlockOptions(blockId)) .setSourceHost(dataSource.getHost()).setSourcePort(dataSource.getDataPort()) .build(); BlockWorkerClient blockWorker = mContext.acquireBlockWorkerClient(worker);
/** * Converts wire type to proto type. * * @param workerNetAddress the wire representation to convert * @return the converted proto representation */ public static alluxio.grpc.WorkerNetAddress toProto(WorkerNetAddress workerNetAddress) { alluxio.grpc.WorkerNetAddress.Builder address = alluxio.grpc.WorkerNetAddress.newBuilder() .setHost(workerNetAddress.getHost()).setRpcPort(workerNetAddress.getRpcPort()) .setDataPort(workerNetAddress.getDataPort()).setWebPort(workerNetAddress.getWebPort()) .setDomainSocketPath(workerNetAddress.getDomainSocketPath()); if (workerNetAddress.getTieredIdentity() != null) { address.setTieredIdentity(toProto(workerNetAddress.getTieredIdentity())); } return address.build(); }
locations.add(address.getHost() + ":" + address.getDataPort());
/** * Extracts dataPort socket address from Alluxio representation of network address. * * @param netAddress the input network address representation * @return the socket address */ public static SocketAddress getDataPortSocketAddress(WorkerNetAddress netAddress) { SocketAddress address; if (NettyUtils.isDomainSocketSupported(netAddress)) { address = new DomainSocketAddress(netAddress.getDomainSocketPath()); } else { String host = netAddress.getHost(); int port = netAddress.getDataPort(); address = new InetSocketAddress(host, port); } return address; }
.map(worker -> HostAndPort.fromParts(worker.getHost(), worker.getDataPort())) .collect(toList()); String[] names = addresses.stream().map(HostAndPort::toString).toArray(String[]::new);
/** * Creates a new remote block input stream. * * @param blockId the block id * @param blockSize the block size * @param workerNetAddress the address of the worker to read from * @throws IOException if the block is not available on the remote worker */ public RemoteBlockInStream(long blockId, long blockSize, WorkerNetAddress workerNetAddress) throws IOException { super(blockId, blockSize); mWorkerNetAddress = workerNetAddress; mWorkerInetSocketAddress = new InetSocketAddress(workerNetAddress.getHost(), workerNetAddress.getDataPort()); mContext = BlockStoreContext.INSTANCE; mBlockWorkerClient = mContext.acquireWorkerClient(mWorkerInetSocketAddress.getHostName()); try { mLockId = mBlockWorkerClient.lockBlock(blockId).getLockId(); if (mLockId == null) { throw new IOException(ExceptionMessage.BLOCK_UNAVAILABLE.getMessage(blockId)); } } catch (IOException e) { mContext.releaseWorkerClient(mBlockWorkerClient); throw e; } }
for (WorkerNetAddress addr : addrs) { String name = addr.getHost() + ":" + addr.getDataPort(); LOG.debug("getFileBlockLocations : adding name : {}", name); names.add(name);
locations.add(address.getHost() + ":" + address.getDataPort());