dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
NodeReactor.hpp
1// SPDX-FileCopyrightText: 2026 Vincent Leroy
2// SPDX-License-Identifier: MIT
3//
4// This file is part of dfx.
5//
6// Licensed under the MIT License. See the LICENSE file in the project root
7// for full license information.
8
9#pragma once
10
11// Project includes
12#include "NodeTaskExecutor.hpp"
13#include <dfx-fdwatch/Callback.hpp>
15#include <dfx-utilities/BorrowedFd.hpp>
16
17namespace dfx::Core
18{
19class Node;
20
21using NodeWPtr = std::weak_ptr<Node>;
22} // !namespace dfx::Core
23
24namespace dfx::Runtime::Api
25{
60{
61public:
63 virtual ~NodeReactor() = default;
64
77 FdWatch::EventInterests events,
79 Core::NodeWPtr node) = 0;
80
87 virtual void deregisterNodeFd(Utils::BorrowedFd fd) noexcept = 0;
88
93 virtual void updateNodeFdEvents(Utils::BorrowedFd fd, FdWatch::EventInterests events) = 0;
94
104};
105} // !namespace dfx::Runtime::Api
Event interest and trigger flags for file-descriptor watching (Linux/epoll).
Abstract base class for all nodes in the dfx runtime.
Definition Node.hpp:94
Node-aware reactor API for FD watching and deferred execution in the runtime.
Definition NodeReactor.hpp:60
virtual ~NodeReactor()=default
Virtual destructor.
virtual void registerNodeFd(Utils::BorrowedFd fd, FdWatch::EventInterests events, FdWatch::FdCallback cb, Core::NodeWPtr node)=0
Register a file descriptor for a specific node.
virtual void updateNodeFdEvents(Utils::BorrowedFd fd, FdWatch::EventInterests events)=0
Update the list of event that this fd is attached to.
virtual void deregisterNodeFd(Utils::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.
Non-owning wrapper around a file descriptor.
Definition BorrowedFd.hpp:33
Definition Channel.hpp:25
std::weak_ptr< Node > NodeWPtr
Weak pointer type for Nodes.
Definition Node.hpp:66
std::move_only_function< void()> Callback
Generic move-only callback with no arguments.
Definition Callback.hpp:31
std::function< void(Utils::BorrowedFd, EventTriggers)> FdCallback
Invoked when events occur on a watched file descriptor.
Definition Callback.hpp:28
Definition Node.hpp:48