dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
Delivery.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// Standard includes
12#include <memory>
13
14namespace dfx::Core
15{
16class Node;
17class Message;
18class Endpoint;
19
20using NodePtr = std::shared_ptr<Node>;
21using MessagePtr = std::unique_ptr<Message>;
22} // !namespace dfx::Core
23
24namespace dfx::Hooks
25{
39{
40public:
62 enum class HookResult
63 {
67 };
68
69public:
70 virtual ~Delivery() = default;
71
84 virtual HookResult preDelivery(Core::Endpoint const & src, Core::Endpoint const & dst,
85 Core::MessagePtr & message) = 0;
86
102 virtual HookResult postDelivery(Core::Endpoint const & src, Core::Endpoint const & dst) = 0;
103};
104} // !namespace dfx::Hooks
Definition Endpoint.hpp:24
Abstract base class for messages exchanged between nodes.
Definition Message.hpp:86
Abstract base class for all nodes in the dfx runtime.
Definition Node.hpp:94
Hook interface invoked around message enqueue in an dfx::Core::Channel.
Definition Delivery.hpp:39
HookResult
Result code controlling pushMessage() behavior.
Definition Delivery.hpp:63
@ Skip
Short-circuit without error (pre: drop message, post: just return success).
Definition Delivery.hpp:65
@ Fail
Short-circuit with error (pre: drop message, post: report failure after enqueue).
Definition Delivery.hpp:66
@ Proceed
Continue normal execution.
Definition Delivery.hpp:64
virtual HookResult postDelivery(Core::Endpoint const &src, Core::Endpoint const &dst)=0
Called after a message has been enqueued into the channel.
virtual HookResult preDelivery(Core::Endpoint const &src, Core::Endpoint const &dst, Core::MessagePtr &message)=0
Called before a message is enqueued into the channel.
Definition Channel.hpp:25
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 Endpoint.hpp:21
Definition Delivery.hpp:25