conduit 0.6.0
Modern C++23 header-only event-dispatching / event-transport library
Loading...
Searching...
No Matches
flags.hpp
Go to the documentation of this file.
1#pragma once
2
13
14#include <commons/color.hpp>
15#include <commons/display_info.hpp>
16#include <commons/flag.hpp>
17#include <commons/icon.hpp>
18#include <commons/icons.hpp>
19
20namespace conduit::flags {
21
25struct ConduitFlagCategory : comms::FlagCategory<"conduit"> {};
26
29template <comms::FixedString Name, typename Category = ConduitFlagCategory>
30using Flag = comms::Flag<Name, Category>;
31
32using FlagSet = comms::FlagSet;
33
34// ---------------------------------------------------------------------------
35// Built-in flag tag types. Each carries a `DisplayInfo` (mdi icon + Colors::mui
36// palette color) and is registered with the `comms::GlobalFlagRegistry` so its
37// wire-name round-trips through `parcel::FlagSetCell`.
38// ---------------------------------------------------------------------------
39
41struct Direct : Flag<"direct"> {
42 static const comms::DisplayInfo& display_info() {
43 static const comms::DisplayInfo info{
44 .name = "Direct",
45 .description = "Force same-thread dispatch even in Queue / ThreadPool execution modes.",
46 .icon = comms::Icons::mdi::flash,
47 .color = comms::Colors::mui::yellow_700,
48 };
49 return info;
50 }
51};
52
54struct Durable : Flag<"durable"> {
55 static const comms::DisplayInfo& display_info() {
56 static const comms::DisplayInfo info{
57 .name = "Durable",
58 .description = "Hint to durable transports that they should persist the envelope.",
59 .icon = comms::Icons::mdi::database,
60 .color = comms::Colors::mui::blue_700,
61 };
62 return info;
63 }
64};
65
67struct Persistent : Flag<"persistent"> {
68 static const comms::DisplayInfo& display_info() {
69 static const comms::DisplayInfo info{
70 .name = "Persistent",
71 .description = "Hint to transports to use a persistent (human-readable) wire format.",
72 .icon = comms::Icons::mdi::file_document_outline,
73 .color = comms::Colors::mui::teal_500,
74 };
75 return info;
76 }
77};
78
80struct NoMiddleware : Flag<"no_middleware"> {
81 static const comms::DisplayInfo& display_info() {
82 static const comms::DisplayInfo info{
83 .name = "NoMiddleware",
84 .description = "Skip the middleware pipeline for this envelope.",
85 .icon = comms::Icons::mdi::pipe_disconnected,
86 .color = comms::Colors::mui::grey_600,
87 };
88 return info;
89 }
90};
91
93struct RequireAck : Flag<"require_ack"> {
94 static const comms::DisplayInfo& display_info() {
95 static const comms::DisplayInfo info{
96 .name = "RequireAck",
97 .description =
98 "Request the broker / transport acknowledge the publish before returning.",
99 .icon = comms::Icons::mdi::check_decagram,
100 .color = comms::Colors::mui::green_600,
101 };
102 return info;
103 }
104};
105
107struct Broadcast : Flag<"broadcast"> {
108 static const comms::DisplayInfo& display_info() {
109 static const comms::DisplayInfo info{
110 .name = "Broadcast",
111 .description = "Hint that this envelope is intended for fan-out broadcast.",
112 .icon = comms::Icons::mdi::broadcast,
113 .color = comms::Colors::mui::deep_orange_500,
114 };
115 return info;
116 }
117};
118
120struct LocalOnly : Flag<"local_only"> {
121 static const comms::DisplayInfo& display_info() {
122 static const comms::DisplayInfo info{
123 .name = "LocalOnly",
124 .description = "Restrict dispatch to transports with TransportScope::Local.",
125 .icon = comms::Icons::mdi::home_circle,
126 .color = comms::Colors::mui::light_blue_500,
127 };
128 return info;
129 }
130};
131
133struct RemoteOnly : Flag<"remote_only"> {
134 static const comms::DisplayInfo& display_info() {
135 static const comms::DisplayInfo info{
136 .name = "RemoteOnly",
137 .description = "Restrict dispatch to transports with TransportScope::Remote.",
138 .icon = comms::Icons::mdi::earth,
139 .color = comms::Colors::mui::indigo_500,
140 };
141 return info;
142 }
143};
144
145// Self-register the built-ins so `parcel::FlagSetCell` can resolve them by name
146// on decode and so `GlobalFlagRegistry::find("direct")` etc. just work.
155
156} // namespace conduit::flags
Definition flags.hpp:20
comms::FlagSet FlagSet
Definition flags.hpp:32
COMMONS_REGISTER_FLAG(Direct)
comms::Flag< Name, Category > Flag
Template alias mirroring comms::Flag with ConduitFlagCategory as the default — preserves the old Flag...
Definition flags.hpp:30
Hint that this envelope is intended for fan-out broadcast.
Definition flags.hpp:107
static const comms::DisplayInfo & display_info()
Definition flags.hpp:108
Single category for all conduit-defined flags.
Definition flags.hpp:25
Force same-thread dispatch even in Queue / ThreadPool execution modes.
Definition flags.hpp:41
static const comms::DisplayInfo & display_info()
Definition flags.hpp:42
Hint to durable transports that they should persist the envelope.
Definition flags.hpp:54
static const comms::DisplayInfo & display_info()
Definition flags.hpp:55
Restrict dispatch to transports with TransportScope::Local.
Definition flags.hpp:120
static const comms::DisplayInfo & display_info()
Definition flags.hpp:121
Skip the middleware pipeline for this envelope.
Definition flags.hpp:80
static const comms::DisplayInfo & display_info()
Definition flags.hpp:81
Hint to transports to use a persistent (human-readable) wire format.
Definition flags.hpp:67
static const comms::DisplayInfo & display_info()
Definition flags.hpp:68
Restrict dispatch to transports with TransportScope::Remote.
Definition flags.hpp:133
static const comms::DisplayInfo & display_info()
Definition flags.hpp:134
Request the broker / transport acknowledge the publish before returning.
Definition flags.hpp:93
static const comms::DisplayInfo & display_info()
Definition flags.hpp:94