libzypp 17.37.17
CommitMessages.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
10#ifndef ZYPP_SHARED_COMMIT_COMMITMESSAGE_H_INCLUDED
11#define ZYPP_SHARED_COMMIT_COMMITMESSAGE_H_INCLUDED
12
15
16#include <cstdint>
17#include <string>
18#include <variant>
19#include <vector>
20
26namespace zypp::proto::target
27{
28
29 // transaction steps are sent as part of the Commit Message
30 // serialized to 0x0\stepId\0pathName\0multiversion\0
31 struct InstallStep {
32 uint32_t stepId;
33 std::string pathname;
35 };
36
37 // serialized to 0x1stepId\0name\0version\0release\0arch\0
38 struct RemoveStep {
39 uint32_t stepId;
40 std::string name;
41 std::string version;
42 std::string release;
43 std::string arch ;
44 };
45
46 using TransactionStep = std::variant<InstallStep,RemoveStep>;
47
48 // first message that is sent to zypp-rpm
49 // to setup the commit basics.
50 struct Commit
51 {
52 Commit() = default;
53 Commit(const Commit &) = default;
54 Commit(Commit &&) = default;
55 Commit &operator=(const Commit &) = default;
56 Commit &operator=(Commit &&) = default;
57
58 static constexpr std::string_view typeName = "Commit";
63
64 uint32_t flags;
65 std::string arch;
66 std::string root;
67 std::string dbPath;
68 std::string lockFilePath;
70 std::vector<TransactionStep> transactionSteps;
71
74 };
75
76
77 // message written to zypper when the transaction has failed
79 static constexpr std::string_view typeName = "TransactionError";
80 std::vector<std::string> problems;
81
84 };
85
86 // message written to the rpm log including the level
87 struct RpmLog {
88 static constexpr std::string_view typeName = "RpmLog";
89 uint32_t level;
90 std::string line;
91
94
95 };
96
97 // Per package information which directly correspond to a TransactionStep !!!!
98 struct PackageBegin {
99 static constexpr std::string_view typeName = "PackageBegin";
100 uint32_t stepId;
101
104 };
105
107 static constexpr std::string_view typeName = "PackageFinished";
108 uint32_t stepId;
109
112 };
113
115 static constexpr std::string_view typeName = "PackageError";
116 uint32_t stepId;
117
120 };
121
123 static constexpr std::string_view typeName = "PackageProgress";
124 uint32_t stepId;
125 uint32_t amount;
126
129 };
130
131 // Progress for cleaning up old versions of packages
132 // which have NO corresponding TransactionStep
134 static constexpr std::string_view typeName = "CleanupBegin";
135 std::string nvra;
136
139 };
140
142 static constexpr std::string_view typeName = "CleanupFinished";
143 std::string nvra;
144
147 };
148
150 static constexpr std::string_view typeName = "CleanupProgress";
151 std::string nvra;
152 uint32_t amount;
153
156 };
157
158 // per script info, for each of those the stepId can be -1 or point
159 // to a valid step in the transaction set.
160 struct ScriptBegin {
161 static constexpr std::string_view typeName = "ScriptBegin";
162 int32_t stepId;
163 std::string scriptType;
164 std::string scriptPackage;
165
168 };
169
171 static constexpr std::string_view typeName = "ScriptFinished";
172 int32_t stepId;
173
176 };
177
178 struct ScriptError {
179 static constexpr std::string_view typeName = "ScriptError";
180 int32_t stepId;
181 bool fatal;
182
185 };
186
187 // Generic Transactionstep report, we use it for preparing and verifying progress
188 struct TransBegin {
189 static constexpr std::string_view typeName = "TransBegin";
190 std::string name;
191
194 };
195
197 static constexpr std::string_view typeName = "TransFinished";
200 };
201
203 static constexpr std::string_view typeName = "TransProgress";
204 uint32_t amount;
205
208 };
209
210}
211
212#endif // ZYPP_SHARED_COMMIT_COMMITMESSAGE_H_INCLUDED
Command frame for communication with PluginScript.
Definition PluginFrame.h:42
std::variant< InstallStep, RemoveStep > TransactionStep
static zyppng::expected< CleanupBegin > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
static zyppng::expected< CleanupFinished > fromStompMessage(const zypp::PluginFrame &msg)
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< CleanupProgress > fromStompMessage(const zypp::PluginFrame &msg)
std::vector< TransactionStep > transactionSteps
Commit(Commit &&)=default
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
Commit(const Commit &)=default
static zyppng::expected< Commit > fromStompMessage(const zypp::PluginFrame &msg)
Commit & operator=(const Commit &)=default
Commit & operator=(Commit &&)=default
static constexpr std::string_view typeName
static zyppng::expected< PackageBegin > fromStompMessage(const zypp::PluginFrame &msg)
zyppng::expected< zypp::PluginFrame > toStompMessage() const
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< PackageError > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
static zyppng::expected< PackageFinished > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< PackageProgress > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
static zyppng::expected< RpmLog > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< ScriptBegin > fromStompMessage(const zypp::PluginFrame &msg)
static zyppng::expected< ScriptError > fromStompMessage(const zypp::PluginFrame &msg)
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
static zyppng::expected< ScriptFinished > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
static zyppng::expected< TransBegin > fromStompMessage(const zypp::PluginFrame &msg)
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< TransFinished > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< TransProgress > fromStompMessage(const zypp::PluginFrame &msg)
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static zyppng::expected< TransactionError > fromStompMessage(const zypp::PluginFrame &msg)
std::vector< std::string > problems