/** * @param workerNetAddress the worker address * @param conf Alluxio configuration * @return true if the domain socket is enabled on this client */ public static boolean isDomainSocketSupported(WorkerNetAddress workerNetAddress, AlluxioConfiguration conf) { if (workerNetAddress.getDomainSocketPath().isEmpty() || getUserChannel(conf) != ChannelType.EPOLL) { return false; } if (conf.getBoolean(PropertyKey.WORKER_DATA_SERVER_DOMAIN_SOCKET_AS_UUID)) { return FileUtils.exists(workerNetAddress.getDomainSocketPath()); } else { return workerNetAddress.getHost().equals(NetworkAddressUtils.getClientHostName(conf)); } }
/** * 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; }
/** * 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(); }
/** * @param workerNetAddress the worker address * @return true if the domain socket is enabled on this client */ public static boolean isDomainSocketSupported(WorkerNetAddress workerNetAddress) { if (workerNetAddress.getDomainSocketPath().isEmpty() || USER_CHANNEL_TYPE != ChannelType.EPOLL) { return false; } if (Configuration.getBoolean(PropertyKey.WORKER_DATA_SERVER_DOMAIN_SOCKET_AS_UUID)) { return FileUtils.exists(workerNetAddress.getDomainSocketPath()); } else { return workerNetAddress.getHost().equals(NetworkAddressUtils.getClientHostName()); } }
/** * 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; }