[Javadocs] add to o.o.transport (#3220)

Adds javadocs to the org.opensearch.transport package.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2022-05-06 08:36:04 -05:00 committed by GitHub
parent ba6dc5d28b
commit a7715ab6ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 285 additions and 4 deletions

View File

@ -40,7 +40,7 @@ import java.io.IOException;
/**
* An exception indicating that a transport action was not found.
*
*
* @opensearch.internal
*/
public class ActionNotFoundTransportException extends TransportException {

View File

@ -41,7 +41,7 @@ import java.io.IOException;
/**
* An action invocation failure.
*
*
* @opensearch.internal
*/
public class ActionTransportException extends TransportException {

View File

@ -36,6 +36,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* A transport binding failure.
*
* @opensearch.internal
*/
public class BindTransportException extends TransportException {
public BindTransportException(StreamInput in) throws IOException {

View File

@ -42,6 +42,8 @@ import java.io.IOException;
/**
* A specialized, bytes only request, that can potentially be optimized on the network
* layer, specifically for the same large buffer send to several nodes.
*
* @opensearch.internal
*/
public class BytesTransportRequest extends TransportRequest {

View File

@ -37,6 +37,8 @@ import org.opensearch.common.concurrent.CompletableContext;
/**
* Abstract Transport.Connection that provides common close logic.
*
* @opensearch.internal
*/
public abstract class CloseableConnection implements Transport.Connection {

View File

@ -55,6 +55,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
* This class manages node connections within a cluster. The connection is opened by the underlying transport.
* Once the connection is opened, this class manages the connection. This includes closing the connection when
* the connection manager is closed.
*
* @opensearch.internal
*/
public class ClusterConnectionManager implements ConnectionManager {

View File

@ -55,6 +55,8 @@ import java.util.zip.DeflaterOutputStream;
*
* {@link CompressibleBytesOutputStream#close()} will NOT close the underlying stream. The byte stream passed
* in the constructor must be closed individually.
*
* @opensearch.internal
*/
final class CompressibleBytesOutputStream extends StreamOutput {

View File

@ -38,6 +38,11 @@ import org.opensearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
* Transport connection exception
*
* @opensearch.internal
*/
public class ConnectTransportException extends ActionTransportException {
private final DiscoveryNode node;

View File

@ -39,6 +39,11 @@ import java.io.Closeable;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Transport connection manager.
*
* @opensearch.internal
*/
public interface ConnectionManager extends Closeable {
void addListener(TransportConnectionListener listener);

View File

@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* A connection profile describes how many connection are established to specific node for each of the available request types.
* ({@link org.opensearch.transport.TransportRequestOptions.Type}). This allows to tailor a connection towards a specific usage.
*
* @opensearch.internal
*/
public final class ConnectionProfile {

View File

@ -35,6 +35,11 @@ package org.opensearch.transport;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.threadpool.ThreadPool;
/**
* Handler for empty transport response
*
* @opensearch.internal
*/
public class EmptyTransportResponseHandler implements TransportResponseHandler<TransportResponse.Empty> {
public static final EmptyTransportResponseHandler INSTANCE_SAME = new EmptyTransportResponseHandler(ThreadPool.Names.SAME);

View File

@ -36,6 +36,8 @@ import org.opensearch.threadpool.ThreadPool;
/**
* A response handler to be used when all interaction will be done through the {@link TransportFuture}.
*
* @opensearch.internal
*/
public abstract class FutureTransportResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> {

View File

@ -44,6 +44,11 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/**
* Transport Header
*
* @opensearch.internal
*/
public class Header {
private static final String RESPONSE_NAME = "NO_ACTION_NAME_FOR_RESPONSES";

View File

@ -48,6 +48,11 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
* Aggregates inbound data
*
* @opensearch.internal
*/
public class InboundAggregator implements Releasable {
private final Supplier<CircuitBreaker> circuitBreaker;

View File

@ -43,6 +43,11 @@ import org.opensearch.core.internal.io.IOUtils;
import java.io.IOException;
import java.util.function.Consumer;
/**
* Decodes inbound data off the wire
*
* @opensearch.internal
*/
public class InboundDecoder implements Releasable {
static final Object PING = new Object();

View File

@ -52,6 +52,11 @@ import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
/**
* Handler for inbound data
*
* @opensearch.internal
*/
public class InboundHandler {
private static final Logger logger = LogManager.getLogger(InboundHandler.class);

View File

@ -40,6 +40,11 @@ import org.opensearch.core.internal.io.IOUtils;
import java.io.IOException;
/**
* Inbound data as a message
*
* @opensearch.internal
*/
public class InboundMessage implements Releasable {
private final Header header;

View File

@ -48,6 +48,11 @@ import java.util.function.Function;
import java.util.function.LongSupplier;
import java.util.function.Supplier;
/**
* Pipeline for receiving inbound messages
*
* @opensearch.internal
*/
public class InboundPipeline implements Releasable {
private static final ThreadLocal<ArrayList<Object>> fragmentList = ThreadLocal.withInitial(ArrayList::new);

View File

@ -38,6 +38,8 @@ import org.opensearch.common.util.concurrent.ThreadContext;
/**
* Represents a transport message sent over the network. Subclasses implement serialization and
* deserialization.
*
* @opensearch.internal
*/
public abstract class NetworkMessage {

View File

@ -39,6 +39,8 @@ import java.io.IOException;
/**
* Thrown after failed to connect to all seed nodes of the remote cluster.
*
* @opensearch.internal
*/
public class NoSeedNodeLeftException extends OpenSearchException {

View File

@ -40,6 +40,8 @@ import java.io.IOException;
/**
* An exception that remote cluster is missing or
* connectivity to the remote connection is failing
*
* @opensearch.internal
*/
public final class NoSuchRemoteClusterException extends ResourceNotFoundException {

View File

@ -37,6 +37,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Exception thrown if a node disconnects
*
* @opensearch.internal
*/
public class NodeDisconnectedException extends ConnectTransportException {
public NodeDisconnectedException(DiscoveryNode node, String action) {

View File

@ -40,7 +40,7 @@ import java.io.IOException;
/**
* An exception indicating that a message is sent to a node that is not connected.
*
*
* @opensearch.internal
*/
public class NodeNotConnectedException extends ConnectTransportException {

View File

@ -37,6 +37,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Exception thrown if a node should not disconnect
*
* @opensearch.internal
*/
public class NodeShouldNotConnectException extends NodeNotConnectedException {
public NodeShouldNotConnectException(DiscoveryNode fromNode, DiscoveryNode node) {

View File

@ -36,6 +36,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Exception thrown if data is not serializable
*
* @opensearch.internal
*/
public class NotSerializableTransportException extends TransportException {
public NotSerializableTransportException(Throwable t) {

View File

@ -55,6 +55,11 @@ import org.opensearch.threadpool.ThreadPool;
import java.io.IOException;
import java.util.Set;
/**
* Outbound data handler
*
* @opensearch.internal
*/
final class OutboundHandler {
private static final Logger logger = LogManager.getLogger(OutboundHandler.class);

View File

@ -43,6 +43,11 @@ import org.opensearch.common.util.concurrent.ThreadContext;
import java.io.IOException;
import java.util.Set;
/**
* Outbound data as a message
*
* @opensearch.internal
*/
abstract class OutboundMessage extends NetworkMessage {
private final Writeable message;

View File

@ -42,6 +42,11 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Future for transporting data
*
* @opensearch.internal
*/
public class PlainTransportFuture<V extends TransportResponse> extends BaseFuture<V>
implements
TransportFuture<V>,

View File

@ -60,6 +60,11 @@ import java.util.stream.Stream;
import static org.opensearch.common.settings.Setting.intSetting;
/**
* Connect through a proxy
*
* @opensearch.internal
*/
public class ProxyConnectionStrategy extends RemoteConnectionStrategy {
/**

View File

@ -37,6 +37,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Thrown when receiving a timeout
*
* @opensearch.internal
*/
public class ReceiveTimeoutTransportException extends ActionTransportException {
public ReceiveTimeoutTransportException(DiscoveryNode node, String action, String msg) {

View File

@ -47,6 +47,8 @@ import java.util.function.Predicate;
/**
* Base class for all services and components that need up-to-date information about the registered remote clusters
*
* @opensearch.internal
*/
public abstract class RemoteClusterAware {

View File

@ -42,6 +42,11 @@ import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.settings.Settings;
import org.opensearch.threadpool.ThreadPool;
/**
* Client that is aware of remote clusters
*
* @opensearch.internal
*/
final class RemoteClusterAwareClient extends AbstractClient {
private final TransportService service;

View File

@ -34,6 +34,11 @@ package org.opensearch.transport;
import org.opensearch.cluster.node.DiscoveryNode;
/**
* Request for remote clusters
*
* @opensearch.internal
*/
public interface RemoteClusterAwareRequest {
/**

View File

@ -61,6 +61,8 @@ import java.util.function.Function;
* In the case of a disconnection, this class will issue a re-connect task to establish at most
* {@link SniffConnectionStrategy#REMOTE_CONNECTIONS_PER_CLUSTER} until either all eligible nodes are exhausted or the maximum number of
* connections per cluster has been reached.
*
* @opensearch.internal
*/
final class RemoteClusterConnection implements Closeable {

View File

@ -74,6 +74,8 @@ import static org.opensearch.common.settings.Setting.timeSetting;
/**
* Basic service for accessing remote clusters via gateway nodes
*
* @opensearch.internal
*/
public final class RemoteClusterService extends RemoteClusterAware implements Closeable {

View File

@ -54,6 +54,8 @@ import static java.util.Collections.emptyList;
/**
* This class encapsulates all remote cluster information to be rendered on
* {@code _remote/info} requests.
*
* @opensearch.internal
*/
public final class RemoteConnectionInfo implements ToXContentFragment, Writeable {

View File

@ -42,6 +42,11 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
/**
* Manager for connecting to remote nodes
*
* @opensearch.internal
*/
public class RemoteConnectionManager implements ConnectionManager {
private final String clusterAlias;

View File

@ -68,6 +68,11 @@ import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Strategy to connect to remote nodes
*
* @opensearch.internal
*/
public abstract class RemoteConnectionStrategy implements TransportConnectionListener, Closeable {
enum ConnectionStrategy {

View File

@ -42,7 +42,7 @@ import java.io.IOException;
* A remote exception for an action. A wrapper exception around the actual remote cause and does not fill the
* stack trace.
*
*
* @opensearch.internal
*/
public class RemoteTransportException extends ActionTransportException implements OpenSearchWrapperException {

View File

@ -38,6 +38,8 @@ import java.io.IOException;
/**
* A failure to handle the response of a transaction action.
*
* @opensearch.internal
*/
public class ResponseHandlerFailureTransportException extends TransportException {

View File

@ -38,6 +38,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Thrown when an error occurs while sending a request
*
* @opensearch.internal
*/
public class SendRequestTransportException extends ActionTransportException implements OpenSearchWrapperException {
public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) {

View File

@ -74,6 +74,11 @@ import java.util.stream.Stream;
import static org.opensearch.common.settings.Setting.intSetting;
/**
* Sniff for initial seed nodes
*
* @opensearch.internal
*/
public class SniffConnectionStrategy extends RemoteConnectionStrategy {
/**

View File

@ -37,6 +37,11 @@ import org.opensearch.common.lease.Releasable;
import java.io.IOException;
/**
* Transport channel for tasks
*
* @opensearch.internal
*/
public class TaskTransportChannel implements TransportChannel {
private final TransportChannel channel;

View File

@ -43,6 +43,8 @@ import java.net.InetSocketAddress;
* This is a tcp channel representing a single channel connection to another node. It is the base channel
* abstraction used by the {@link TcpTransport} and {@link TransportService}. All tcp transport
* implementations must return channels that adhere to the required method contracts.
*
* @opensearch.internal
*/
public interface TcpChannel extends CloseableChannel {

View File

@ -38,6 +38,11 @@ import org.opensearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
* Header for TCP messages
*
* @opensearch.internal
*/
public class TcpHeader {
public static final Version VERSION_WITH_HEADER_SIZE = LegacyESVersion.V_7_6_0;

View File

@ -40,6 +40,8 @@ import java.net.InetSocketAddress;
* This is a tcp channel representing a server channel listening for new connections. It is the server
* channel abstraction used by the {@link TcpTransport} and {@link TransportService}. All tcp transport
* implementations must return server channels that adhere to the required method contracts.
*
* @opensearch.internal
*/
public interface TcpServerChannel extends CloseableChannel {

View File

@ -109,6 +109,11 @@ import static org.opensearch.common.transport.NetworkExceptionHelper.isCloseConn
import static org.opensearch.common.transport.NetworkExceptionHelper.isConnectException;
import static org.opensearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap;
/**
* The TCP Transport layer
*
* @opensearch.internal
*/
public abstract class TcpTransport extends AbstractLifecycleComponent implements Transport {
private static final Logger logger = LogManager.getLogger(TcpTransport.class);

View File

@ -40,6 +40,11 @@ import java.io.IOException;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Channel for a TCP connection
*
* @opensearch.internal
*/
public final class TcpTransportChannel implements TransportChannel {
private final AtomicBoolean released = new AtomicBoolean();

View File

@ -53,6 +53,11 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Predicate;
/**
* OpenSearch Transport Interface
*
* @opensearch.internal
*/
public interface Transport extends LifecycleComponent {
/**

View File

@ -46,6 +46,8 @@ import java.util.function.Function;
* TransportActionProxy allows an arbitrary action to be executed on a defined target node while the initial request is sent to a second
* node that acts as a request proxy to the target node. This is useful if a node is not directly connected to a target node but is
* connected to an intermediate node that establishes a transitive connection.
*
* @opensearch.internal
*/
public final class TransportActionProxy {

View File

@ -41,6 +41,8 @@ import java.io.IOException;
/**
* A transport channel allows to send a response to a request on the channel.
*
* @opensearch.internal
*/
public interface TransportChannel {

View File

@ -38,6 +38,8 @@ import org.opensearch.cluster.node.DiscoveryNode;
* A listener interface that allows to react on transport events. All methods may be
* executed on network threads. Consumers must fork in the case of long running or blocking
* operations.
*
* @opensearch.internal
*/
public interface TransportConnectionListener {

View File

@ -47,6 +47,11 @@ import java.util.ArrayDeque;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
/**
* Decompresses data over the transport wire
*
* @opensearch.internal
*/
public class TransportDecompressor implements Closeable {
private final Inflater inflater;

View File

@ -37,6 +37,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Thrown for any transport errors
*
* @opensearch.internal
*/
public class TransportException extends OpenSearchException {
public TransportException(Throwable cause) {
super(cause);

View File

@ -35,6 +35,11 @@ package org.opensearch.transport;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/**
* Future for transport operations
*
* @opensearch.internal
*/
public interface TransportFuture<V> extends Future<V> {
/**

View File

@ -52,6 +52,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
/**
* Sends and receives transport-level connection handshakes. This class will send the initial handshake,
* manage state/timeouts while the handshake is in transit, and handle the eventual response.
*
* @opensearch.internal
*/
final class TransportHandshaker {

View File

@ -48,6 +48,11 @@ import java.util.Map;
import static org.opensearch.common.Booleans.parseBoolean;
/**
* Transport information
*
* @opensearch.internal
*/
public class TransportInfo implements ReportingService.Info {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TransportInfo.class);

View File

@ -37,6 +37,8 @@ import org.opensearch.common.io.stream.Writeable.Reader;
/**
* This interface allows plugins to intercept requests on both the sender and the receiver side.
*
* @opensearch.internal
*/
public interface TransportInterceptor {
/**

View File

@ -56,6 +56,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
* Implements the scheduling and sending of keep alive pings. Client channels send keep alive pings to the
* server and server channels respond. Pings are only sent at the scheduled time if the channel did not send
* and receive a message since the last ping.
*
* @opensearch.internal
*/
final class TransportKeepAlive implements Closeable {

View File

@ -43,6 +43,11 @@ import org.opensearch.core.internal.io.IOUtils;
import java.io.IOException;
/**
* Logs transport activity
*
* @opensearch.internal
*/
public final class TransportLogger {
private static final Logger logger = LogManager.getLogger(TransportLogger.class);

View File

@ -36,6 +36,11 @@ import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.Writeable;
import org.opensearch.common.transport.TransportAddress;
/**
* Message over the transport interface
*
* @opensearch.internal
*/
public abstract class TransportMessage implements Writeable {
private TransportAddress remoteAddress;

View File

@ -33,6 +33,11 @@ package org.opensearch.transport;
import org.opensearch.cluster.node.DiscoveryNode;
/**
* Listens for transport messages
*
* @opensearch.internal
*/
public interface TransportMessageListener {
TransportMessageListener NOOP_LISTENER = new TransportMessageListener() {

View File

@ -39,6 +39,11 @@ import org.opensearch.tasks.TaskId;
import java.io.IOException;
/**
* A transport request
*
* @opensearch.internal
*/
public abstract class TransportRequest extends TransportMessage implements TaskAwareRequest {
public static class Empty extends TransportRequest {
public static final Empty INSTANCE = new Empty();

View File

@ -44,6 +44,8 @@ import java.util.function.BiConsumer;
* Deduplicator for {@link TransportRequest}s that keeps track of {@link TransportRequest}s that should
* not be sent in parallel.
* @param <T> Transport Request Class
*
* @opensearch.internal
*/
public final class TransportRequestDeduplicator<T extends TransportRequest> {

View File

@ -34,6 +34,11 @@ package org.opensearch.transport;
import org.opensearch.tasks.Task;
/**
* Handles transport requests
*
* @opensearch.internal
*/
public interface TransportRequestHandler<T extends TransportRequest> {
void messageReceived(T request, TransportChannel channel, Task task) throws Exception;

View File

@ -34,6 +34,11 @@ package org.opensearch.transport;
import org.opensearch.common.unit.TimeValue;
/**
* Options for transport requests
*
* @opensearch.internal
*/
public class TransportRequestOptions {
private final TimeValue timeout;

View File

@ -37,6 +37,11 @@ import org.opensearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
* Response over the transport interface
*
* @opensearch.internal
*/
public abstract class TransportResponse extends TransportMessage {
/**

View File

@ -38,6 +38,11 @@ import org.opensearch.common.io.stream.Writeable;
import java.io.IOException;
import java.util.function.Function;
/**
* Handles transport responses
*
* @opensearch.internal
*/
public interface TransportResponseHandler<T extends TransportResponse> extends Writeable.Reader<T> {
void handleResponse(T response);

View File

@ -36,6 +36,11 @@ import org.opensearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* Thrown if there is an error serializing data for transport
*
* @opensearch.internal
*/
public class TransportSerializationException extends TransportException {
public TransportSerializationException(StreamInput in) throws IOException {

View File

@ -87,6 +87,11 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
* The main OpenSearch transport service
*
* @opensearch.internal
*/
public class TransportService extends AbstractLifecycleComponent
implements
ReportingService<TransportInfo>,

View File

@ -49,6 +49,11 @@ import static org.opensearch.common.settings.Setting.intSetting;
import static org.opensearch.common.settings.Setting.listSetting;
import static org.opensearch.common.settings.Setting.timeSetting;
/**
* Settings for transport config
*
* @opensearch.internal
*/
public final class TransportSettings {
public static final String DEFAULT_PROFILE = "default";

View File

@ -42,6 +42,11 @@ import org.opensearch.common.xcontent.XContentBuilder;
import java.io.IOException;
/**
* Stats for transport activity
*
* @opensearch.internal
*/
public class TransportStats implements Writeable, ToXContentFragment {
private final long serverOpen;

View File

@ -32,6 +32,11 @@
package org.opensearch.transport;
/**
* Status for transport activity
*
* @opensearch.internal
*/
public final class TransportStatus {
private static final byte STATUS_REQRES = 1 << 0;

View File

@ -38,6 +38,11 @@ import org.opensearch.tasks.Task;
import java.util.Arrays;
/**
* Utility class for transport
*
* @opensearch.internal
*/
public enum Transports {
;