dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::Hooks::Graph Class Referenceabstract

Hooks related to the lifecycle of graph objects (nodes and channels). More...

#include <dfx-hooks/Graph.hpp>

Inheritance diagram for dfx::Hooks::Graph:
[legend]

Public Member Functions

virtual void onNodeCreated (Core::NodePtr node)=0
 Called after a node has been created and is known to the runtime.
virtual void onNodeRemoved (Core::NodePtr node)=0
 Called when a node is being removed from the graph.
virtual void onChannelCreated (Core::ChannelPtr channel)=0
 Called after a channel has been created and registered in the graph.
virtual void onChannelRemoved (Core::ChannelPtr channel)=0
 Called when a channel is being removed from the graph.

Detailed Description

Hooks related to the lifecycle of graph objects (nodes and channels).

dfx supports dynamic graphs at runtime (nodes/channels may appear and disappear while the system is running). Graph hooks allow observers to react to these lifecycle events for:

  • instrumentation (logging, metrics, tracing),
  • runtime inspection / UI updates,
  • bookkeeping (indexes, registries, external mappings),
  • exporting metadata (e.g., capture formats that need node/channel catalogs).

This interface is invoked when graph-level objects are created/removed by the runtime:

The hook is intended for "side-band" observers. It should not perform heavy work on the calling thread. If expensive processing is needed (serialization, I/O, etc.), enqueue work to a dedicated worker thread. Any exception thrown by those callback will be catched, displayed in a logger and discarded using dfx::Utils::safeInvoke

Note
These hooks are purely observational in this interface: they do not return a result and therefore cannot veto the operation.
Warning
Implementations should assume:
  • callbacks may occur from different threads,
  • removal can happen at any time after creation,
  • the provided shared pointers are the only lifetime guarantee for the duration of the call.

Member Function Documentation

◆ onChannelCreated()

virtual void dfx::Hooks::Graph::onChannelCreated ( Core::ChannelPtr channel)
pure virtual

Called after a channel has been created and registered in the graph.

A channel represents a message transport path between ports (often an SPSC queue, but the concrete type is runtime-defined).

Parameters
channelThe newly created channel.

Implemented in dfx::Pcapng::Capture, and dfx::Runtime::Scheduler.

◆ onChannelRemoved()

virtual void dfx::Hooks::Graph::onChannelRemoved ( Core::ChannelPtr channel)
pure virtual

Called when a channel is being removed from the graph.

This callback indicates the channel is no longer part of the graph (or is in the process of being removed). It does not imply the channel’s queue is empty, nor does it imply that in-flight messages have been drained.

Parameters
channelThe channel being removed.

Implemented in dfx::Pcapng::Capture, and dfx::Runtime::Scheduler.

◆ onNodeCreated()

virtual void dfx::Hooks::Graph::onNodeCreated ( Core::NodePtr node)
pure virtual

Called after a node has been created and is known to the runtime.

This callback indicates the runtime has constructed the node. It does not imply that:

  • the node is already started/running,
  • the node is already wired/connected,
  • the node has any channels attached yet.
Parameters
nodeThe newly created node.
Note
The runtime may create nodes before creating channels, but do not rely on it

Implemented in dfx::Pcapng::Capture, and dfx::Runtime::Scheduler.

◆ onNodeRemoved()

virtual void dfx::Hooks::Graph::onNodeRemoved ( Core::NodePtr node)
pure virtual

Called when a node is being removed from the graph.

This callback indicates the node is no longer part of the graph (or is in the process of being removed). It does not necessarily mean the node object is about to be destroyed immediately; it only indicates graph membership/lifecycle.

Parameters
nodeThe node being removed.
Warning
Do not assume channels involving this node have already been removed (or have not yet been removed). If your logic requires stable ordering, it must be enforced by the runtime or by your own synchronization.

Implemented in dfx::Pcapng::Capture, and dfx::Runtime::Scheduler.


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