20#ifndef ORES_COMMS_MESSAGING_SUBSCRIPTION_PROTOCOL_HPP
21#define ORES_COMMS_MESSAGING_SUBSCRIPTION_PROTOCOL_HPP
30#include "ores.comms/messaging/message_types.hpp"
60 static std::expected<subscribe_request, error_code>
86 static std::expected<subscribe_response, error_code>
108 std::vector<std::byte>
serialize()
const;
113 static std::expected<unsubscribe_request, error_code>
134 std::vector<std::byte>
serialize()
const;
139 static std::expected<unsubscribe_response, error_code>
172 std::vector<std::byte>
serialize()
const;
177 static std::expected<notification_message, error_code>
214 std::vector<std::byte>
serialize()
const;
219 static std::expected<database_status_message, error_code>
Contains messaging related infrastructure in the comms library.
Definition compression.hpp:29
Request to subscribe to entity change notifications.
Definition subscription_protocol.hpp:40
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition subscription_protocol.cpp:30
std::string event_type
The event type to subscribe to.
Definition subscription_protocol.hpp:46
static std::expected< subscribe_request, error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition subscription_protocol.cpp:37
Response confirming subscription request.
Definition subscription_protocol.hpp:69
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition subscription_protocol.cpp:53
static std::expected< subscribe_response, error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition subscription_protocol.cpp:61
Request to unsubscribe from entity change notifications.
Definition subscription_protocol.hpp:95
static std::expected< unsubscribe_request, error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition subscription_protocol.cpp:89
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition subscription_protocol.cpp:82
std::string event_type
The event type to unsubscribe from.
Definition subscription_protocol.hpp:99
Response confirming unsubscription request.
Definition subscription_protocol.hpp:122
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition subscription_protocol.cpp:105
static std::expected< unsubscribe_response, error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition subscription_protocol.cpp:113
Server-initiated notification of an entity change.
Definition subscription_protocol.hpp:151
std::vector< std::byte > serialize() const
Serialize notification to bytes.
Definition subscription_protocol.cpp:134
std::string event_type
The event type that occurred.
Definition subscription_protocol.hpp:155
std::chrono::system_clock::time_point timestamp
Timestamp of when the change occurred (UTC).
Definition subscription_protocol.hpp:162
static std::expected< notification_message, error_code > deserialize(std::span< const std::byte > data)
Deserialize notification from bytes.
Definition subscription_protocol.cpp:147
Server-initiated notification of database status.
Definition subscription_protocol.hpp:189
std::vector< std::byte > serialize() const
Serialize notification to bytes.
Definition subscription_protocol.cpp:171
std::chrono::system_clock::time_point timestamp
Timestamp of when the status was checked (UTC).
Definition subscription_protocol.hpp:203
bool available
Whether the database is available.
Definition subscription_protocol.hpp:193
std::string error_message
Error message if unavailable, empty otherwise.
Definition subscription_protocol.hpp:198
static std::expected< database_status_message, error_code > deserialize(std::span< const std::byte > data)
Deserialize notification from bytes.
Definition subscription_protocol.cpp:185