Package org.opensearch.transport
Interface Transport
- All Superinterfaces:
AutoCloseable
,Closeable
,org.opensearch.common.lifecycle.LifecycleComponent
,org.opensearch.common.lease.Releasable
- All Known Implementing Classes:
TcpTransport
@PublicApi(since="1.0.0")
public interface Transport
extends org.opensearch.common.lifecycle.LifecycleComponent
OpenSearch Transport Interface
- Opensearch.api:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A unidirectional connection to aDiscoveryNode
static final class
Request handler implementationsstatic final class
Transport.ResponseContext<T extends org.opensearch.core.transport.TransportResponse>
This class represents a response context that encapsulates the actual response handler, the action and the connection it was executed on.static final class
This class is a registry that allows -
Method Summary
Modifier and TypeMethodDescriptionorg.opensearch.core.common.transport.TransportAddress[]
addressesFromString
(String address) Returns an address from its string representation.org.opensearch.core.common.transport.BoundTransportAddress
The address the transport is bound on.Returns a list of all local addresses for this transportgetStats()
default boolean
isSecure()
void
openConnection
(DiscoveryNode node, ConnectionProfile profile, org.opensearch.core.action.ActionListener<Transport.Connection> listener) Opens a new connection to the given node.Further profile bound addressesdefault <Request extends TransportRequest>
voidregisterRequestHandler
(RequestHandlerRegistry<Request> reg) Registers a new request handlerstatic int
resolvePublishPort
(int publishPort, List<InetSocketAddress> boundAddresses, InetAddress publishInetAddress) Resolve the publishPort for a server provided a list of boundAddresses and a publishInetAddress.static int
resolveTransportPublishPort
(int publishPort, List<org.opensearch.core.common.transport.TransportAddress> boundAddresses, InetAddress publishInetAddress) void
setMessageListener
(TransportMessageListener listener) default void
setSlowLogThreshold
(org.opensearch.common.unit.TimeValue slowLogThreshold) Methods inherited from interface org.opensearch.common.lifecycle.LifecycleComponent
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
Methods inherited from interface org.opensearch.common.lease.Releasable
close
-
Method Details
-
registerRequestHandler
default <Request extends TransportRequest> void registerRequestHandler(RequestHandlerRegistry<Request> reg) Registers a new request handler -
setMessageListener
-
setSlowLogThreshold
default void setSlowLogThreshold(org.opensearch.common.unit.TimeValue slowLogThreshold) -
isSecure
default boolean isSecure() -
boundAddress
org.opensearch.core.common.transport.BoundTransportAddress boundAddress()The address the transport is bound on. -
profileBoundAddresses
Further profile bound addresses- Returns:
null
iff profiles are unsupported, otherwise a map with name of profile and its bound transport address
-
addressesFromString
org.opensearch.core.common.transport.TransportAddress[] addressesFromString(String address) throws UnknownHostException Returns an address from its string representation.- Throws:
UnknownHostException
-
getDefaultSeedAddresses
Returns a list of all local addresses for this transport -
openConnection
void openConnection(DiscoveryNode node, ConnectionProfile profile, org.opensearch.core.action.ActionListener<Transport.Connection> listener) Opens a new connection to the given node. When the connection is fully connected, the listener is called. The ActionListener will be called on the calling thread or the generic thread pool. -
getStats
TransportStats getStats() -
getResponseHandlers
Transport.ResponseHandlers getResponseHandlers() -
getRequestHandlers
Transport.RequestHandlers getRequestHandlers() -
resolvePublishPort
static int resolvePublishPort(int publishPort, List<InetSocketAddress> boundAddresses, InetAddress publishInetAddress) Resolve the publishPort for a server provided a list of boundAddresses and a publishInetAddress. Resolution strategy is as follows: If a configured port exists resolve to that port. If a bound address matches the publishInetAddress resolve to that port. If a bound address is a wildcard address resolve to that port. If all bound addresses share the same port resolve to that port.- Parameters:
publishPort
- -1 if no configured publish port existsboundAddresses
- addresses bound by the serverpublishInetAddress
- address published for the server- Returns:
- Resolved port. If publishPort is negative and no port can be resolved return publishPort.
-
resolveTransportPublishPort
static int resolveTransportPublishPort(int publishPort, List<org.opensearch.core.common.transport.TransportAddress> boundAddresses, InetAddress publishInetAddress)
-