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