dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx_node_interface_t Struct Reference

The vtable that a plugin must implement to define a Node. More...

#include <dfx-plugins-interface/PluginInterface.h>

Public Attributes

dfx_node_handle_t(* build )(char const *type, uint32_t id, char const *name, char const *config, dfx_node_api_t const *node_api, size_t node_api_size)
 Instantiates a new node.
void(* destroy )(dfx_node_handle_t node)
 Destroys the node instance and frees associated plugin memory.
int(* start )(dfx_node_handle_t node, dfx_poller_api_t const *poller, size_t poller_size)
 Requests the node to start processing.
void(* stop )(dfx_node_handle_t node)
 Requests the node to stop processing.
int(* on_message )(dfx_node_handle_t node, uint32_t port_id, dfx_message_api_t const *msg_api, size_t msg_api_size)
 Called by the host when a message arrives on an input port.

Detailed Description

The vtable that a plugin must implement to define a Node.

This defines how the host interacts with the plugin. Each function corresponds to a lifecycle stage or an event in the dataflow graph.

All functions are required except specified otherwise.

Member Data Documentation

◆ build

dfx_node_handle_t(* dfx_node_interface_t::build) (char const *type, uint32_t id, char const *name, char const *config, dfx_node_api_t const *node_api, size_t node_api_size)

Instantiates a new node.

The JSON configuration is already matched against the JSON schema provided during the node type registration if any.

Parameters
[in]typeThe registered node type string.
[in]idThe unique instance ID within the graph.
[in]nameThe user-defined instance name.
[in]configJSON configuration string.
[in]node_apiPointer to host services for this instance.
[in]node_api_sizeSize of the dfx_node_api_t struct (for version checking).
Returns
An opaque handle to the plugin's internal node instance.

◆ destroy

void(* dfx_node_interface_t::destroy) (dfx_node_handle_t node)

Destroys the node instance and frees associated plugin memory.

Parameters
[in]nodeThe node handle returned by the build function.

◆ on_message

int(* dfx_node_interface_t::on_message) (dfx_node_handle_t node, uint32_t port_id, dfx_message_api_t const *msg_api, size_t msg_api_size)

Called by the host when a message arrives on an input port.

The handle provided in the msg_api is only valid for the duration of this function. Do not store and re-use it later.

Parameters
[in]nodeThe node handle returned by the build function.
[in]port_idThe ID assigned during port registration.
[in]msg_apiAPI to interrogate the message handle. Valid only for the duration of this call.
[in]msg_api_sizeSize of the dfx_message_api_t struct.
Returns
0 if the message was accepted, non-zero otherwise.

◆ start

int(* dfx_node_interface_t::start) (dfx_node_handle_t node, dfx_poller_api_t const *poller, size_t poller_size)

Requests the node to start processing.

The poller parameter is valid only until dfx_node_api_t::notify_stopped is called.

Parameters
[in]nodeThe node handle returned by the build function.
[in]pollerAPI to register file descriptors for event-driven processing.
[in]poller_sizeSize of the dfx_poller_api_t struct.
Returns
0 on success, non-zero on failure.

◆ stop

void(* dfx_node_interface_t::stop) (dfx_node_handle_t node)

Requests the node to stop processing.

This function is optional and dfx_node_api_t::notify_stopped is immediately called if it is not defined.

Parameters
[in]nodeThe node handle returned by the build function.

The documentation for this struct was generated from the following file: