ORE Studio 0.0.4
Loading...
Searching...
No Matches
scheduler_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_SCHEDULER_MESSAGING_SCHEDULER_PROTOCOL_HPP
21#define ORES_SCHEDULER_MESSAGING_SCHEDULER_PROTOCOL_HPP
22
23#include <string>
24#include <string_view>
25#include <vector>
26#include "ores.scheduler.api/domain/job_definition.hpp"
27#include "ores.scheduler.api/domain/job_instance.hpp"
28
29namespace ores::scheduler::messaging {
30
31struct get_job_definitions_request {
32 using response_type = struct get_job_definitions_response;
33 static constexpr std::string_view nats_subject =
34 "scheduler.v1.job-definitions.list";
35 int offset = 0;
36 int limit = 100;
37};
38
39struct get_job_definitions_response {
40 std::vector<ores::scheduler::domain::job_definition> definitions;
41 int total_available_count = 0;
42};
43
44struct schedule_job_request {
45 using response_type = struct schedule_job_response;
46 static constexpr std::string_view nats_subject =
47 "scheduler.v1.job-definitions.schedule";
49 std::string change_reason_code;
50 std::string change_commentary;
51};
52
53struct schedule_job_response {
54 bool success = false;
55 std::string message;
56};
57
58struct unschedule_job_request {
59 using response_type = struct unschedule_job_response;
60 static constexpr std::string_view nats_subject =
61 "scheduler.v1.job-definitions.unschedule";
62 std::string job_definition_id;
63 std::string change_reason_code;
64 std::string change_commentary;
65};
66
67struct unschedule_job_response {
68 bool success = false;
69 std::string message;
70};
71
72struct schedule_jobs_batch_request {
73 using response_type = struct schedule_jobs_batch_response;
74 static constexpr std::string_view nats_subject =
75 "scheduler.v1.job-definitions.schedule-batch";
76 std::vector<ores::scheduler::domain::job_definition> definitions;
77 std::string change_reason_code;
78 std::string change_commentary;
79};
80
81struct schedule_jobs_batch_response {
82 bool success = false;
83 std::string message;
84 int scheduled_count = 0;
85 std::vector<std::string> failed_ids;
86};
87
88struct get_job_history_request {
89 using response_type = struct get_job_history_response;
90 static constexpr std::string_view nats_subject =
91 "scheduler.v1.job-definitions.history";
92 std::string job_definition_id;
93 int limit = 0;
94};
95
96struct get_job_history_response {
97 bool success = false;
98 std::string message;
99 std::vector<ores::scheduler::domain::job_instance> instances;
100};
101
102}
103
104#endif
Persistent plan for an in-process scheduled job.
Definition job_definition.hpp:38