Manages communication between the runtime and the runner.
Definition at line 21 of file VuoRuntimeCommunicator.hh.
Public Member Functions | |
VuoRuntimeCommunicator (VuoRuntimePersistentState *persistentState) | |
Constructor. More... | |
~VuoRuntimeCommunicator (void) | |
Destructor. More... | |
void | updateCompositionSymbols (void *compositionBinaryHandle) |
Updates references to symbols defined in the composition's generated code. More... | |
void | openConnection (void *_zmqContext, const char *controlURL, const char *telemetryURL, int runnerPipe) |
Sets up the ZMQ connection and pipe between this class and the runner. More... | |
void | closeConnection (void) |
Terminates the ZMQ connection between this class and the composition. More... | |
bool | hasZmqConnection (void) |
Returns true if the runtime has a ZMQ connection to the runner. More... | |
dispatch_queue_t | getControlQueue (void) |
Returns the dispatch queue on which this object sends control reply messages. More... | |
void | startSendingHeartbeat (void) |
Starts a timer to periodically send heartbeat telemetry to the runner. More... | |
void | stopSendingAndCleanUpHeartbeat (void) |
Stops the telemetry timer and cleans up. More... | |
void | startListeningForControl (void) |
Starts a timer to periodically listen for and respond to control messages from the runner. More... | |
void | stopListeningForControl (void) |
Cancels the control timer. More... | |
void | interruptListeningForControl (void) |
Breaks out of the current zmq_poll() call, which is listening for the next control message. More... | |
void | cleanUpControl (void) |
Cleans up after the canceled control timer. More... | |
void | startListeningForRunnerExit (void) |
Starts asynchronously waiting to see if the runner process exits, indicated by the pipe connection being broken. More... | |
void | sendNodeExecutionStarted (const char *compositionIdentifier, const char *nodeIdentifier) |
Constructs and sends a message on the telemetry socket, indicating that a node has started execution. More... | |
void | sendNodeExecutionFinished (const char *compositionIdentifier, const char *nodeIdentifier) |
Constructs and sends a message on the telemetry socket, indicating that a node has finished execution. More... | |
void | sendInputPortsUpdated (const char *compositionIdentifier, const char *portIdentifier, bool receivedEvent, bool receivedData, const char *portDataSummary) |
Constructs and sends a message on the telemetry socket, indicating that an input port has received an event and/or data. More... | |
void | sendOutputPortsUpdated (const char *compositionIdentifier, const char *portIdentifier, bool sentEvent, bool sentData, const char *portDataSummary) |
Constructs and sends a message on the telemetry socket, indicating that an output port has transmitted/fired an event and/or data. More... | |
void | sendPublishedOutputPortsUpdated (const char *portIdentifier, bool sentData, const char *portDataSummary) |
Constructs and sends a message on the telemetry socket, indicating that a published output port has transmitted an event. More... | |
void | sendEventFinished (unsigned long eventId, NodeContext *compositionContext) |
Constructs and sends a message on the telemetry socket, indicating that an event has finished propagating through the top-level composition. More... | |
void | sendEventDropped (const char *compositionIdentifier, const char *portIdentifier) |
Constructs and sends a message on the telemetry socket, indicating that a trigger port has dropped an event. More... | |
void | sendError (const char *message) |
Constructs and sends a message on the telemetry socket, indicating that an uncaught error has occurred. More... | |
void | sendStopRequested (void) |
Constructs and sends a message on the telemetry socket, indicating that the composition would like to stop itself. More... | |
void | sendCompositionStoppingAndCloseControl (void) |
Constructs and sends a message on the control socket, confirming that the composition is shutting down, and closes the control socket. More... | |
bool | shouldSendPortDataTelemetry (const char *compositionIdentifier, const char *portIdentifier) |
Returns true if telemetry containing the port data summary should be sent for this port. More... | |
VuoRuntimeCommunicator::VuoRuntimeCommunicator | ( | VuoRuntimePersistentState * | persistentState | ) |
Constructor.
Does not take ownership of persistentState.
Definition at line 23 of file VuoRuntimeCommunicator.cc.
VuoRuntimeCommunicator::~VuoRuntimeCommunicator | ( | void | ) |
Destructor.
Definition at line 65 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::cleanUpControl | ( | void | ) |
Cleans up after the canceled control timer.
Definition at line 1129 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::closeConnection | ( | void | ) |
Terminates the ZMQ connection between this class and the composition.
Definition at line 259 of file VuoRuntimeCommunicator.cc.
dispatch_queue_t VuoRuntimeCommunicator::getControlQueue | ( | void | ) |
Returns the dispatch queue on which this object sends control reply messages.
Definition at line 281 of file VuoRuntimeCommunicator.cc.
bool VuoRuntimeCommunicator::hasZmqConnection | ( | void | ) |
Returns true if the runtime has a ZMQ connection to the runner.
Definition at line 273 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::interruptListeningForControl | ( | void | ) |
Breaks out of the current zmq_poll()
call, which is listening for the next control message.
Definition at line 1112 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::openConnection | ( | void * | _zmqContext, |
const char * | controlURL, | ||
const char * | telemetryURL, | ||
int | runnerPipe | ||
) |
Sets up the ZMQ connection and pipe between this class and the runner.
std::runtime_error | controlURL and telemetryURL were provided, but the ZMQ connections couldn't be established. |
Definition at line 200 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendCompositionStoppingAndCloseControl | ( | void | ) |
Constructs and sends a message on the control socket, confirming that the composition is shutting down, and closes the control socket.
Definition at line 457 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendError | ( | const char * | message | ) |
Constructs and sends a message on the telemetry socket, indicating that an uncaught error has occurred.
Definition at line 434 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendEventDropped | ( | const char * | compositionIdentifier, |
const char * | portIdentifier | ||
) |
Constructs and sends a message on the telemetry socket, indicating that a trigger port has dropped an event.
compositionIdentifier
argument. Definition at line 418 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendEventFinished | ( | unsigned long | eventId, |
NodeContext * | compositionContext | ||
) |
Constructs and sends a message on the telemetry socket, indicating that an event has finished propagating through the top-level composition.
Definition at line 405 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendInputPortsUpdated | ( | const char * | compositionIdentifier, |
const char * | portIdentifier, | ||
bool | receivedEvent, | ||
bool | receivedData, | ||
const char * | portDataSummary | ||
) |
Constructs and sends a message on the telemetry socket, indicating that an input port has received an event and/or data.
compositionIdentifier
argument. Definition at line 348 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendNodeExecutionFinished | ( | const char * | compositionIdentifier, |
const char * | nodeIdentifier | ||
) |
Constructs and sends a message on the telemetry socket, indicating that a node has finished execution.
compositionIdentifier
argument. Definition at line 331 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendNodeExecutionStarted | ( | const char * | compositionIdentifier, |
const char * | nodeIdentifier | ||
) |
Constructs and sends a message on the telemetry socket, indicating that a node has started execution.
compositionIdentifier
argument. Definition at line 314 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendOutputPortsUpdated | ( | const char * | compositionIdentifier, |
const char * | portIdentifier, | ||
bool | sentEvent, | ||
bool | sentData, | ||
const char * | portDataSummary | ||
) |
Constructs and sends a message on the telemetry socket, indicating that an output port has transmitted/fired an event and/or data.
compositionIdentifier
, sentEvent
arguments. Definition at line 370 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendPublishedOutputPortsUpdated | ( | const char * | portIdentifier, |
bool | sentData, | ||
const char * | portDataSummary | ||
) |
Constructs and sends a message on the telemetry socket, indicating that a published output port has transmitted an event.
Definition at line 390 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::sendStopRequested | ( | void | ) |
Constructs and sends a message on the telemetry socket, indicating that the composition would like to stop itself.
Definition at line 448 of file VuoRuntimeCommunicator.cc.
bool VuoRuntimeCommunicator::shouldSendPortDataTelemetry | ( | const char * | compositionIdentifier, |
const char * | portIdentifier | ||
) |
Returns true if telemetry containing the port data summary should be sent for this port.
compositionIdentifier
argument. Definition at line 561 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::startListeningForControl | ( | void | ) |
Starts a timer to periodically listen for and respond to control messages from the runner.
Definition at line 718 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::startListeningForRunnerExit | ( | void | ) |
Starts asynchronously waiting to see if the runner process exits, indicated by the pipe connection being broken.
If it does, this function stops the composition.
Definition at line 1160 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::startSendingHeartbeat | ( | void | ) |
Starts a timer to periodically send heartbeat telemetry to the runner.
Definition at line 671 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::stopListeningForControl | ( | void | ) |
Cancels the control timer.
Definition at line 1101 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::stopSendingAndCleanUpHeartbeat | ( | void | ) |
Stops the telemetry timer and cleans up.
Definition at line 694 of file VuoRuntimeCommunicator.cc.
void VuoRuntimeCommunicator::updateCompositionSymbols | ( | void * | compositionBinaryHandle | ) |
Updates references to symbols defined in the composition's generated code.
std::runtime_error | One of the symbols was not found in the composition binary. |
Definition at line 78 of file VuoRuntimeCommunicator.cc.