Interface Transport
-
- All Known Implementing Classes:
AeronUdpTransport
,BaseTransport
,DelayedDummyTransport
,DummyTransport
public interface Transport
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends RequestMessage>
voidaddRequestConsumer(Class<T> cls, io.reactivex.functions.Consumer<T> consumer)
This methd allows to set callback instance for variousvoid
ensureConnection(String id)
This method checks connection to the given node ID, and if it's not connected - establishes connectionString
getRandomDownstreamFrom(String id, String exclude)
This method returns randomString
getRootId()
This method returns ID of the root nodeString
getUpstreamId()
This methos returns Id of the upstream nodeString
id()
This method returns id of the current transportorg.reactivestreams.Publisher<INDArrayMessage>
incomingPublisher()
This method returns flow of messages for parameter serverboolean
isConnected()
This method checks if all connections required for work are establishedboolean
isIntroduced()
This method checks if this node was properly introduced to drivervoid
launch()
This method starts this Transport instancevoid
launchAsMaster()
This method will start this Transport instancevoid
onMeshUpdate(MeshOrganizer mesh)
This method will be called if mesh update was received PLEASE NOTE: This method will be called ONLY if new mesh differs from current onevoid
onRemap(String id)
This method will be called upon remap requestio.reactivex.functions.Consumer<VoidMessage>
outgoingConsumer()
This method returns consumer that accepts messages for deliveryvoid
processMessage(VoidMessage message)
This method will be invoked for all incoming messages PLEASE NOTE: this method is mostly suited for testsvoid
propagateMessage(VoidMessage message, PropagationMode mode)
This method will send message to the network, using tree structurevoid
sendMessage(VoidMessage message, String id)
This method will send message to the node specified by Id<T extends ResponseMessage>
TsendMessageBlocking(RequestMessage message, String id)
This method will send message to specified node, and will return its response<T extends ResponseMessage>
TsendMessageBlocking(RequestMessage message, String id, long waitTime, TimeUnit timeUnit)
This method will send message to specified node, and will return its responsevoid
setRestartCallback(RestartCallback callback)
This method allows to set callback instance, which will be called upon restart eventvoid
shutdown()
This method shuts down this Transport instanceint
totalNumberOfNodes()
This method returns total number of nodes known to this Transport
-
-
-
Method Detail
-
id
String id()
This method returns id of the current transport- Returns:
-
getUpstreamId
String getUpstreamId()
This methos returns Id of the upstream node- Returns:
-
getRandomDownstreamFrom
String getRandomDownstreamFrom(String id, String exclude)
This method returns random- Parameters:
id
-exclude
-- Returns:
-
outgoingConsumer
io.reactivex.functions.Consumer<VoidMessage> outgoingConsumer()
This method returns consumer that accepts messages for delivery- Returns:
-
incomingPublisher
org.reactivestreams.Publisher<INDArrayMessage> incomingPublisher()
This method returns flow of messages for parameter server- Returns:
-
launch
void launch()
This method starts this Transport instance
-
launchAsMaster
void launchAsMaster()
This method will start this Transport instance
-
shutdown
void shutdown()
This method shuts down this Transport instance
-
propagateMessage
void propagateMessage(VoidMessage message, PropagationMode mode) throws IOException
This method will send message to the network, using tree structure- Parameters:
message
-- Throws:
IOException
-
sendMessage
void sendMessage(VoidMessage message, String id)
This method will send message to the node specified by Id- Parameters:
message
-id
-
-
sendMessageBlocking
<T extends ResponseMessage> T sendMessageBlocking(RequestMessage message, String id) throws InterruptedException
This method will send message to specified node, and will return its response- Type Parameters:
T
-- Parameters:
message
-id
-- Returns:
- Throws:
InterruptedException
-
sendMessageBlocking
<T extends ResponseMessage> T sendMessageBlocking(RequestMessage message, String id, long waitTime, TimeUnit timeUnit) throws InterruptedException
This method will send message to specified node, and will return its response- Type Parameters:
T
-- Parameters:
message
-id
-- Returns:
- Throws:
InterruptedException
-
processMessage
void processMessage(VoidMessage message)
This method will be invoked for all incoming messages PLEASE NOTE: this method is mostly suited for tests- Parameters:
message
-
-
setRestartCallback
void setRestartCallback(RestartCallback callback)
This method allows to set callback instance, which will be called upon restart event- Parameters:
callback
-
-
addRequestConsumer
<T extends RequestMessage> void addRequestConsumer(Class<T> cls, io.reactivex.functions.Consumer<T> consumer)
This methd allows to set callback instance for various- Type Parameters:
T1
- RequestMessage classT2
- ResponseMessage class- Parameters:
cls
-callback
-
-
onMeshUpdate
void onMeshUpdate(MeshOrganizer mesh)
This method will be called if mesh update was received PLEASE NOTE: This method will be called ONLY if new mesh differs from current one- Parameters:
mesh
-
-
onRemap
void onRemap(String id)
This method will be called upon remap request- Parameters:
id
-
-
totalNumberOfNodes
int totalNumberOfNodes()
This method returns total number of nodes known to this Transport- Returns:
-
getRootId
String getRootId()
This method returns ID of the root node- Returns:
-
isConnected
boolean isConnected()
This method checks if all connections required for work are established- Returns:
- true
-
isIntroduced
boolean isIntroduced()
This method checks if this node was properly introduced to driver- Returns:
-
ensureConnection
void ensureConnection(String id)
This method checks connection to the given node ID, and if it's not connected - establishes connection- Parameters:
id
-
-
-