dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::Runtime::Api::NodeReactor Class Referenceabstract

Node-aware reactor API for FD watching and deferred execution in the runtime. More...

#include <dfx-runtime-api/NodeReactor.hpp>

Inheritance diagram for dfx::Runtime::Api::NodeReactor:
[legend]

Public Member Functions

virtual void registerNodeFd (FdWatch::BorrowedFd fd, FdWatch::EventInterests events, FdWatch::FdCallback cb, Core::NodeWPtr node)=0
 Register a file descriptor for a specific node.
virtual void deregisterNodeFd (FdWatch::BorrowedFd fd) noexcept=0
 Deregister a previously registered file descriptor.
virtual void deferNodeCall (FdWatch::Callback cb, Core::NodeWPtr node)=0
 Defer execution of a callback associated with a node.

Detailed Description

Node-aware reactor API for FD watching and deferred execution in the runtime.

NodeReactor is the runtime-facing abstraction used to integrate node-owned event sources (typically Linux file descriptors) into the runtime's event loop / scheduling model.

Unlike FdWatch::Poller, this API is explicitly node-aware: every operation is associated with a node identity (Core::NodeWPtr). This enables the runtime to:

  • attribute watches and callbacks to the correct node,
  • apply node lifetime rules (cleanup on stop/destruction),
  • prevent stale callbacks from running after node expiration,
Who uses this interface?
Ownership / lifetime model
  • File descriptors are treated as borrowed; the reactor does not own them.
  • The node identity is held as a weak pointer. Implementations should avoid invoking callbacks if the node has expired, and should release any associated registrations when appropriate.
Note
Thread-safety is implementation-defined. This interface imposes no synchronization.

Member Function Documentation

◆ deferNodeCall()

virtual void dfx::Runtime::Api::NodeReactor::deferNodeCall ( FdWatch::Callback cb,
Core::NodeWPtr node )
pure virtual

Defer execution of a callback associated with a node.

Schedules cb to run later under the reactor's execution model (typically the runtime's event loop / dispatcher). The association to node allows the reactor to suppress or handle callbacks safely if the node has expired.

Parameters
cbCallback to execute later.
nodeNode identity used for attribution and lifetime rules.

Implemented in dfx::Runtime::Scheduler.

◆ deregisterNodeFd()

virtual void dfx::Runtime::Api::NodeReactor::deregisterNodeFd ( FdWatch::BorrowedFd fd)
pure virtualnoexcept

Deregister a previously registered file descriptor.

Removes fd from the reactor's polling mechanism and clears any associated bookkeeping.

Parameters
fdBorrowed file descriptor previously registered with registerNodeFd.

Implemented in dfx::Runtime::Scheduler.

◆ registerNodeFd()

virtual void dfx::Runtime::Api::NodeReactor::registerNodeFd ( FdWatch::BorrowedFd fd,
FdWatch::EventInterests events,
FdWatch::FdCallback cb,
Core::NodeWPtr node )
pure virtual

Register a file descriptor for a specific node.

Registers fd with the reactor and associates the watch with node. The reactor is responsible for integrating the FD into its polling mechanism (can be done via an underlying FdWatch::Poller) and for enforcing node-lifetime behavior when dispatching cb.

Parameters
fdBorrowed file descriptor to watch (not owned by the reactor).
eventsInterest mask describing which events to observe.
cbCallback invoked when the FD becomes ready.
nodeNode identity used for attribution and lifetime rules.

Implemented in dfx::Runtime::Scheduler.


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