]> git.proxmox.com Git - ceph.git/blame - ceph/src/cls/rgw/cls_rgw_ops.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / cls / rgw / cls_rgw_ops.h
CommitLineData
9f95a23c
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
20effc67 4#pragma once
7c673cae 5
7c673cae
FG
6#include "cls/rgw/cls_rgw_types.h"
7
8struct rgw_cls_tag_timeout_op
9{
10 uint64_t tag_timeout;
11
12 rgw_cls_tag_timeout_op() : tag_timeout(0) {}
13
f67539c2 14 void encode(ceph::buffer::list &bl) const {
7c673cae 15 ENCODE_START(1, 1, bl);
11fdf7f2 16 encode(tag_timeout, bl);
7c673cae
FG
17 ENCODE_FINISH(bl);
18 }
f67539c2 19 void decode(ceph::buffer::list::const_iterator &bl) {
7c673cae 20 DECODE_START(1, bl);
11fdf7f2 21 decode(tag_timeout, bl);
7c673cae
FG
22 DECODE_FINISH(bl);
23 }
f67539c2
TL
24 void dump(ceph::Formatter *f) const;
25 static void generate_test_instances(std::list<rgw_cls_tag_timeout_op*>& ls);
7c673cae
FG
26};
27WRITE_CLASS_ENCODER(rgw_cls_tag_timeout_op)
28
29struct rgw_cls_obj_prepare_op
30{
31 RGWModifyOp op;
32 cls_rgw_obj_key key;
f67539c2
TL
33 std::string tag;
34 std::string locator;
7c673cae
FG
35 bool log_op;
36 uint16_t bilog_flags;
31f18b77 37 rgw_zone_set zones_trace;
7c673cae
FG
38
39 rgw_cls_obj_prepare_op() : op(CLS_RGW_OP_UNKNOWN), log_op(false), bilog_flags(0) {}
40
f67539c2 41 void encode(ceph::buffer::list &bl) const {
31f18b77 42 ENCODE_START(7, 5, bl);
7c673cae 43 uint8_t c = (uint8_t)op;
11fdf7f2
TL
44 encode(c, bl);
45 encode(tag, bl);
46 encode(locator, bl);
47 encode(log_op, bl);
48 encode(key, bl);
49 encode(bilog_flags, bl);
50 encode(zones_trace, bl);
7c673cae
FG
51 ENCODE_FINISH(bl);
52 }
f67539c2 53 void decode(ceph::buffer::list::const_iterator &bl) {
31f18b77 54 DECODE_START_LEGACY_COMPAT_LEN(7, 3, 3, bl);
7c673cae 55 uint8_t c;
11fdf7f2 56 decode(c, bl);
7c673cae
FG
57 op = (RGWModifyOp)c;
58 if (struct_v < 5) {
11fdf7f2 59 decode(key.name, bl);
7c673cae 60 }
11fdf7f2 61 decode(tag, bl);
7c673cae 62 if (struct_v >= 2) {
11fdf7f2 63 decode(locator, bl);
7c673cae
FG
64 }
65 if (struct_v >= 4) {
11fdf7f2 66 decode(log_op, bl);
7c673cae
FG
67 }
68 if (struct_v >= 5) {
11fdf7f2 69 decode(key, bl);
7c673cae
FG
70 }
71 if (struct_v >= 6) {
11fdf7f2 72 decode(bilog_flags, bl);
7c673cae 73 }
31f18b77 74 if (struct_v >= 7) {
11fdf7f2 75 decode(zones_trace, bl);
31f18b77 76 }
7c673cae
FG
77 DECODE_FINISH(bl);
78 }
f67539c2
TL
79 void dump(ceph::Formatter *f) const;
80 static void generate_test_instances(std::list<rgw_cls_obj_prepare_op*>& o);
7c673cae
FG
81};
82WRITE_CLASS_ENCODER(rgw_cls_obj_prepare_op)
83
84struct rgw_cls_obj_complete_op
85{
86 RGWModifyOp op;
87 cls_rgw_obj_key key;
f67539c2 88 std::string locator;
7c673cae 89 rgw_bucket_entry_ver ver;
11fdf7f2 90 rgw_bucket_dir_entry_meta meta;
f67539c2 91 std::string tag;
7c673cae
FG
92 bool log_op;
93 uint16_t bilog_flags;
94
f67539c2 95 std::list<cls_rgw_obj_key> remove_objs;
31f18b77 96 rgw_zone_set zones_trace;
7c673cae
FG
97
98 rgw_cls_obj_complete_op() : op(CLS_RGW_OP_ADD), log_op(false), bilog_flags(0) {}
99
f67539c2 100 void encode(ceph::buffer::list &bl) const {
31f18b77 101 ENCODE_START(9, 7, bl);
7c673cae 102 uint8_t c = (uint8_t)op;
11fdf7f2
TL
103 encode(c, bl);
104 encode(ver.epoch, bl);
105 encode(meta, bl);
106 encode(tag, bl);
107 encode(locator, bl);
108 encode(remove_objs, bl);
109 encode(ver, bl);
110 encode(log_op, bl);
111 encode(key, bl);
112 encode(bilog_flags, bl);
113 encode(zones_trace, bl);
7c673cae
FG
114 ENCODE_FINISH(bl);
115 }
f67539c2 116 void decode(ceph::buffer::list::const_iterator &bl) {
31f18b77 117 DECODE_START_LEGACY_COMPAT_LEN(9, 3, 3, bl);
7c673cae 118 uint8_t c;
11fdf7f2 119 decode(c, bl);
7c673cae
FG
120 op = (RGWModifyOp)c;
121 if (struct_v < 7) {
11fdf7f2 122 decode(key.name, bl);
7c673cae 123 }
11fdf7f2
TL
124 decode(ver.epoch, bl);
125 decode(meta, bl);
126 decode(tag, bl);
7c673cae 127 if (struct_v >= 2) {
11fdf7f2 128 decode(locator, bl);
7c673cae
FG
129 }
130 if (struct_v >= 4 && struct_v < 7) {
f67539c2 131 std::list<std::string> old_remove_objs;
11fdf7f2 132 decode(old_remove_objs, bl);
7c673cae 133
f67539c2 134 for (auto iter = old_remove_objs.begin();
7c673cae
FG
135 iter != old_remove_objs.end(); ++iter) {
136 cls_rgw_obj_key k;
137 k.name = *iter;
138 remove_objs.push_back(k);
139 }
140 } else {
11fdf7f2 141 decode(remove_objs, bl);
7c673cae
FG
142 }
143 if (struct_v >= 5) {
11fdf7f2 144 decode(ver, bl);
7c673cae
FG
145 } else {
146 ver.pool = -1;
147 }
148 if (struct_v >= 6) {
11fdf7f2 149 decode(log_op, bl);
7c673cae
FG
150 }
151 if (struct_v >= 7) {
11fdf7f2 152 decode(key, bl);
7c673cae
FG
153 }
154 if (struct_v >= 8) {
11fdf7f2 155 decode(bilog_flags, bl);
7c673cae 156 }
31f18b77 157 if (struct_v >= 9) {
11fdf7f2 158 decode(zones_trace, bl);
31f18b77 159 }
7c673cae
FG
160 DECODE_FINISH(bl);
161 }
f67539c2
TL
162 void dump(ceph::Formatter *f) const;
163 static void generate_test_instances(std::list<rgw_cls_obj_complete_op*>& o);
7c673cae
FG
164};
165WRITE_CLASS_ENCODER(rgw_cls_obj_complete_op)
166
167struct rgw_cls_link_olh_op {
168 cls_rgw_obj_key key;
f67539c2 169 std::string olh_tag;
7c673cae 170 bool delete_marker;
f67539c2 171 std::string op_tag;
11fdf7f2 172 rgw_bucket_dir_entry_meta meta;
7c673cae
FG
173 uint64_t olh_epoch;
174 bool log_op;
175 uint16_t bilog_flags;
f67539c2 176 ceph::real_time unmod_since; /* only create delete marker if newer then this */
7c673cae 177 bool high_precision_time;
31f18b77 178 rgw_zone_set zones_trace;
7c673cae
FG
179
180 rgw_cls_link_olh_op() : delete_marker(false), olh_epoch(0), log_op(false), bilog_flags(0), high_precision_time(false) {}
181
f67539c2 182 void encode(ceph::buffer::list& bl) const {
31f18b77 183 ENCODE_START(5, 1, bl);
11fdf7f2
TL
184 encode(key, bl);
185 encode(olh_tag, bl);
186 encode(delete_marker, bl);
187 encode(op_tag, bl);
188 encode(meta, bl);
189 encode(olh_epoch, bl);
190 encode(log_op, bl);
191 encode(bilog_flags, bl);
7c673cae 192 uint64_t t = ceph::real_clock::to_time_t(unmod_since);
11fdf7f2
TL
193 encode(t, bl);
194 encode(unmod_since, bl);
195 encode(high_precision_time, bl);
196 encode(zones_trace, bl);
7c673cae
FG
197 ENCODE_FINISH(bl);
198 }
199
f67539c2 200 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 201 DECODE_START(5, bl);
11fdf7f2
TL
202 decode(key, bl);
203 decode(olh_tag, bl);
204 decode(delete_marker, bl);
205 decode(op_tag, bl);
206 decode(meta, bl);
207 decode(olh_epoch, bl);
208 decode(log_op, bl);
209 decode(bilog_flags, bl);
7c673cae
FG
210 if (struct_v == 2) {
211 uint64_t t;
11fdf7f2 212 decode(t, bl);
7c673cae
FG
213 unmod_since = ceph::real_clock::from_time_t(static_cast<time_t>(t));
214 }
215 if (struct_v >= 3) {
31f18b77 216 uint64_t t;
11fdf7f2
TL
217 decode(t, bl);
218 decode(unmod_since, bl);
7c673cae
FG
219 }
220 if (struct_v >= 4) {
11fdf7f2 221 decode(high_precision_time, bl);
7c673cae 222 }
31f18b77 223 if (struct_v >= 5) {
11fdf7f2 224 decode(zones_trace, bl);
31f18b77 225 }
7c673cae
FG
226 DECODE_FINISH(bl);
227 }
228
f67539c2
TL
229 static void generate_test_instances(std::list<rgw_cls_link_olh_op *>& o);
230 void dump(ceph::Formatter *f) const;
7c673cae
FG
231};
232WRITE_CLASS_ENCODER(rgw_cls_link_olh_op)
233
234struct rgw_cls_unlink_instance_op {
235 cls_rgw_obj_key key;
f67539c2 236 std::string op_tag;
7c673cae
FG
237 uint64_t olh_epoch;
238 bool log_op;
239 uint16_t bilog_flags;
f67539c2 240 std::string olh_tag;
31f18b77 241 rgw_zone_set zones_trace;
7c673cae
FG
242
243 rgw_cls_unlink_instance_op() : olh_epoch(0), log_op(false), bilog_flags(0) {}
244
f67539c2 245 void encode(ceph::buffer::list& bl) const {
31f18b77 246 ENCODE_START(3, 1, bl);
11fdf7f2
TL
247 encode(key, bl);
248 encode(op_tag, bl);
249 encode(olh_epoch, bl);
250 encode(log_op, bl);
251 encode(bilog_flags, bl);
252 encode(olh_tag, bl);
253 encode(zones_trace, bl);
7c673cae
FG
254 ENCODE_FINISH(bl);
255 }
256
f67539c2 257 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 258 DECODE_START(3, bl);
11fdf7f2
TL
259 decode(key, bl);
260 decode(op_tag, bl);
261 decode(olh_epoch, bl);
262 decode(log_op, bl);
263 decode(bilog_flags, bl);
7c673cae 264 if (struct_v >= 2) {
11fdf7f2 265 decode(olh_tag, bl);
7c673cae 266 }
31f18b77 267 if (struct_v >= 3) {
11fdf7f2 268 decode(zones_trace, bl);
31f18b77 269 }
7c673cae
FG
270 DECODE_FINISH(bl);
271 }
272
f67539c2
TL
273 static void generate_test_instances(std::list<rgw_cls_unlink_instance_op *>& o);
274 void dump(ceph::Formatter *f) const;
7c673cae
FG
275};
276WRITE_CLASS_ENCODER(rgw_cls_unlink_instance_op)
277
278struct rgw_cls_read_olh_log_op
279{
280 cls_rgw_obj_key olh;
281 uint64_t ver_marker;
f67539c2 282 std::string olh_tag;
7c673cae
FG
283
284 rgw_cls_read_olh_log_op() : ver_marker(0) {}
285
f67539c2 286 void encode(ceph::buffer::list &bl) const {
7c673cae 287 ENCODE_START(1, 1, bl);
11fdf7f2
TL
288 encode(olh, bl);
289 encode(ver_marker, bl);
290 encode(olh_tag, bl);
7c673cae
FG
291 ENCODE_FINISH(bl);
292 }
f67539c2 293 void decode(ceph::buffer::list::const_iterator &bl) {
7c673cae 294 DECODE_START(1, bl);
11fdf7f2
TL
295 decode(olh, bl);
296 decode(ver_marker, bl);
297 decode(olh_tag, bl);
7c673cae
FG
298 DECODE_FINISH(bl);
299 }
f67539c2
TL
300 static void generate_test_instances(std::list<rgw_cls_read_olh_log_op *>& o);
301 void dump(ceph::Formatter *f) const;
7c673cae
FG
302};
303WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_op)
304
305
306struct rgw_cls_read_olh_log_ret
307{
f67539c2 308 std::map<uint64_t, std::vector<rgw_bucket_olh_log_entry> > log;
7c673cae
FG
309 bool is_truncated;
310
311 rgw_cls_read_olh_log_ret() : is_truncated(false) {}
312
f67539c2 313 void encode(ceph::buffer::list &bl) const {
7c673cae 314 ENCODE_START(1, 1, bl);
11fdf7f2
TL
315 encode(log, bl);
316 encode(is_truncated, bl);
7c673cae
FG
317 ENCODE_FINISH(bl);
318 }
f67539c2 319 void decode(ceph::buffer::list::const_iterator &bl) {
7c673cae 320 DECODE_START(1, bl);
11fdf7f2
TL
321 decode(log, bl);
322 decode(is_truncated, bl);
7c673cae
FG
323 DECODE_FINISH(bl);
324 }
f67539c2
TL
325 static void generate_test_instances(std::list<rgw_cls_read_olh_log_ret *>& o);
326 void dump(ceph::Formatter *f) const;
7c673cae
FG
327};
328WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_ret)
329
330struct rgw_cls_trim_olh_log_op
331{
332 cls_rgw_obj_key olh;
333 uint64_t ver;
f67539c2 334 std::string olh_tag;
7c673cae
FG
335
336 rgw_cls_trim_olh_log_op() : ver(0) {}
337
f67539c2 338 void encode(ceph::buffer::list &bl) const {
7c673cae 339 ENCODE_START(1, 1, bl);
11fdf7f2
TL
340 encode(olh, bl);
341 encode(ver, bl);
342 encode(olh_tag, bl);
7c673cae
FG
343 ENCODE_FINISH(bl);
344 }
f67539c2 345 void decode(ceph::buffer::list::const_iterator &bl) {
7c673cae 346 DECODE_START(1, bl);
11fdf7f2
TL
347 decode(olh, bl);
348 decode(ver, bl);
349 decode(olh_tag, bl);
7c673cae
FG
350 DECODE_FINISH(bl);
351 }
f67539c2
TL
352 static void generate_test_instances(std::list<rgw_cls_trim_olh_log_op *>& o);
353 void dump(ceph::Formatter *f) const;
7c673cae
FG
354};
355WRITE_CLASS_ENCODER(rgw_cls_trim_olh_log_op)
356
357struct rgw_cls_bucket_clear_olh_op {
358 cls_rgw_obj_key key;
f67539c2 359 std::string olh_tag;
7c673cae
FG
360
361 rgw_cls_bucket_clear_olh_op() {}
362
f67539c2 363 void encode(ceph::buffer::list& bl) const {
7c673cae 364 ENCODE_START(1, 1, bl);
11fdf7f2
TL
365 encode(key, bl);
366 encode(olh_tag, bl);
7c673cae
FG
367 ENCODE_FINISH(bl);
368 }
369
f67539c2 370 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 371 DECODE_START(1, bl);
11fdf7f2
TL
372 decode(key, bl);
373 decode(olh_tag, bl);
7c673cae
FG
374 DECODE_FINISH(bl);
375 }
376
f67539c2
TL
377 static void generate_test_instances(std::list<rgw_cls_bucket_clear_olh_op *>& o);
378 void dump(ceph::Formatter *f) const;
7c673cae
FG
379};
380WRITE_CLASS_ENCODER(rgw_cls_bucket_clear_olh_op)
381
382struct rgw_cls_list_op
383{
384 cls_rgw_obj_key start_obj;
385 uint32_t num_entries;
f67539c2 386 std::string filter_prefix;
7c673cae 387 bool list_versions;
f67539c2 388 std::string delimiter;
7c673cae
FG
389
390 rgw_cls_list_op() : num_entries(0), list_versions(false) {}
391
f67539c2 392 void encode(ceph::buffer::list &bl) const {
9f95a23c 393 ENCODE_START(6, 4, bl);
11fdf7f2
TL
394 encode(num_entries, bl);
395 encode(filter_prefix, bl);
396 encode(start_obj, bl);
397 encode(list_versions, bl);
9f95a23c 398 encode(delimiter, bl);
7c673cae
FG
399 ENCODE_FINISH(bl);
400 }
f67539c2 401 void decode(ceph::buffer::list::const_iterator &bl) {
9f95a23c 402 DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, bl);
7c673cae 403 if (struct_v < 4) {
11fdf7f2 404 decode(start_obj.name, bl);
7c673cae 405 }
11fdf7f2 406 decode(num_entries, bl);
9f95a23c 407 if (struct_v >= 3) {
11fdf7f2 408 decode(filter_prefix, bl);
9f95a23c
TL
409 }
410 if (struct_v >= 4) {
11fdf7f2 411 decode(start_obj, bl);
9f95a23c
TL
412 }
413 if (struct_v >= 5) {
11fdf7f2 414 decode(list_versions, bl);
9f95a23c
TL
415 }
416 if (struct_v >= 6) {
417 decode(delimiter, bl);
418 }
7c673cae
FG
419 DECODE_FINISH(bl);
420 }
f67539c2
TL
421 void dump(ceph::Formatter *f) const;
422 static void generate_test_instances(std::list<rgw_cls_list_op*>& o);
7c673cae
FG
423};
424WRITE_CLASS_ENCODER(rgw_cls_list_op)
425
1adf2230 426struct rgw_cls_list_ret {
7c673cae
FG
427 rgw_bucket_dir dir;
428 bool is_truncated;
429
20effc67
TL
430 // if is_truncated is true, starting marker for next iteration; this
431 // is necessary as it's possible after maximum number of tries we
432 // still might have zero entries to return, in which case we have to
433 // at least move the ball foward
434 cls_rgw_obj_key marker;
435
9f95a23c
TL
436 // cls_filtered is not transmitted; it is assumed true for versions
437 // on/after 3 and false for prior versions; this allows the rgw
438 // layer to know when an older osd (cls) does not do the filtering
439 bool cls_filtered;
440
441 rgw_cls_list_ret() :
442 is_truncated(false),
443 cls_filtered(true)
444 {}
7c673cae 445
f67539c2 446 void encode(ceph::buffer::list &bl) const {
20effc67 447 ENCODE_START(4, 2, bl);
11fdf7f2
TL
448 encode(dir, bl);
449 encode(is_truncated, bl);
20effc67 450 encode(marker, bl);
7c673cae
FG
451 ENCODE_FINISH(bl);
452 }
f67539c2 453 void decode(ceph::buffer::list::const_iterator &bl) {
20effc67 454 DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
11fdf7f2
TL
455 decode(dir, bl);
456 decode(is_truncated, bl);
9f95a23c 457 cls_filtered = struct_v >= 3;
20effc67
TL
458 if (struct_v >= 4) {
459 decode(marker, bl);
460 }
7c673cae
FG
461 DECODE_FINISH(bl);
462 }
f67539c2
TL
463 void dump(ceph::Formatter *f) const;
464 static void generate_test_instances(std::list<rgw_cls_list_ret*>& o);
7c673cae
FG
465};
466WRITE_CLASS_ENCODER(rgw_cls_list_ret)
467
468struct rgw_cls_check_index_ret
469{
470 rgw_bucket_dir_header existing_header;
471 rgw_bucket_dir_header calculated_header;
472
473 rgw_cls_check_index_ret() {}
474
f67539c2 475 void encode(ceph::buffer::list &bl) const {
7c673cae 476 ENCODE_START(1, 1, bl);
11fdf7f2
TL
477 encode(existing_header, bl);
478 encode(calculated_header, bl);
7c673cae
FG
479 ENCODE_FINISH(bl);
480 }
f67539c2 481 void decode(ceph::buffer::list::const_iterator &bl) {
7c673cae 482 DECODE_START(1, bl);
11fdf7f2
TL
483 decode(existing_header, bl);
484 decode(calculated_header, bl);
7c673cae
FG
485 DECODE_FINISH(bl);
486 }
f67539c2
TL
487 void dump(ceph::Formatter *f) const;
488 static void generate_test_instances(std::list<rgw_cls_check_index_ret *>& o);
7c673cae
FG
489};
490WRITE_CLASS_ENCODER(rgw_cls_check_index_ret)
491
492struct rgw_cls_bucket_update_stats_op
493{
494 bool absolute{false};
f67539c2 495 std::map<RGWObjCategory, rgw_bucket_category_stats> stats;
7c673cae
FG
496
497 rgw_cls_bucket_update_stats_op() {}
498
f67539c2 499 void encode(ceph::buffer::list &bl) const {
7c673cae 500 ENCODE_START(1, 1, bl);
11fdf7f2
TL
501 encode(absolute, bl);
502 encode(stats, bl);
7c673cae
FG
503 ENCODE_FINISH(bl);
504 }
f67539c2 505 void decode(ceph::buffer::list::const_iterator &bl) {
7c673cae 506 DECODE_START(1, bl);
11fdf7f2
TL
507 decode(absolute, bl);
508 decode(stats, bl);
7c673cae
FG
509 DECODE_FINISH(bl);
510 }
f67539c2
TL
511 void dump(ceph::Formatter *f) const;
512 static void generate_test_instances(std::list<rgw_cls_bucket_update_stats_op *>& o);
7c673cae
FG
513};
514WRITE_CLASS_ENCODER(rgw_cls_bucket_update_stats_op)
515
516struct rgw_cls_obj_remove_op {
f67539c2 517 std::list<std::string> keep_attr_prefixes;
7c673cae 518
f67539c2 519 void encode(ceph::buffer::list& bl) const {
7c673cae 520 ENCODE_START(1, 1, bl);
11fdf7f2 521 encode(keep_attr_prefixes, bl);
7c673cae
FG
522 ENCODE_FINISH(bl);
523 }
524
f67539c2 525 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 526 DECODE_START(1, bl);
11fdf7f2 527 decode(keep_attr_prefixes, bl);
7c673cae
FG
528 DECODE_FINISH(bl);
529 }
530};
531WRITE_CLASS_ENCODER(rgw_cls_obj_remove_op)
532
533struct rgw_cls_obj_store_pg_ver_op {
f67539c2 534 std::string attr;
7c673cae 535
f67539c2 536 void encode(ceph::buffer::list& bl) const {
7c673cae 537 ENCODE_START(1, 1, bl);
11fdf7f2 538 encode(attr, bl);
7c673cae
FG
539 ENCODE_FINISH(bl);
540 }
541
f67539c2 542 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 543 DECODE_START(1, bl);
11fdf7f2 544 decode(attr, bl);
7c673cae
FG
545 DECODE_FINISH(bl);
546 }
547};
548WRITE_CLASS_ENCODER(rgw_cls_obj_store_pg_ver_op)
549
550struct rgw_cls_obj_check_attrs_prefix {
f67539c2 551 std::string check_prefix;
7c673cae
FG
552 bool fail_if_exist;
553
554 rgw_cls_obj_check_attrs_prefix() : fail_if_exist(false) {}
555
f67539c2 556 void encode(ceph::buffer::list& bl) const {
7c673cae 557 ENCODE_START(1, 1, bl);
11fdf7f2
TL
558 encode(check_prefix, bl);
559 encode(fail_if_exist, bl);
7c673cae
FG
560 ENCODE_FINISH(bl);
561 }
562
f67539c2 563 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 564 DECODE_START(1, bl);
11fdf7f2
TL
565 decode(check_prefix, bl);
566 decode(fail_if_exist, bl);
7c673cae
FG
567 DECODE_FINISH(bl);
568 }
569};
570WRITE_CLASS_ENCODER(rgw_cls_obj_check_attrs_prefix)
571
572struct rgw_cls_obj_check_mtime {
573 ceph::real_time mtime;
574 RGWCheckMTimeType type;
575 bool high_precision_time;
576
577 rgw_cls_obj_check_mtime() : type(CLS_RGW_CHECK_TIME_MTIME_EQ), high_precision_time(false) {}
578
f67539c2 579 void encode(ceph::buffer::list& bl) const {
7c673cae 580 ENCODE_START(2, 1, bl);
11fdf7f2
TL
581 encode(mtime, bl);
582 encode((uint8_t)type, bl);
583 encode(high_precision_time, bl);
7c673cae
FG
584 ENCODE_FINISH(bl);
585 }
586
f67539c2 587 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 588 DECODE_START(2, bl);
11fdf7f2 589 decode(mtime, bl);
7c673cae 590 uint8_t c;
11fdf7f2 591 decode(c, bl);
7c673cae
FG
592 type = (RGWCheckMTimeType)c;
593 if (struct_v >= 2) {
11fdf7f2 594 decode(high_precision_time, bl);
7c673cae
FG
595 }
596 DECODE_FINISH(bl);
597 }
598};
599WRITE_CLASS_ENCODER(rgw_cls_obj_check_mtime)
600
601struct rgw_cls_usage_log_add_op {
602 rgw_usage_log_info info;
603 rgw_user user;
604
f67539c2 605 void encode(ceph::buffer::list& bl) const {
7c673cae 606 ENCODE_START(2, 1, bl);
11fdf7f2
TL
607 encode(info, bl);
608 encode(user.to_str(), bl);
7c673cae
FG
609 ENCODE_FINISH(bl);
610 }
611
f67539c2 612 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 613 DECODE_START(2, bl);
11fdf7f2 614 decode(info, bl);
7c673cae 615 if (struct_v >= 2) {
f67539c2 616 std::string s;
11fdf7f2 617 decode(s, bl);
7c673cae
FG
618 user.from_str(s);
619 }
620 DECODE_FINISH(bl);
621 }
622};
623WRITE_CLASS_ENCODER(rgw_cls_usage_log_add_op)
624
625struct rgw_cls_bi_get_op {
626 cls_rgw_obj_key key;
627 BIIndexType type; /* namespace: plain, instance, olh */
628
11fdf7f2 629 rgw_cls_bi_get_op() : type(BIIndexType::Plain) {}
7c673cae 630
f67539c2 631 void encode(ceph::buffer::list& bl) const {
7c673cae 632 ENCODE_START(1, 1, bl);
11fdf7f2
TL
633 encode(key, bl);
634 encode((uint8_t)type, bl);
7c673cae
FG
635 ENCODE_FINISH(bl);
636 }
637
f67539c2 638 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 639 DECODE_START(1, bl);
11fdf7f2 640 decode(key, bl);
7c673cae 641 uint8_t c;
11fdf7f2 642 decode(c, bl);
7c673cae
FG
643 type = (BIIndexType)c;
644 DECODE_FINISH(bl);
645 }
646};
647WRITE_CLASS_ENCODER(rgw_cls_bi_get_op)
648
649struct rgw_cls_bi_get_ret {
650 rgw_cls_bi_entry entry;
651
652 rgw_cls_bi_get_ret() {}
653
f67539c2 654 void encode(ceph::buffer::list& bl) const {
7c673cae 655 ENCODE_START(1, 1, bl);
11fdf7f2 656 encode(entry, bl);
7c673cae
FG
657 ENCODE_FINISH(bl);
658 }
659
f67539c2 660 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 661 DECODE_START(1, bl);
11fdf7f2 662 decode(entry, bl);
7c673cae
FG
663 DECODE_FINISH(bl);
664 }
665};
666WRITE_CLASS_ENCODER(rgw_cls_bi_get_ret)
667
668struct rgw_cls_bi_put_op {
669 rgw_cls_bi_entry entry;
670
671 rgw_cls_bi_put_op() {}
672
f67539c2 673 void encode(ceph::buffer::list& bl) const {
7c673cae 674 ENCODE_START(1, 1, bl);
11fdf7f2 675 encode(entry, bl);
7c673cae
FG
676 ENCODE_FINISH(bl);
677 }
678
f67539c2 679 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 680 DECODE_START(1, bl);
11fdf7f2 681 decode(entry, bl);
7c673cae
FG
682 DECODE_FINISH(bl);
683 }
684};
685WRITE_CLASS_ENCODER(rgw_cls_bi_put_op)
686
687struct rgw_cls_bi_list_op {
688 uint32_t max;
20effc67 689 std::string name_filter; // limit resultto one object and its instances
f67539c2 690 std::string marker;
7c673cae
FG
691
692 rgw_cls_bi_list_op() : max(0) {}
693
f67539c2 694 void encode(ceph::buffer::list& bl) const {
7c673cae 695 ENCODE_START(1, 1, bl);
11fdf7f2 696 encode(max, bl);
20effc67 697 encode(name_filter, bl);
11fdf7f2 698 encode(marker, bl);
7c673cae
FG
699 ENCODE_FINISH(bl);
700 }
701
f67539c2 702 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 703 DECODE_START(1, bl);
11fdf7f2 704 decode(max, bl);
20effc67 705 decode(name_filter, bl);
11fdf7f2 706 decode(marker, bl);
7c673cae
FG
707 DECODE_FINISH(bl);
708 }
709};
710WRITE_CLASS_ENCODER(rgw_cls_bi_list_op)
711
712struct rgw_cls_bi_list_ret {
f67539c2 713 std::list<rgw_cls_bi_entry> entries;
7c673cae
FG
714 bool is_truncated;
715
716 rgw_cls_bi_list_ret() : is_truncated(false) {}
717
f67539c2 718 void encode(ceph::buffer::list& bl) const {
7c673cae 719 ENCODE_START(1, 1, bl);
11fdf7f2
TL
720 encode(entries, bl);
721 encode(is_truncated, bl);
7c673cae
FG
722 ENCODE_FINISH(bl);
723 }
724
f67539c2 725 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 726 DECODE_START(1, bl);
11fdf7f2
TL
727 decode(entries, bl);
728 decode(is_truncated, bl);
7c673cae
FG
729 DECODE_FINISH(bl);
730 }
731};
732WRITE_CLASS_ENCODER(rgw_cls_bi_list_ret)
733
734struct rgw_cls_usage_log_read_op {
735 uint64_t start_epoch;
736 uint64_t end_epoch;
f67539c2
TL
737 std::string owner;
738 std::string bucket;
7c673cae 739
f67539c2 740 std::string iter; // should be empty for the first call, non empty for subsequent calls
7c673cae
FG
741 uint32_t max_entries;
742
f67539c2 743 void encode(ceph::buffer::list& bl) const {
11fdf7f2
TL
744 ENCODE_START(2, 1, bl);
745 encode(start_epoch, bl);
746 encode(end_epoch, bl);
747 encode(owner, bl);
748 encode(iter, bl);
749 encode(max_entries, bl);
750 encode(bucket, bl);
7c673cae
FG
751 ENCODE_FINISH(bl);
752 }
753
f67539c2 754 void decode(ceph::buffer::list::const_iterator& bl) {
11fdf7f2
TL
755 DECODE_START(2, bl);
756 decode(start_epoch, bl);
757 decode(end_epoch, bl);
758 decode(owner, bl);
759 decode(iter, bl);
760 decode(max_entries, bl);
761 if (struct_v >= 2) {
762 decode(bucket, bl);
763 }
7c673cae
FG
764 DECODE_FINISH(bl);
765 }
766};
767WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_op)
768
769struct rgw_cls_usage_log_read_ret {
f67539c2 770 std::map<rgw_user_bucket, rgw_usage_log_entry> usage;
7c673cae 771 bool truncated;
f67539c2 772 std::string next_iter;
7c673cae 773
f67539c2 774 void encode(ceph::buffer::list& bl) const {
7c673cae 775 ENCODE_START(1, 1, bl);
11fdf7f2
TL
776 encode(usage, bl);
777 encode(truncated, bl);
778 encode(next_iter, bl);
7c673cae
FG
779 ENCODE_FINISH(bl);
780 }
781
f67539c2 782 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 783 DECODE_START(1, bl);
11fdf7f2
TL
784 decode(usage, bl);
785 decode(truncated, bl);
786 decode(next_iter, bl);
7c673cae
FG
787 DECODE_FINISH(bl);
788 }
789};
790WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_ret)
791
792struct rgw_cls_usage_log_trim_op {
793 uint64_t start_epoch;
794 uint64_t end_epoch;
f67539c2
TL
795 std::string user;
796 std::string bucket;
7c673cae 797
f67539c2 798 void encode(ceph::buffer::list& bl) const {
11fdf7f2
TL
799 ENCODE_START(3, 2, bl);
800 encode(start_epoch, bl);
801 encode(end_epoch, bl);
802 encode(user, bl);
803 encode(bucket, bl);
7c673cae
FG
804 ENCODE_FINISH(bl);
805 }
806
f67539c2 807 void decode(ceph::buffer::list::const_iterator& bl) {
11fdf7f2
TL
808 DECODE_START(3, bl);
809 decode(start_epoch, bl);
810 decode(end_epoch, bl);
811 decode(user, bl);
812 if (struct_v >= 3) {
813 decode(bucket, bl);
814 }
7c673cae
FG
815 DECODE_FINISH(bl);
816 }
817};
818WRITE_CLASS_ENCODER(rgw_cls_usage_log_trim_op)
819
820struct cls_rgw_gc_set_entry_op {
821 uint32_t expiration_secs;
822 cls_rgw_gc_obj_info info;
823 cls_rgw_gc_set_entry_op() : expiration_secs(0) {}
824
f67539c2 825 void encode(ceph::buffer::list& bl) const {
7c673cae 826 ENCODE_START(1, 1, bl);
11fdf7f2
TL
827 encode(expiration_secs, bl);
828 encode(info, bl);
7c673cae
FG
829 ENCODE_FINISH(bl);
830 }
831
f67539c2 832 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 833 DECODE_START(1, bl);
11fdf7f2
TL
834 decode(expiration_secs, bl);
835 decode(info, bl);
7c673cae
FG
836 DECODE_FINISH(bl);
837 }
838
f67539c2
TL
839 void dump(ceph::Formatter *f) const;
840 static void generate_test_instances(std::list<cls_rgw_gc_set_entry_op*>& ls);
39ae355f
TL
841
842 size_t estimate_encoded_size() const {
843 constexpr size_t start_overhead = sizeof(__u8) + sizeof(__u8) + sizeof(ceph_le32); // version and length prefix
844 constexpr size_t expr_secs_overhead = sizeof(__u32); // expiration_seconds_overhead
845 return start_overhead + expr_secs_overhead + info.estimate_encoded_size();
846 }
7c673cae
FG
847};
848WRITE_CLASS_ENCODER(cls_rgw_gc_set_entry_op)
849
850struct cls_rgw_gc_defer_entry_op {
851 uint32_t expiration_secs;
f67539c2 852 std::string tag;
7c673cae
FG
853 cls_rgw_gc_defer_entry_op() : expiration_secs(0) {}
854
f67539c2 855 void encode(ceph::buffer::list& bl) const {
7c673cae 856 ENCODE_START(1, 1, bl);
11fdf7f2
TL
857 encode(expiration_secs, bl);
858 encode(tag, bl);
7c673cae
FG
859 ENCODE_FINISH(bl);
860 }
861
f67539c2 862 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 863 DECODE_START(1, bl);
11fdf7f2
TL
864 decode(expiration_secs, bl);
865 decode(tag, bl);
7c673cae
FG
866 DECODE_FINISH(bl);
867 }
868
f67539c2
TL
869 void dump(ceph::Formatter *f) const;
870 static void generate_test_instances(std::list<cls_rgw_gc_defer_entry_op*>& ls);
7c673cae
FG
871};
872WRITE_CLASS_ENCODER(cls_rgw_gc_defer_entry_op)
873
874struct cls_rgw_gc_list_op {
f67539c2 875 std::string marker;
7c673cae
FG
876 uint32_t max;
877 bool expired_only;
878
879 cls_rgw_gc_list_op() : max(0), expired_only(true) {}
880
f67539c2 881 void encode(ceph::buffer::list& bl) const {
7c673cae 882 ENCODE_START(2, 1, bl);
11fdf7f2
TL
883 encode(marker, bl);
884 encode(max, bl);
885 encode(expired_only, bl);
7c673cae
FG
886 ENCODE_FINISH(bl);
887 }
888
f67539c2 889 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 890 DECODE_START(2, bl);
11fdf7f2
TL
891 decode(marker, bl);
892 decode(max, bl);
7c673cae 893 if (struct_v >= 2) {
11fdf7f2 894 decode(expired_only, bl);
7c673cae
FG
895 }
896 DECODE_FINISH(bl);
897 }
898
f67539c2
TL
899 void dump(ceph::Formatter *f) const;
900 static void generate_test_instances(std::list<cls_rgw_gc_list_op*>& ls);
7c673cae
FG
901};
902WRITE_CLASS_ENCODER(cls_rgw_gc_list_op)
903
904struct cls_rgw_gc_list_ret {
f67539c2
TL
905 std::list<cls_rgw_gc_obj_info> entries;
906 std::string next_marker;
7c673cae
FG
907 bool truncated;
908
909 cls_rgw_gc_list_ret() : truncated(false) {}
910
f67539c2 911 void encode(ceph::buffer::list& bl) const {
31f18b77 912 ENCODE_START(2, 1, bl);
11fdf7f2
TL
913 encode(entries, bl);
914 encode(next_marker, bl);
915 encode(truncated, bl);
7c673cae
FG
916 ENCODE_FINISH(bl);
917 }
918
f67539c2 919 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 920 DECODE_START(2, bl);
11fdf7f2 921 decode(entries, bl);
31f18b77 922 if (struct_v >= 2)
11fdf7f2
TL
923 decode(next_marker, bl);
924 decode(truncated, bl);
7c673cae
FG
925 DECODE_FINISH(bl);
926 }
927
f67539c2
TL
928 void dump(ceph::Formatter *f) const;
929 static void generate_test_instances(std::list<cls_rgw_gc_list_ret*>& ls);
7c673cae
FG
930};
931WRITE_CLASS_ENCODER(cls_rgw_gc_list_ret)
932
933struct cls_rgw_gc_remove_op {
f67539c2 934 std::vector<std::string> tags;
7c673cae
FG
935
936 cls_rgw_gc_remove_op() {}
937
f67539c2 938 void encode(ceph::buffer::list& bl) const {
7c673cae 939 ENCODE_START(1, 1, bl);
11fdf7f2 940 encode(tags, bl);
7c673cae
FG
941 ENCODE_FINISH(bl);
942 }
943
f67539c2 944 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 945 DECODE_START(1, bl);
11fdf7f2 946 decode(tags, bl);
7c673cae
FG
947 DECODE_FINISH(bl);
948 }
949
f67539c2
TL
950 void dump(ceph::Formatter *f) const;
951 static void generate_test_instances(std::list<cls_rgw_gc_remove_op*>& ls);
7c673cae
FG
952};
953WRITE_CLASS_ENCODER(cls_rgw_gc_remove_op)
954
955struct cls_rgw_bi_log_list_op {
f67539c2 956 std::string marker;
7c673cae
FG
957 uint32_t max;
958
959 cls_rgw_bi_log_list_op() : max(0) {}
960
f67539c2 961 void encode(ceph::buffer::list& bl) const {
7c673cae 962 ENCODE_START(1, 1, bl);
11fdf7f2
TL
963 encode(marker, bl);
964 encode(max, bl);
7c673cae
FG
965 ENCODE_FINISH(bl);
966 }
967
f67539c2 968 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 969 DECODE_START(1, bl);
11fdf7f2
TL
970 decode(marker, bl);
971 decode(max, bl);
7c673cae
FG
972 DECODE_FINISH(bl);
973 }
974
f67539c2
TL
975 void dump(ceph::Formatter *f) const;
976 static void generate_test_instances(std::list<cls_rgw_bi_log_list_op*>& ls);
7c673cae
FG
977};
978WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_op)
979
980struct cls_rgw_bi_log_trim_op {
f67539c2
TL
981 std::string start_marker;
982 std::string end_marker;
7c673cae
FG
983
984 cls_rgw_bi_log_trim_op() {}
985
f67539c2 986 void encode(ceph::buffer::list& bl) const {
7c673cae 987 ENCODE_START(1, 1, bl);
11fdf7f2
TL
988 encode(start_marker, bl);
989 encode(end_marker, bl);
7c673cae
FG
990 ENCODE_FINISH(bl);
991 }
992
f67539c2 993 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 994 DECODE_START(1, bl);
11fdf7f2
TL
995 decode(start_marker, bl);
996 decode(end_marker, bl);
7c673cae
FG
997 DECODE_FINISH(bl);
998 }
999
f67539c2
TL
1000 void dump(ceph::Formatter *f) const;
1001 static void generate_test_instances(std::list<cls_rgw_bi_log_trim_op*>& ls);
7c673cae
FG
1002};
1003WRITE_CLASS_ENCODER(cls_rgw_bi_log_trim_op)
1004
1005struct cls_rgw_bi_log_list_ret {
f67539c2 1006 std::list<rgw_bi_log_entry> entries;
7c673cae
FG
1007 bool truncated;
1008
1009 cls_rgw_bi_log_list_ret() : truncated(false) {}
1010
f67539c2 1011 void encode(ceph::buffer::list& bl) const {
7c673cae 1012 ENCODE_START(1, 1, bl);
11fdf7f2
TL
1013 encode(entries, bl);
1014 encode(truncated, bl);
7c673cae
FG
1015 ENCODE_FINISH(bl);
1016 }
1017
f67539c2 1018 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 1019 DECODE_START(1, bl);
11fdf7f2
TL
1020 decode(entries, bl);
1021 decode(truncated, bl);
7c673cae
FG
1022 DECODE_FINISH(bl);
1023 }
1024
f67539c2
TL
1025 void dump(ceph::Formatter *f) const;
1026 static void generate_test_instances(std::list<cls_rgw_bi_log_list_ret*>& ls);
7c673cae
FG
1027};
1028WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_ret)
1029
1030struct cls_rgw_lc_get_next_entry_op {
f67539c2 1031 std::string marker;
7c673cae
FG
1032 cls_rgw_lc_get_next_entry_op() {}
1033
f67539c2 1034 void encode(ceph::buffer::list& bl) const {
7c673cae 1035 ENCODE_START(1, 1, bl);
11fdf7f2 1036 encode(marker, bl);
7c673cae
FG
1037 ENCODE_FINISH(bl);
1038 }
1039
f67539c2 1040 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 1041 DECODE_START(1, bl);
11fdf7f2 1042 decode(marker, bl);
7c673cae
FG
1043 DECODE_FINISH(bl);
1044 }
1045};
1046WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_op)
1047
11fdf7f2 1048struct cls_rgw_lc_get_next_entry_ret {
f6b5b4d7
TL
1049 cls_rgw_lc_entry entry;
1050
7c673cae
FG
1051 cls_rgw_lc_get_next_entry_ret() {}
1052
f67539c2 1053 void encode(ceph::buffer::list& bl) const {
f6b5b4d7 1054 ENCODE_START(2, 2, bl);
11fdf7f2 1055 encode(entry, bl);
7c673cae
FG
1056 ENCODE_FINISH(bl);
1057 }
1058
f67539c2 1059 void decode(ceph::buffer::list::const_iterator& bl) {
f6b5b4d7
TL
1060 DECODE_START(2, bl);
1061 if (struct_v < 2) {
1062 std::pair<std::string, int> oe;
1063 decode(oe, bl);
1064 entry = {oe.first, 0 /* start */, uint32_t(oe.second)};
1065 } else {
1066 decode(entry, bl);
1067 }
7c673cae
FG
1068 DECODE_FINISH(bl);
1069 }
1070
1071};
1072WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_ret)
1073
11fdf7f2 1074struct cls_rgw_lc_get_entry_op {
f67539c2 1075 std::string marker;
11fdf7f2
TL
1076 cls_rgw_lc_get_entry_op() {}
1077 cls_rgw_lc_get_entry_op(const std::string& _marker) : marker(_marker) {}
1078
f67539c2 1079 void encode(ceph::buffer::list& bl) const {
11fdf7f2
TL
1080 ENCODE_START(1, 1, bl);
1081 encode(marker, bl);
1082 ENCODE_FINISH(bl);
1083 }
1084
f67539c2 1085 void decode(ceph::buffer::list::const_iterator& bl) {
11fdf7f2
TL
1086 DECODE_START(1, bl);
1087 decode(marker, bl);
1088 DECODE_FINISH(bl);
1089 }
1090};
1091WRITE_CLASS_ENCODER(cls_rgw_lc_get_entry_op)
1092
1093struct cls_rgw_lc_get_entry_ret {
f6b5b4d7
TL
1094 cls_rgw_lc_entry entry;
1095
11fdf7f2 1096 cls_rgw_lc_get_entry_ret() {}
f6b5b4d7
TL
1097 cls_rgw_lc_get_entry_ret(cls_rgw_lc_entry&& _entry)
1098 : entry(std::move(_entry)) {}
11fdf7f2 1099
f67539c2 1100 void encode(ceph::buffer::list& bl) const {
1e59de90 1101 ENCODE_START(2, 2, bl);
11fdf7f2
TL
1102 encode(entry, bl);
1103 ENCODE_FINISH(bl);
1104 }
1105
f67539c2 1106 void decode(ceph::buffer::list::const_iterator& bl) {
1e59de90
TL
1107 DECODE_START(2, bl);
1108 if (struct_v < 2) {
1109 /* there was an unmarked change in the encoding during v1, so
1110 * if the sender version is v1, try decoding both ways (sorry) */
1111 ceph::buffer::list::const_iterator save_bl = bl;
1112 try {
1113 decode(entry, bl);
1114 } catch (ceph::buffer::error& e) {
1115 std::pair<std::string, int> oe;
1116 bl = save_bl;
1117 decode(oe, bl);
1118 entry.bucket = oe.first;
1119 entry.start_time = 0;
1120 entry.status = oe.second;
1121 }
1122 } else {
1123 decode(entry, bl);
1124 }
11fdf7f2
TL
1125 DECODE_FINISH(bl);
1126 }
1e59de90
TL
1127 void dump(ceph::Formatter *f) const;
1128 static void generate_test_instances(std::list<cls_rgw_lc_get_entry_ret*>& ls);
11fdf7f2
TL
1129};
1130WRITE_CLASS_ENCODER(cls_rgw_lc_get_entry_ret)
1131
7c673cae 1132struct cls_rgw_lc_rm_entry_op {
f6b5b4d7 1133 cls_rgw_lc_entry entry;
7c673cae
FG
1134 cls_rgw_lc_rm_entry_op() {}
1135
f67539c2 1136 void encode(ceph::buffer::list& bl) const {
f6b5b4d7 1137 ENCODE_START(2, 2, bl);
11fdf7f2 1138 encode(entry, bl);
7c673cae
FG
1139 ENCODE_FINISH(bl);
1140 }
1141
f67539c2 1142 void decode(ceph::buffer::list::const_iterator& bl) {
f6b5b4d7
TL
1143 DECODE_START(2, bl);
1144 if (struct_v < 2) {
1145 std::pair<std::string, int> oe;
1146 decode(oe, bl);
1147 entry = {oe.first, 0 /* start */, uint32_t(oe.second)};
1148 } else {
1149 decode(entry, bl);
1150 }
7c673cae
FG
1151 DECODE_FINISH(bl);
1152 }
1153};
1154WRITE_CLASS_ENCODER(cls_rgw_lc_rm_entry_op)
1155
1156struct cls_rgw_lc_set_entry_op {
f6b5b4d7 1157 cls_rgw_lc_entry entry;
7c673cae
FG
1158 cls_rgw_lc_set_entry_op() {}
1159
f67539c2 1160 void encode(ceph::buffer::list& bl) const {
f6b5b4d7 1161 ENCODE_START(2, 2, bl);
11fdf7f2 1162 encode(entry, bl);
7c673cae
FG
1163 ENCODE_FINISH(bl);
1164 }
1165
f67539c2 1166 void decode(ceph::buffer::list::const_iterator& bl) {
f6b5b4d7
TL
1167 DECODE_START(2, bl);
1168 if (struct_v < 2) {
1169 std::pair<std::string, int> oe;
1170 decode(oe, bl);
1171 entry = {oe.first, 0 /* start */, uint32_t(oe.second)};
1172 } else {
1173 decode(entry, bl);
1174 }
7c673cae
FG
1175 DECODE_FINISH(bl);
1176 }
1177};
1178WRITE_CLASS_ENCODER(cls_rgw_lc_set_entry_op)
1179
1180struct cls_rgw_lc_put_head_op {
1181 cls_rgw_lc_obj_head head;
1182
1183
1184 cls_rgw_lc_put_head_op() {}
1185
f67539c2 1186 void encode(ceph::buffer::list& bl) const {
7c673cae 1187 ENCODE_START(1, 1, bl);
11fdf7f2 1188 encode(head, bl);
7c673cae
FG
1189 ENCODE_FINISH(bl);
1190 }
1191
f67539c2 1192 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 1193 DECODE_START(1, bl);
11fdf7f2 1194 decode(head, bl);
7c673cae
FG
1195 DECODE_FINISH(bl);
1196 }
1197
1198};
1199WRITE_CLASS_ENCODER(cls_rgw_lc_put_head_op)
1200
1201struct cls_rgw_lc_get_head_ret {
1202 cls_rgw_lc_obj_head head;
1203
1204 cls_rgw_lc_get_head_ret() {}
1205
f67539c2 1206 void encode(ceph::buffer::list& bl) const {
7c673cae 1207 ENCODE_START(1, 1, bl);
11fdf7f2 1208 encode(head, bl);
7c673cae
FG
1209 ENCODE_FINISH(bl);
1210 }
1211
f67539c2 1212 void decode(ceph::buffer::list::const_iterator& bl) {
7c673cae 1213 DECODE_START(1, bl);
11fdf7f2 1214 decode(head, bl);
7c673cae
FG
1215 DECODE_FINISH(bl);
1216 }
1217
1218};
1219WRITE_CLASS_ENCODER(cls_rgw_lc_get_head_ret)
1220
1221struct cls_rgw_lc_list_entries_op {
f67539c2 1222 std::string marker;
11fdf7f2 1223 uint32_t max_entries = 0;
f6b5b4d7 1224 uint8_t compat_v{0};
7c673cae
FG
1225
1226 cls_rgw_lc_list_entries_op() {}
1227
f67539c2 1228 void encode(ceph::buffer::list& bl) const {
f6b5b4d7 1229 ENCODE_START(3, 1, bl);
11fdf7f2
TL
1230 encode(marker, bl);
1231 encode(max_entries, bl);
7c673cae
FG
1232 ENCODE_FINISH(bl);
1233 }
1234
f67539c2 1235 void decode(ceph::buffer::list::const_iterator& bl) {
f6b5b4d7
TL
1236 DECODE_START(3, bl);
1237 compat_v = struct_v;
11fdf7f2
TL
1238 decode(marker, bl);
1239 decode(max_entries, bl);
7c673cae
FG
1240 DECODE_FINISH(bl);
1241 }
1242
1243};
1244WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_op)
1245
1246struct cls_rgw_lc_list_entries_ret {
20effc67 1247 std::vector<cls_rgw_lc_entry> entries;
c07f9fc5 1248 bool is_truncated{false};
f6b5b4d7 1249 uint8_t compat_v;
7c673cae 1250
f6b5b4d7
TL
1251cls_rgw_lc_list_entries_ret(uint8_t compat_v = 3)
1252 : compat_v(compat_v) {}
7c673cae 1253
f67539c2 1254 void encode(ceph::buffer::list& bl) const {
f6b5b4d7
TL
1255 ENCODE_START(compat_v, 1, bl);
1256 if (compat_v <= 2) {
20effc67 1257 std::map<std::string, int> oes;
f6b5b4d7
TL
1258 std::for_each(entries.begin(), entries.end(),
1259 [&oes](const cls_rgw_lc_entry& elt)
1260 {oes.insert({elt.bucket, elt.status});});
1261 encode(oes, bl);
1262 } else {
1263 encode(entries, bl);
1264 }
11fdf7f2 1265 encode(is_truncated, bl);
7c673cae
FG
1266 ENCODE_FINISH(bl);
1267 }
1268
f67539c2 1269 void decode(ceph::buffer::list::const_iterator& bl) {
f6b5b4d7
TL
1270 DECODE_START(3, bl);
1271 compat_v = struct_v;
1272 if (struct_v <= 2) {
20effc67 1273 std::map<std::string, int> oes;
f6b5b4d7
TL
1274 decode(oes, bl);
1275 std::for_each(oes.begin(), oes.end(),
20effc67 1276 [this](const std::pair<std::string, int>& oe)
f6b5b4d7
TL
1277 {entries.push_back({oe.first, 0 /* start */,
1278 uint32_t(oe.second)});});
1279 } else {
1280 decode(entries, bl);
1281 }
c07f9fc5 1282 if (struct_v >= 2) {
11fdf7f2 1283 decode(is_truncated, bl);
c07f9fc5 1284 }
7c673cae
FG
1285 DECODE_FINISH(bl);
1286 }
7c673cae
FG
1287};
1288WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_ret)
1289
1e59de90
TL
1290struct cls_rgw_mp_upload_part_info_update_op {
1291 std::string part_key;
1292 RGWUploadPartInfo info;
1293
1294 cls_rgw_mp_upload_part_info_update_op() {}
1295
1296 void encode(buffer::list& bl) const {
1297 ENCODE_START(1, 1, bl);
1298 encode(part_key, bl);
1299 encode(info, bl);
1300 ENCODE_FINISH(bl);
1301 }
1302
1303 void decode(buffer::list::const_iterator& bl) {
1304 DECODE_START(1, bl);
1305 decode(part_key, bl);
1306 decode(info, bl);
1307 DECODE_FINISH(bl);
1308 }
1309
1310 static void generate_test_instances(std::list<cls_rgw_mp_upload_part_info_update_op*>& ls);
1311 void dump(Formatter* f) const;
1312};
1313WRITE_CLASS_ENCODER(cls_rgw_mp_upload_part_info_update_op)
1314
31f18b77
FG
1315struct cls_rgw_reshard_add_op {
1316 cls_rgw_reshard_entry entry;
1317
1318 cls_rgw_reshard_add_op() {}
1319
f67539c2 1320 void encode(ceph::buffer::list& bl) const {
31f18b77 1321 ENCODE_START(1, 1, bl);
11fdf7f2 1322 encode(entry, bl);
31f18b77
FG
1323 ENCODE_FINISH(bl);
1324 }
1325
f67539c2 1326 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1327 DECODE_START(1, bl);
11fdf7f2 1328 decode(entry, bl);
31f18b77
FG
1329 DECODE_FINISH(bl);
1330 }
f67539c2
TL
1331 static void generate_test_instances(std::list<cls_rgw_reshard_add_op*>& o);
1332 void dump(ceph::Formatter *f) const;
31f18b77
FG
1333};
1334WRITE_CLASS_ENCODER(cls_rgw_reshard_add_op)
1335
1336struct cls_rgw_reshard_list_op {
1337 uint32_t max{0};
f67539c2 1338 std::string marker;
31f18b77
FG
1339
1340 cls_rgw_reshard_list_op() {}
1341
f67539c2 1342 void encode(ceph::buffer::list& bl) const {
31f18b77 1343 ENCODE_START(1, 1, bl);
11fdf7f2
TL
1344 encode(max, bl);
1345 encode(marker, bl);
31f18b77
FG
1346 ENCODE_FINISH(bl);
1347 }
1348
f67539c2 1349 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1350 DECODE_START(1, bl);
11fdf7f2
TL
1351 decode(max, bl);
1352 decode(marker, bl);
31f18b77
FG
1353 DECODE_FINISH(bl);
1354 }
f67539c2
TL
1355 static void generate_test_instances(std::list<cls_rgw_reshard_list_op*>& o);
1356 void dump(ceph::Formatter *f) const;
31f18b77
FG
1357};
1358WRITE_CLASS_ENCODER(cls_rgw_reshard_list_op)
1359
1360
1361struct cls_rgw_reshard_list_ret {
f67539c2 1362 std::list<cls_rgw_reshard_entry> entries;
31f18b77
FG
1363 bool is_truncated{false};
1364
1365 cls_rgw_reshard_list_ret() {}
1366
f67539c2 1367 void encode(ceph::buffer::list& bl) const {
31f18b77 1368 ENCODE_START(1, 1, bl);
11fdf7f2
TL
1369 encode(entries, bl);
1370 encode(is_truncated, bl);
31f18b77
FG
1371 ENCODE_FINISH(bl);
1372 }
1373
f67539c2 1374 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1375 DECODE_START(1, bl);
11fdf7f2
TL
1376 decode(entries, bl);
1377 decode(is_truncated, bl);
31f18b77
FG
1378 DECODE_FINISH(bl);
1379 }
f67539c2
TL
1380 static void generate_test_instances(std::list<cls_rgw_reshard_list_ret*>& o);
1381 void dump(ceph::Formatter *f) const;
31f18b77
FG
1382};
1383WRITE_CLASS_ENCODER(cls_rgw_reshard_list_ret)
1384
1385struct cls_rgw_reshard_get_op {
1386 cls_rgw_reshard_entry entry;
1387
1388 cls_rgw_reshard_get_op() {}
1389
f67539c2 1390 void encode(ceph::buffer::list& bl) const {
31f18b77 1391 ENCODE_START(1, 1, bl);
11fdf7f2 1392 encode(entry, bl);
31f18b77
FG
1393 ENCODE_FINISH(bl);
1394 }
1395
f67539c2 1396 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1397 DECODE_START(1, bl);
11fdf7f2 1398 decode(entry, bl);
31f18b77
FG
1399 DECODE_FINISH(bl);
1400 }
f67539c2
TL
1401 static void generate_test_instances(std::list<cls_rgw_reshard_get_op*>& o);
1402 void dump(ceph::Formatter *f) const;
31f18b77
FG
1403};
1404WRITE_CLASS_ENCODER(cls_rgw_reshard_get_op)
1405
1406struct cls_rgw_reshard_get_ret {
1407 cls_rgw_reshard_entry entry;
1408
1409 cls_rgw_reshard_get_ret() {}
1410
f67539c2 1411 void encode(ceph::buffer::list& bl) const {
31f18b77 1412 ENCODE_START(1, 1, bl);
11fdf7f2 1413 encode(entry, bl);
31f18b77
FG
1414 ENCODE_FINISH(bl);
1415 }
1416
f67539c2 1417 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1418 DECODE_START(1, bl);
11fdf7f2 1419 decode(entry, bl);
31f18b77
FG
1420 DECODE_FINISH(bl);
1421 }
f67539c2
TL
1422 static void generate_test_instances(std::list<cls_rgw_reshard_get_ret*>& o);
1423 void dump(ceph::Formatter *f) const;
31f18b77
FG
1424};
1425WRITE_CLASS_ENCODER(cls_rgw_reshard_get_ret)
1426
1427struct cls_rgw_reshard_remove_op {
f67539c2
TL
1428 std::string tenant;
1429 std::string bucket_name;
1430 std::string bucket_id;
31f18b77
FG
1431
1432 cls_rgw_reshard_remove_op() {}
1433
f67539c2 1434 void encode(ceph::buffer::list& bl) const {
31f18b77 1435 ENCODE_START(1, 1, bl);
11fdf7f2
TL
1436 encode(tenant, bl);
1437 encode(bucket_name, bl);
1438 encode(bucket_id, bl);
31f18b77
FG
1439 ENCODE_FINISH(bl);
1440 }
1441
f67539c2 1442 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1443 DECODE_START(1, bl);
11fdf7f2
TL
1444 decode(tenant, bl);
1445 decode(bucket_name, bl);
1446 decode(bucket_id, bl);
31f18b77
FG
1447 DECODE_FINISH(bl);
1448 }
f67539c2
TL
1449 static void generate_test_instances(std::list<cls_rgw_reshard_remove_op*>& o);
1450 void dump(ceph::Formatter *f) const;
31f18b77
FG
1451};
1452WRITE_CLASS_ENCODER(cls_rgw_reshard_remove_op)
1453
1454struct cls_rgw_set_bucket_resharding_op {
1455 cls_rgw_bucket_instance_entry entry;
1456
f67539c2 1457 void encode(ceph::buffer::list& bl) const {
31f18b77 1458 ENCODE_START(1, 1, bl);
11fdf7f2 1459 encode(entry, bl);
31f18b77
FG
1460 ENCODE_FINISH(bl);
1461 }
1462
f67539c2 1463 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1464 DECODE_START(1, bl);
11fdf7f2 1465 decode(entry, bl);
31f18b77
FG
1466 DECODE_FINISH(bl);
1467 }
f67539c2
TL
1468 static void generate_test_instances(std::list<cls_rgw_set_bucket_resharding_op*>& o);
1469 void dump(ceph::Formatter *f) const;
31f18b77
FG
1470};
1471WRITE_CLASS_ENCODER(cls_rgw_set_bucket_resharding_op)
1472
1473struct cls_rgw_clear_bucket_resharding_op {
f67539c2 1474 void encode(ceph::buffer::list& bl) const {
31f18b77
FG
1475 ENCODE_START(1, 1, bl);
1476 ENCODE_FINISH(bl);
1477 }
1478
f67539c2 1479 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77
FG
1480 DECODE_START(1, bl);
1481 DECODE_FINISH(bl);
1482 }
f67539c2
TL
1483 static void generate_test_instances(std::list<cls_rgw_clear_bucket_resharding_op*>& o);
1484 void dump(ceph::Formatter *f) const;
31f18b77
FG
1485};
1486WRITE_CLASS_ENCODER(cls_rgw_clear_bucket_resharding_op)
1487
1488struct cls_rgw_guard_bucket_resharding_op {
1489 int ret_err{0};
1490
f67539c2 1491 void encode(ceph::buffer::list& bl) const {
31f18b77 1492 ENCODE_START(1, 1, bl);
11fdf7f2 1493 encode(ret_err, bl);
31f18b77
FG
1494 ENCODE_FINISH(bl);
1495 }
1496
f67539c2 1497 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1498 DECODE_START(1, bl);
11fdf7f2 1499 decode(ret_err, bl);
31f18b77
FG
1500 DECODE_FINISH(bl);
1501 }
1502
f67539c2
TL
1503 static void generate_test_instances(std::list<cls_rgw_guard_bucket_resharding_op*>& o);
1504 void dump(ceph::Formatter *f) const;
31f18b77
FG
1505};
1506WRITE_CLASS_ENCODER(cls_rgw_guard_bucket_resharding_op)
1507
1508struct cls_rgw_get_bucket_resharding_op {
1509
f67539c2 1510 void encode(ceph::buffer::list& bl) const {
31f18b77
FG
1511 ENCODE_START(1, 1, bl);
1512 ENCODE_FINISH(bl);
1513 }
1514
f67539c2 1515 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77
FG
1516 DECODE_START(1, bl);
1517 DECODE_FINISH(bl);
1518 }
1519
f67539c2
TL
1520 static void generate_test_instances(std::list<cls_rgw_get_bucket_resharding_op*>& o);
1521 void dump(ceph::Formatter *f) const;
31f18b77
FG
1522};
1523WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_op)
1524
1525struct cls_rgw_get_bucket_resharding_ret {
1526 cls_rgw_bucket_instance_entry new_instance;
1527
f67539c2 1528 void encode(ceph::buffer::list& bl) const {
31f18b77 1529 ENCODE_START(1, 1, bl);
11fdf7f2 1530 encode(new_instance, bl);
31f18b77
FG
1531 ENCODE_FINISH(bl);
1532 }
1533
f67539c2 1534 void decode(ceph::buffer::list::const_iterator& bl) {
31f18b77 1535 DECODE_START(1, bl);
11fdf7f2 1536 decode(new_instance, bl);
31f18b77
FG
1537 DECODE_FINISH(bl);
1538 }
1539
f67539c2
TL
1540 static void generate_test_instances(std::list<cls_rgw_get_bucket_resharding_ret*>& o);
1541 void dump(ceph::Formatter *f) const;
31f18b77
FG
1542};
1543WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_ret)