ORE Studio 0.0.4
Loading...
Searching...
No Matches
dataset_bundle_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_DQ_MESSAGING_DATASET_BUNDLE_PROTOCOL_HPP
21#define ORES_DQ_MESSAGING_DATASET_BUNDLE_PROTOCOL_HPP
22
23#include <span>
24#include <iosfwd>
25#include <vector>
26#include <expected>
27#include <boost/uuid/uuid.hpp>
28#include "ores.comms/messaging/message_types.hpp"
29#include "ores.comms/messaging/message_traits.hpp"
30#include "ores.dq/domain/dataset_bundle.hpp"
31
32namespace ores::dq::messaging {
33
34// ============================================================================
35// Dataset Bundle Messages
36// ============================================================================
37
42 std::vector<std::byte> serialize() const;
43 static std::expected<get_dataset_bundles_request,
44 ores::utility::serialization::error_code>
45 deserialize(std::span<const std::byte> data);
46};
47
48std::ostream& operator<<(std::ostream& s, const get_dataset_bundles_request& v);
49
54 std::vector<domain::dataset_bundle> bundles;
55
56 std::vector<std::byte> serialize() const;
57 static std::expected<get_dataset_bundles_response,
58 ores::utility::serialization::error_code>
59 deserialize(std::span<const std::byte> data);
60};
61
62std::ostream& operator<<(std::ostream& s, const get_dataset_bundles_response& v);
63
69
70 std::vector<std::byte> serialize() const;
71 static std::expected<save_dataset_bundle_request,
72 ores::utility::serialization::error_code>
73 deserialize(std::span<const std::byte> data);
74};
75
76std::ostream& operator<<(std::ostream& s, const save_dataset_bundle_request& v);
77
82 bool success;
83 std::string message;
84
85 std::vector<std::byte> serialize() const;
86 static std::expected<save_dataset_bundle_response,
87 ores::utility::serialization::error_code>
88 deserialize(std::span<const std::byte> data);
89};
90
91std::ostream& operator<<(std::ostream& s, const save_dataset_bundle_response& v);
92
97 boost::uuids::uuid id;
98 bool success;
99 std::string message;
100};
101
102std::ostream& operator<<(std::ostream& s, const delete_dataset_bundle_result& v);
103
108 std::vector<boost::uuids::uuid> ids;
109
110 std::vector<std::byte> serialize() const;
111 static std::expected<delete_dataset_bundle_request,
112 ores::utility::serialization::error_code>
113 deserialize(std::span<const std::byte> data);
114};
115
116std::ostream& operator<<(std::ostream& s, const delete_dataset_bundle_request& v);
117
122 std::vector<delete_dataset_bundle_result> results;
123
124 std::vector<std::byte> serialize() const;
125 static std::expected<delete_dataset_bundle_response,
126 ores::utility::serialization::error_code>
127 deserialize(std::span<const std::byte> data);
128};
129
130std::ostream& operator<<(std::ostream& s, const delete_dataset_bundle_response& v);
131
136 boost::uuids::uuid id;
137
138 std::vector<std::byte> serialize() const;
139 static std::expected<get_dataset_bundle_history_request,
140 ores::utility::serialization::error_code>
141 deserialize(std::span<const std::byte> data);
142};
143
144std::ostream& operator<<(std::ostream& s, const get_dataset_bundle_history_request& v);
145
150 bool success;
151 std::string message;
152 std::vector<domain::dataset_bundle> versions;
153
154 std::vector<std::byte> serialize() const;
155 static std::expected<get_dataset_bundle_history_response,
156 ores::utility::serialization::error_code>
157 deserialize(std::span<const std::byte> data);
158};
159
160std::ostream& operator<<(std::ostream& s, const get_dataset_bundle_history_response& v);
161
162}
163
164namespace ores::comms::messaging {
165
166// Dataset Bundle traits
167template<>
168struct message_traits<dq::messaging::get_dataset_bundles_request> {
171 static constexpr message_type request_message_type =
172 message_type::get_dataset_bundles_request;
173};
174
175template<>
176struct message_traits<dq::messaging::save_dataset_bundle_request> {
179 static constexpr message_type request_message_type =
180 message_type::save_dataset_bundle_request;
181};
182
183template<>
184struct message_traits<dq::messaging::delete_dataset_bundle_request> {
185 using request_type = dq::messaging::delete_dataset_bundle_request;
186 using response_type = dq::messaging::delete_dataset_bundle_response;
187 static constexpr message_type request_message_type =
188 message_type::delete_dataset_bundle_request;
189};
190
191template<>
192struct message_traits<dq::messaging::get_dataset_bundle_history_request> {
193 using request_type = dq::messaging::get_dataset_bundle_history_request;
194 using response_type = dq::messaging::get_dataset_bundle_history_response;
195 static constexpr message_type request_message_type =
196 message_type::get_dataset_bundle_history_request;
197};
198
199}
200
201#endif
Contains messaging related infrastructure in the comms library.
Definition assets_protocol.hpp:122
A named collection of datasets designed to work together.
Definition dataset_bundle.hpp:41
Request to retrieve all dataset bundles.
Definition dataset_bundle_protocol.hpp:41
Response containing all dataset bundles.
Definition dataset_bundle_protocol.hpp:53
Request to save a dataset bundle (create or update).
Definition dataset_bundle_protocol.hpp:67
Response confirming dataset bundle save operation.
Definition dataset_bundle_protocol.hpp:81
Result for a single dataset bundle deletion.
Definition dataset_bundle_protocol.hpp:96
Request to delete one or more dataset bundles.
Definition dataset_bundle_protocol.hpp:107
Response confirming dataset bundle deletion(s).
Definition dataset_bundle_protocol.hpp:121
Request to retrieve version history for a dataset bundle.
Definition dataset_bundle_protocol.hpp:135
Response containing dataset bundle version history.
Definition dataset_bundle_protocol.hpp:149