dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::Plugins::CNodeExecutor Class Reference

Host-side implementation of a Task Executor that delegates to a C plugin. More...

#include <dfx-plugins/bridges/node/CNodeExecutor.hpp>

Inheritance diagram for dfx::Plugins::CNodeExecutor:
[legend]
Collaboration diagram for dfx::Plugins::CNodeExecutor:
[legend]

Public Member Functions

 CNodeExecutor (Plugin const &plugin, dfx_task_executor_interface_t interface)
 Constructs a C-bridge for a task executor.
 ~CNodeExecutor ()
 Destructor. Calls the plugin's destroy function.
bool pushTask (Runtime::Api::TaskPtr task) override
 Forwards a single task to the plugin.
std::size_t pushTasks (std::span< Runtime::Api::TaskPtr > tasks) override
 Forwards multiple tasks to the plugin.
Public Member Functions inherited from dfx::Runtime::Api::NodeTaskExecutor
virtual ~NodeTaskExecutor ()=default
 Virtual destructor.

Detailed Description

Host-side implementation of a Task Executor that delegates to a C plugin.

This class translates the native C++ task execution requests into C-ABI calls. When the Runtime::Api::NodeReactor produces a task for a node, this executor wraps that task into a dfx_task_api_t and pushes it to the plugin's custom scheduler.

Lifetime Management
Since C plugins often execute tasks asynchronously on their own threads, CNodeExecutor creates a TaskContext for every task. This context keeps the Runtime::Api::TaskPtr alive until the plugin calls the run function in the task API.

Constructor & Destructor Documentation

◆ CNodeExecutor()

dfx::Plugins::CNodeExecutor::CNodeExecutor ( Plugin const & plugin,
dfx_task_executor_interface_t interface )

Constructs a C-bridge for a task executor.

Parameters
pluginThe owning plugin (used for logging and resource context).
interfaceThe vtable of C functions provided by the plugin.

◆ ~CNodeExecutor()

dfx::Plugins::CNodeExecutor::~CNodeExecutor ( )

Destructor. Calls the plugin's destroy function.

Member Function Documentation

◆ pushTask()

bool dfx::Plugins::CNodeExecutor::pushTask ( Runtime::Api::TaskPtr task)
overridevirtual

Forwards a single task to the plugin.

Creates a TaskContext, generates a dfx_task_api_t, and invokes dfx_task_executor_interface_t::push_task.

Parameters
taskThe native C++ task.
Returns
true if the plugin accepted the task, false otherwise.

Implements dfx::Runtime::Api::NodeTaskExecutor.

◆ pushTasks()

std::size_t dfx::Plugins::CNodeExecutor::pushTasks ( std::span< Runtime::Api::TaskPtr > tasks)
overridevirtual

Forwards multiple tasks to the plugin.

Parameters
tasksA span of native C++ tasks.
Returns
The number of tasks successfully pushed.

Implements dfx::Runtime::Api::NodeTaskExecutor.


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