dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
NodeReactor.hpp
1// SPDX-FileCopyrightText: 2025 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 <dfx-fdwatch/BorrowedFd.hpp>
13#include <dfx-fdwatch/Callback.hpp>
15
16namespace dfx::Core
17{
18class Node;
19
20using NodeWPtr = std::weak_ptr<Node>;
21} // !namespace dfx::Core
22
23namespace dfx::Runtime::Api
24{
59{
60public:
61 virtual ~NodeReactor() = default;
62
75 FdWatch::EventInterests events,
77 Core::NodeWPtr node) = 0;
78
85 virtual void deregisterNodeFd(FdWatch::BorrowedFd fd) noexcept = 0;
86
96};
97} // !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:91
Non-owning wrapper around a file descriptor.
Definition BorrowedFd.hpp:37
Node-aware reactor API for FD watching and deferred execution in the runtime.
Definition NodeReactor.hpp:59
virtual void deregisterNodeFd(FdWatch::BorrowedFd fd) noexcept=0
Deregister a previously registered file descriptor.
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 deferNodeCall(FdWatch::Callback cb, Core::NodeWPtr node)=0
Defer execution of a callback associated with a node.
Definition Channel.hpp:22
std::weak_ptr< Node > NodeWPtr
Weak pointer type for Nodes.
Definition Node.hpp:63
std::function< void(BorrowedFd, EventTriggers)> FdCallback
Invoked when events occur on a watched file descriptor.
Definition Callback.hpp:28
std::move_only_function< void()> Callback
Generic move-only callback with no arguments.
Definition Callback.hpp:31
Definition Node.hpp:47