dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
Delivery.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// Standard includes
12#include <memory>
13
14namespace dfx::Core
15{
16class Node;
17class InputPort;
18class OutputPort;
19class Message;
20
21using NodePtr = std::shared_ptr<Node>;
22using MessagePtr = std::unique_ptr<Message>;
23} // !namespace dfx::Core
24
25namespace dfx::Hooks
26{
50{
51public:
73 enum class HookResult
74 {
78 };
79
80public:
81 virtual ~Delivery() = default;
82
102 Core::MessagePtr & message) = 0;
103
122 Core::NodePtr dst, Core::InputPort & in) = 0;
123};
124} // !namespace dfx::Hooks
Incoming message endpoint attached to a node.
Definition InputPort.hpp:55
Abstract base class for messages exchanged between nodes.
Definition Message.hpp:76
Abstract base class for all nodes in the dfx runtime.
Definition Node.hpp:91
Outgoing message endpoint attached to a node.
Definition OutputPort.hpp:47
Hook interface invoked around message enqueue in an dfx::Core::Channel.
Definition Delivery.hpp:50
HookResult
Result code controlling pushMessage() behavior.
Definition Delivery.hpp:74
@ Skip
Short-circuit without error (pre: drop message, post: just return success).
Definition Delivery.hpp:76
@ Fail
Short-circuit with error (pre: drop message, post: report failure after enqueue).
Definition Delivery.hpp:77
@ Proceed
Continue normal execution.
Definition Delivery.hpp:75
virtual HookResult postDelivery(Core::NodePtr src, Core::OutputPort const &out, Core::NodePtr dst, Core::InputPort &in)=0
Called after a message has been enqueued into the channel.
virtual HookResult preDelivery(Core::NodePtr src, Core::OutputPort const &out, Core::NodePtr dst, Core::InputPort &in, Core::MessagePtr &message)=0
Called before a message is enqueued into the channel.
Definition Channel.hpp:22
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
std::shared_ptr< Node > NodePtr
Shared ownership pointer type for Nodes..
Definition Node.hpp:61
Definition Delivery.hpp:26