]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls/rgw/cls_rgw_ops.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / cls / rgw / cls_rgw_ops.h
1 #ifndef CEPH_CLS_RGW_OPS_H
2 #define CEPH_CLS_RGW_OPS_H
3
4 #include "cls/rgw/cls_rgw_types.h"
5
6 struct 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::const_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 };
25 WRITE_CLASS_ENCODER(rgw_cls_tag_timeout_op)
26
27 struct 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;
35 rgw_zone_set zones_trace;
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 {
40 ENCODE_START(7, 5, bl);
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);
48 encode(zones_trace, bl);
49 ENCODE_FINISH(bl);
50 }
51 void decode(bufferlist::const_iterator &bl) {
52 DECODE_START_LEGACY_COMPAT_LEN(7, 3, 3, bl);
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 }
72 if (struct_v >= 7) {
73 decode(zones_trace, bl);
74 }
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 };
80 WRITE_CLASS_ENCODER(rgw_cls_obj_prepare_op)
81
82 struct 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 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;
94 rgw_zone_set zones_trace;
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 {
99 ENCODE_START(9, 7, bl);
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);
111 encode(zones_trace, bl);
112 ENCODE_FINISH(bl);
113 }
114 void decode(bufferlist::const_iterator &bl) {
115 DECODE_START_LEGACY_COMPAT_LEN(9, 3, 3, bl);
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 }
155 if (struct_v >= 9) {
156 decode(zones_trace, bl);
157 }
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 };
163 WRITE_CLASS_ENCODER(rgw_cls_obj_complete_op)
164
165 struct rgw_cls_link_olh_op {
166 cls_rgw_obj_key key;
167 string olh_tag;
168 bool delete_marker;
169 string op_tag;
170 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;
176 rgw_zone_set zones_trace;
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 {
181 ENCODE_START(5, 1, bl);
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);
194 encode(zones_trace, bl);
195 ENCODE_FINISH(bl);
196 }
197
198 void decode(bufferlist::const_iterator& bl) {
199 DECODE_START(5, bl);
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) {
214 uint64_t t;
215 decode(t, bl);
216 decode(unmod_since, bl);
217 }
218 if (struct_v >= 4) {
219 decode(high_precision_time, bl);
220 }
221 if (struct_v >= 5) {
222 decode(zones_trace, bl);
223 }
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 };
230 WRITE_CLASS_ENCODER(rgw_cls_link_olh_op)
231
232 struct 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;
239 rgw_zone_set zones_trace;
240
241 rgw_cls_unlink_instance_op() : olh_epoch(0), log_op(false), bilog_flags(0) {}
242
243 void encode(bufferlist& bl) const {
244 ENCODE_START(3, 1, bl);
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);
251 encode(zones_trace, bl);
252 ENCODE_FINISH(bl);
253 }
254
255 void decode(bufferlist::const_iterator& bl) {
256 DECODE_START(3, bl);
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 }
265 if (struct_v >= 3) {
266 decode(zones_trace, bl);
267 }
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 };
274 WRITE_CLASS_ENCODER(rgw_cls_unlink_instance_op)
275
276 struct 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::const_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 };
301 WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_op)
302
303
304 struct rgw_cls_read_olh_log_ret
305 {
306 map<uint64_t, vector<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::const_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 };
326 WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_ret)
327
328 struct 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::const_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 };
353 WRITE_CLASS_ENCODER(rgw_cls_trim_olh_log_op)
354
355 struct 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::const_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 };
378 WRITE_CLASS_ENCODER(rgw_cls_bucket_clear_olh_op)
379
380 struct 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::const_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 };
414 WRITE_CLASS_ENCODER(rgw_cls_list_op)
415
416 struct rgw_cls_list_ret {
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::const_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 };
437 WRITE_CLASS_ENCODER(rgw_cls_list_ret)
438
439 struct 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::const_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 };
461 WRITE_CLASS_ENCODER(rgw_cls_check_index_ret)
462
463 struct rgw_cls_bucket_update_stats_op
464 {
465 bool absolute{false};
466 map<RGWObjCategory, 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::const_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 };
485 WRITE_CLASS_ENCODER(rgw_cls_bucket_update_stats_op)
486
487 struct 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::const_iterator& bl) {
497 DECODE_START(1, bl);
498 decode(keep_attr_prefixes, bl);
499 DECODE_FINISH(bl);
500 }
501 };
502 WRITE_CLASS_ENCODER(rgw_cls_obj_remove_op)
503
504 struct 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::const_iterator& bl) {
514 DECODE_START(1, bl);
515 decode(attr, bl);
516 DECODE_FINISH(bl);
517 }
518 };
519 WRITE_CLASS_ENCODER(rgw_cls_obj_store_pg_ver_op)
520
521 struct 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::const_iterator& bl) {
535 DECODE_START(1, bl);
536 decode(check_prefix, bl);
537 decode(fail_if_exist, bl);
538 DECODE_FINISH(bl);
539 }
540 };
541 WRITE_CLASS_ENCODER(rgw_cls_obj_check_attrs_prefix)
542
543 struct 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::const_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 };
570 WRITE_CLASS_ENCODER(rgw_cls_obj_check_mtime)
571
572 struct 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::const_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 };
594 WRITE_CLASS_ENCODER(rgw_cls_usage_log_add_op)
595
596 struct 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(BIIndexType::Plain) {}
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::const_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 };
618 WRITE_CLASS_ENCODER(rgw_cls_bi_get_op)
619
620 struct 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::const_iterator& bl) {
632 DECODE_START(1, bl);
633 decode(entry, bl);
634 DECODE_FINISH(bl);
635 }
636 };
637 WRITE_CLASS_ENCODER(rgw_cls_bi_get_ret)
638
639 struct 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::const_iterator& bl) {
651 DECODE_START(1, bl);
652 decode(entry, bl);
653 DECODE_FINISH(bl);
654 }
655 };
656 WRITE_CLASS_ENCODER(rgw_cls_bi_put_op)
657
658 struct 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::const_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 };
681 WRITE_CLASS_ENCODER(rgw_cls_bi_list_op)
682
683 struct 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::const_iterator& bl) {
697 DECODE_START(1, bl);
698 decode(entries, bl);
699 decode(is_truncated, bl);
700 DECODE_FINISH(bl);
701 }
702 };
703 WRITE_CLASS_ENCODER(rgw_cls_bi_list_ret)
704
705 struct rgw_cls_usage_log_read_op {
706 uint64_t start_epoch;
707 uint64_t end_epoch;
708 string owner;
709 string bucket;
710
711 string iter; // should be empty for the first call, non empty for subsequent calls
712 uint32_t max_entries;
713
714 void encode(bufferlist& bl) const {
715 ENCODE_START(2, 1, bl);
716 encode(start_epoch, bl);
717 encode(end_epoch, bl);
718 encode(owner, bl);
719 encode(iter, bl);
720 encode(max_entries, bl);
721 encode(bucket, bl);
722 ENCODE_FINISH(bl);
723 }
724
725 void decode(bufferlist::const_iterator& bl) {
726 DECODE_START(2, bl);
727 decode(start_epoch, bl);
728 decode(end_epoch, bl);
729 decode(owner, bl);
730 decode(iter, bl);
731 decode(max_entries, bl);
732 if (struct_v >= 2) {
733 decode(bucket, bl);
734 }
735 DECODE_FINISH(bl);
736 }
737 };
738 WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_op)
739
740 struct rgw_cls_usage_log_read_ret {
741 map<rgw_user_bucket, rgw_usage_log_entry> usage;
742 bool truncated;
743 string next_iter;
744
745 void encode(bufferlist& bl) const {
746 ENCODE_START(1, 1, bl);
747 encode(usage, bl);
748 encode(truncated, bl);
749 encode(next_iter, bl);
750 ENCODE_FINISH(bl);
751 }
752
753 void decode(bufferlist::const_iterator& bl) {
754 DECODE_START(1, bl);
755 decode(usage, bl);
756 decode(truncated, bl);
757 decode(next_iter, bl);
758 DECODE_FINISH(bl);
759 }
760 };
761 WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_ret)
762
763 struct rgw_cls_usage_log_trim_op {
764 uint64_t start_epoch;
765 uint64_t end_epoch;
766 string user;
767 string bucket;
768
769 void encode(bufferlist& bl) const {
770 ENCODE_START(3, 2, bl);
771 encode(start_epoch, bl);
772 encode(end_epoch, bl);
773 encode(user, bl);
774 encode(bucket, bl);
775 ENCODE_FINISH(bl);
776 }
777
778 void decode(bufferlist::const_iterator& bl) {
779 DECODE_START(3, bl);
780 decode(start_epoch, bl);
781 decode(end_epoch, bl);
782 decode(user, bl);
783 if (struct_v >= 3) {
784 decode(bucket, bl);
785 }
786 DECODE_FINISH(bl);
787 }
788 };
789 WRITE_CLASS_ENCODER(rgw_cls_usage_log_trim_op)
790
791 struct cls_rgw_gc_set_entry_op {
792 uint32_t expiration_secs;
793 cls_rgw_gc_obj_info info;
794 cls_rgw_gc_set_entry_op() : expiration_secs(0) {}
795
796 void encode(bufferlist& bl) const {
797 ENCODE_START(1, 1, bl);
798 encode(expiration_secs, bl);
799 encode(info, bl);
800 ENCODE_FINISH(bl);
801 }
802
803 void decode(bufferlist::const_iterator& bl) {
804 DECODE_START(1, bl);
805 decode(expiration_secs, bl);
806 decode(info, bl);
807 DECODE_FINISH(bl);
808 }
809
810 void dump(Formatter *f) const;
811 static void generate_test_instances(list<cls_rgw_gc_set_entry_op*>& ls);
812 };
813 WRITE_CLASS_ENCODER(cls_rgw_gc_set_entry_op)
814
815 struct cls_rgw_gc_defer_entry_op {
816 uint32_t expiration_secs;
817 string tag;
818 cls_rgw_gc_defer_entry_op() : expiration_secs(0) {}
819
820 void encode(bufferlist& bl) const {
821 ENCODE_START(1, 1, bl);
822 encode(expiration_secs, bl);
823 encode(tag, bl);
824 ENCODE_FINISH(bl);
825 }
826
827 void decode(bufferlist::const_iterator& bl) {
828 DECODE_START(1, bl);
829 decode(expiration_secs, bl);
830 decode(tag, bl);
831 DECODE_FINISH(bl);
832 }
833
834 void dump(Formatter *f) const;
835 static void generate_test_instances(list<cls_rgw_gc_defer_entry_op*>& ls);
836 };
837 WRITE_CLASS_ENCODER(cls_rgw_gc_defer_entry_op)
838
839 struct cls_rgw_gc_list_op {
840 string marker;
841 uint32_t max;
842 bool expired_only;
843
844 cls_rgw_gc_list_op() : max(0), expired_only(true) {}
845
846 void encode(bufferlist& bl) const {
847 ENCODE_START(2, 1, bl);
848 encode(marker, bl);
849 encode(max, bl);
850 encode(expired_only, bl);
851 ENCODE_FINISH(bl);
852 }
853
854 void decode(bufferlist::const_iterator& bl) {
855 DECODE_START(2, bl);
856 decode(marker, bl);
857 decode(max, bl);
858 if (struct_v >= 2) {
859 decode(expired_only, bl);
860 }
861 DECODE_FINISH(bl);
862 }
863
864 void dump(Formatter *f) const;
865 static void generate_test_instances(list<cls_rgw_gc_list_op*>& ls);
866 };
867 WRITE_CLASS_ENCODER(cls_rgw_gc_list_op)
868
869 struct cls_rgw_gc_list_ret {
870 list<cls_rgw_gc_obj_info> entries;
871 string next_marker;
872 bool truncated;
873
874 cls_rgw_gc_list_ret() : truncated(false) {}
875
876 void encode(bufferlist& bl) const {
877 ENCODE_START(2, 1, bl);
878 encode(entries, bl);
879 encode(next_marker, bl);
880 encode(truncated, bl);
881 ENCODE_FINISH(bl);
882 }
883
884 void decode(bufferlist::const_iterator& bl) {
885 DECODE_START(2, bl);
886 decode(entries, bl);
887 if (struct_v >= 2)
888 decode(next_marker, bl);
889 decode(truncated, bl);
890 DECODE_FINISH(bl);
891 }
892
893 void dump(Formatter *f) const;
894 static void generate_test_instances(list<cls_rgw_gc_list_ret*>& ls);
895 };
896 WRITE_CLASS_ENCODER(cls_rgw_gc_list_ret)
897
898 struct cls_rgw_gc_remove_op {
899 vector<string> tags;
900
901 cls_rgw_gc_remove_op() {}
902
903 void encode(bufferlist& bl) const {
904 ENCODE_START(1, 1, bl);
905 encode(tags, bl);
906 ENCODE_FINISH(bl);
907 }
908
909 void decode(bufferlist::const_iterator& bl) {
910 DECODE_START(1, bl);
911 decode(tags, bl);
912 DECODE_FINISH(bl);
913 }
914
915 void dump(Formatter *f) const;
916 static void generate_test_instances(list<cls_rgw_gc_remove_op*>& ls);
917 };
918 WRITE_CLASS_ENCODER(cls_rgw_gc_remove_op)
919
920 struct cls_rgw_bi_log_list_op {
921 string marker;
922 uint32_t max;
923
924 cls_rgw_bi_log_list_op() : max(0) {}
925
926 void encode(bufferlist& bl) const {
927 ENCODE_START(1, 1, bl);
928 encode(marker, bl);
929 encode(max, bl);
930 ENCODE_FINISH(bl);
931 }
932
933 void decode(bufferlist::const_iterator& bl) {
934 DECODE_START(1, bl);
935 decode(marker, bl);
936 decode(max, bl);
937 DECODE_FINISH(bl);
938 }
939
940 void dump(Formatter *f) const;
941 static void generate_test_instances(list<cls_rgw_bi_log_list_op*>& ls);
942 };
943 WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_op)
944
945 struct cls_rgw_bi_log_trim_op {
946 string start_marker;
947 string end_marker;
948
949 cls_rgw_bi_log_trim_op() {}
950
951 void encode(bufferlist& bl) const {
952 ENCODE_START(1, 1, bl);
953 encode(start_marker, bl);
954 encode(end_marker, bl);
955 ENCODE_FINISH(bl);
956 }
957
958 void decode(bufferlist::const_iterator& bl) {
959 DECODE_START(1, bl);
960 decode(start_marker, bl);
961 decode(end_marker, bl);
962 DECODE_FINISH(bl);
963 }
964
965 void dump(Formatter *f) const;
966 static void generate_test_instances(list<cls_rgw_bi_log_trim_op*>& ls);
967 };
968 WRITE_CLASS_ENCODER(cls_rgw_bi_log_trim_op)
969
970 struct cls_rgw_bi_log_list_ret {
971 list<rgw_bi_log_entry> entries;
972 bool truncated;
973
974 cls_rgw_bi_log_list_ret() : truncated(false) {}
975
976 void encode(bufferlist& bl) const {
977 ENCODE_START(1, 1, bl);
978 encode(entries, bl);
979 encode(truncated, bl);
980 ENCODE_FINISH(bl);
981 }
982
983 void decode(bufferlist::const_iterator& bl) {
984 DECODE_START(1, bl);
985 decode(entries, bl);
986 decode(truncated, bl);
987 DECODE_FINISH(bl);
988 }
989
990 void dump(Formatter *f) const;
991 static void generate_test_instances(list<cls_rgw_bi_log_list_ret*>& ls);
992 };
993 WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_ret)
994
995 struct cls_rgw_lc_get_next_entry_op {
996 string marker;
997 cls_rgw_lc_get_next_entry_op() {}
998
999 void encode(bufferlist& bl) const {
1000 ENCODE_START(1, 1, bl);
1001 encode(marker, bl);
1002 ENCODE_FINISH(bl);
1003 }
1004
1005 void decode(bufferlist::const_iterator& bl) {
1006 DECODE_START(1, bl);
1007 decode(marker, bl);
1008 DECODE_FINISH(bl);
1009 }
1010 };
1011 WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_op)
1012
1013 using rgw_lc_entry_t = std::pair<std::string, int>;
1014
1015 struct cls_rgw_lc_get_next_entry_ret {
1016 rgw_lc_entry_t entry;
1017 cls_rgw_lc_get_next_entry_ret() {}
1018
1019 void encode(bufferlist& bl) const {
1020 ENCODE_START(1, 1, bl);
1021 encode(entry, bl);
1022 ENCODE_FINISH(bl);
1023 }
1024
1025 void decode(bufferlist::const_iterator& bl) {
1026 DECODE_START(1, bl);
1027 decode(entry, bl);
1028 DECODE_FINISH(bl);
1029 }
1030
1031 };
1032 WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_ret)
1033
1034 struct cls_rgw_lc_get_entry_op {
1035 string marker;
1036 cls_rgw_lc_get_entry_op() {}
1037 cls_rgw_lc_get_entry_op(const std::string& _marker) : marker(_marker) {}
1038
1039 void encode(bufferlist& bl) const {
1040 ENCODE_START(1, 1, bl);
1041 encode(marker, bl);
1042 ENCODE_FINISH(bl);
1043 }
1044
1045 void decode(bufferlist::const_iterator& bl) {
1046 DECODE_START(1, bl);
1047 decode(marker, bl);
1048 DECODE_FINISH(bl);
1049 }
1050 };
1051 WRITE_CLASS_ENCODER(cls_rgw_lc_get_entry_op)
1052
1053 struct cls_rgw_lc_get_entry_ret {
1054 rgw_lc_entry_t entry;
1055 cls_rgw_lc_get_entry_ret() {}
1056 cls_rgw_lc_get_entry_ret(rgw_lc_entry_t&& _entry) : entry(std::move(_entry)) {}
1057
1058 void encode(bufferlist& bl) const {
1059 ENCODE_START(1, 1, bl);
1060 encode(entry, bl);
1061 ENCODE_FINISH(bl);
1062 }
1063
1064 void decode(bufferlist::const_iterator& bl) {
1065 DECODE_START(1, bl);
1066 decode(entry, bl);
1067 DECODE_FINISH(bl);
1068 }
1069
1070 };
1071 WRITE_CLASS_ENCODER(cls_rgw_lc_get_entry_ret)
1072
1073
1074 struct cls_rgw_lc_rm_entry_op {
1075 rgw_lc_entry_t entry;
1076 cls_rgw_lc_rm_entry_op() {}
1077
1078 void encode(bufferlist& bl) const {
1079 ENCODE_START(1, 1, bl);
1080 encode(entry, bl);
1081 ENCODE_FINISH(bl);
1082 }
1083
1084 void decode(bufferlist::const_iterator& bl) {
1085 DECODE_START(1, bl);
1086 decode(entry, bl);
1087 DECODE_FINISH(bl);
1088 }
1089 };
1090 WRITE_CLASS_ENCODER(cls_rgw_lc_rm_entry_op)
1091
1092 struct cls_rgw_lc_set_entry_op {
1093 rgw_lc_entry_t entry;
1094 cls_rgw_lc_set_entry_op() {}
1095
1096 void encode(bufferlist& bl) const {
1097 ENCODE_START(1, 1, bl);
1098 encode(entry, bl);
1099 ENCODE_FINISH(bl);
1100 }
1101
1102 void decode(bufferlist::const_iterator& bl) {
1103 DECODE_START(1, bl);
1104 decode(entry, bl);
1105 DECODE_FINISH(bl);
1106 }
1107 };
1108 WRITE_CLASS_ENCODER(cls_rgw_lc_set_entry_op)
1109
1110 struct cls_rgw_lc_put_head_op {
1111 cls_rgw_lc_obj_head head;
1112
1113
1114 cls_rgw_lc_put_head_op() {}
1115
1116 void encode(bufferlist& bl) const {
1117 ENCODE_START(1, 1, bl);
1118 encode(head, bl);
1119 ENCODE_FINISH(bl);
1120 }
1121
1122 void decode(bufferlist::const_iterator& bl) {
1123 DECODE_START(1, bl);
1124 decode(head, bl);
1125 DECODE_FINISH(bl);
1126 }
1127
1128 };
1129 WRITE_CLASS_ENCODER(cls_rgw_lc_put_head_op)
1130
1131 struct cls_rgw_lc_get_head_ret {
1132 cls_rgw_lc_obj_head head;
1133
1134 cls_rgw_lc_get_head_ret() {}
1135
1136 void encode(bufferlist& bl) const {
1137 ENCODE_START(1, 1, bl);
1138 encode(head, bl);
1139 ENCODE_FINISH(bl);
1140 }
1141
1142 void decode(bufferlist::const_iterator& bl) {
1143 DECODE_START(1, bl);
1144 decode(head, bl);
1145 DECODE_FINISH(bl);
1146 }
1147
1148 };
1149 WRITE_CLASS_ENCODER(cls_rgw_lc_get_head_ret)
1150
1151 struct cls_rgw_lc_list_entries_op {
1152 string marker;
1153 uint32_t max_entries = 0;
1154
1155 cls_rgw_lc_list_entries_op() {}
1156
1157 void encode(bufferlist& bl) const {
1158 ENCODE_START(1, 1, bl);
1159 encode(marker, bl);
1160 encode(max_entries, bl);
1161 ENCODE_FINISH(bl);
1162 }
1163
1164 void decode(bufferlist::const_iterator& bl) {
1165 DECODE_START(1, bl);
1166 decode(marker, bl);
1167 decode(max_entries, bl);
1168 DECODE_FINISH(bl);
1169 }
1170
1171 };
1172 WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_op)
1173
1174 struct cls_rgw_lc_list_entries_ret {
1175 map<string, int> entries;
1176 bool is_truncated{false};
1177
1178 cls_rgw_lc_list_entries_ret() {}
1179
1180 void encode(bufferlist& bl) const {
1181 ENCODE_START(2, 1, bl);
1182 encode(entries, bl);
1183 encode(is_truncated, bl);
1184 ENCODE_FINISH(bl);
1185 }
1186
1187 void decode(bufferlist::const_iterator& bl) {
1188 DECODE_START(2, bl);
1189 decode(entries, bl);
1190 if (struct_v >= 2) {
1191 decode(is_truncated, bl);
1192 }
1193 DECODE_FINISH(bl);
1194 }
1195
1196 };
1197 WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_ret)
1198
1199 struct cls_rgw_reshard_add_op {
1200 cls_rgw_reshard_entry entry;
1201
1202 cls_rgw_reshard_add_op() {}
1203
1204 void encode(bufferlist& bl) const {
1205 ENCODE_START(1, 1, bl);
1206 encode(entry, bl);
1207 ENCODE_FINISH(bl);
1208 }
1209
1210 void decode(bufferlist::const_iterator& bl) {
1211 DECODE_START(1, bl);
1212 decode(entry, bl);
1213 DECODE_FINISH(bl);
1214 }
1215 static void generate_test_instances(list<cls_rgw_reshard_add_op*>& o);
1216 void dump(Formatter *f) const;
1217 };
1218 WRITE_CLASS_ENCODER(cls_rgw_reshard_add_op)
1219
1220 struct cls_rgw_reshard_list_op {
1221 uint32_t max{0};
1222 string marker;
1223
1224 cls_rgw_reshard_list_op() {}
1225
1226 void encode(bufferlist& bl) const {
1227 ENCODE_START(1, 1, bl);
1228 encode(max, bl);
1229 encode(marker, bl);
1230 ENCODE_FINISH(bl);
1231 }
1232
1233 void decode(bufferlist::const_iterator& bl) {
1234 DECODE_START(1, bl);
1235 decode(max, bl);
1236 decode(marker, bl);
1237 DECODE_FINISH(bl);
1238 }
1239 static void generate_test_instances(list<cls_rgw_reshard_list_op*>& o);
1240 void dump(Formatter *f) const;
1241 };
1242 WRITE_CLASS_ENCODER(cls_rgw_reshard_list_op)
1243
1244
1245 struct cls_rgw_reshard_list_ret {
1246 list<cls_rgw_reshard_entry> entries;
1247 bool is_truncated{false};
1248
1249 cls_rgw_reshard_list_ret() {}
1250
1251 void encode(bufferlist& bl) const {
1252 ENCODE_START(1, 1, bl);
1253 encode(entries, bl);
1254 encode(is_truncated, bl);
1255 ENCODE_FINISH(bl);
1256 }
1257
1258 void decode(bufferlist::const_iterator& bl) {
1259 DECODE_START(1, bl);
1260 decode(entries, bl);
1261 decode(is_truncated, bl);
1262 DECODE_FINISH(bl);
1263 }
1264 static void generate_test_instances(list<cls_rgw_reshard_list_ret*>& o);
1265 void dump(Formatter *f) const;
1266 };
1267 WRITE_CLASS_ENCODER(cls_rgw_reshard_list_ret)
1268
1269 struct cls_rgw_reshard_get_op {
1270 cls_rgw_reshard_entry entry;
1271
1272 cls_rgw_reshard_get_op() {}
1273
1274 void encode(bufferlist& bl) const {
1275 ENCODE_START(1, 1, bl);
1276 encode(entry, bl);
1277 ENCODE_FINISH(bl);
1278 }
1279
1280 void decode(bufferlist::const_iterator& bl) {
1281 DECODE_START(1, bl);
1282 decode(entry, bl);
1283 DECODE_FINISH(bl);
1284 }
1285 static void generate_test_instances(list<cls_rgw_reshard_get_op*>& o);
1286 void dump(Formatter *f) const;
1287 };
1288 WRITE_CLASS_ENCODER(cls_rgw_reshard_get_op)
1289
1290 struct cls_rgw_reshard_get_ret {
1291 cls_rgw_reshard_entry entry;
1292
1293 cls_rgw_reshard_get_ret() {}
1294
1295 void encode(bufferlist& bl) const {
1296 ENCODE_START(1, 1, bl);
1297 encode(entry, bl);
1298 ENCODE_FINISH(bl);
1299 }
1300
1301 void decode(bufferlist::const_iterator& bl) {
1302 DECODE_START(1, bl);
1303 decode(entry, bl);
1304 DECODE_FINISH(bl);
1305 }
1306 static void generate_test_instances(list<cls_rgw_reshard_get_ret*>& o);
1307 void dump(Formatter *f) const;
1308 };
1309 WRITE_CLASS_ENCODER(cls_rgw_reshard_get_ret)
1310
1311 struct cls_rgw_reshard_remove_op {
1312 string tenant;
1313 string bucket_name;
1314 string bucket_id;
1315
1316 cls_rgw_reshard_remove_op() {}
1317
1318 void encode(bufferlist& bl) const {
1319 ENCODE_START(1, 1, bl);
1320 encode(tenant, bl);
1321 encode(bucket_name, bl);
1322 encode(bucket_id, bl);
1323 ENCODE_FINISH(bl);
1324 }
1325
1326 void decode(bufferlist::const_iterator& bl) {
1327 DECODE_START(1, bl);
1328 decode(tenant, bl);
1329 decode(bucket_name, bl);
1330 decode(bucket_id, bl);
1331 DECODE_FINISH(bl);
1332 }
1333 static void generate_test_instances(list<cls_rgw_reshard_remove_op*>& o);
1334 void dump(Formatter *f) const;
1335 };
1336 WRITE_CLASS_ENCODER(cls_rgw_reshard_remove_op)
1337
1338 struct cls_rgw_set_bucket_resharding_op {
1339 cls_rgw_bucket_instance_entry entry;
1340
1341 void encode(bufferlist& bl) const {
1342 ENCODE_START(1, 1, bl);
1343 encode(entry, bl);
1344 ENCODE_FINISH(bl);
1345 }
1346
1347 void decode(bufferlist::const_iterator& bl) {
1348 DECODE_START(1, bl);
1349 decode(entry, bl);
1350 DECODE_FINISH(bl);
1351 }
1352 static void generate_test_instances(list<cls_rgw_set_bucket_resharding_op*>& o);
1353 void dump(Formatter *f) const;
1354 };
1355 WRITE_CLASS_ENCODER(cls_rgw_set_bucket_resharding_op)
1356
1357 struct cls_rgw_clear_bucket_resharding_op {
1358 void encode(bufferlist& bl) const {
1359 ENCODE_START(1, 1, bl);
1360 ENCODE_FINISH(bl);
1361 }
1362
1363 void decode(bufferlist::const_iterator& bl) {
1364 DECODE_START(1, bl);
1365 DECODE_FINISH(bl);
1366 }
1367 static void generate_test_instances(list<cls_rgw_clear_bucket_resharding_op*>& o);
1368 void dump(Formatter *f) const;
1369 };
1370 WRITE_CLASS_ENCODER(cls_rgw_clear_bucket_resharding_op)
1371
1372 struct cls_rgw_guard_bucket_resharding_op {
1373 int ret_err{0};
1374
1375 void encode(bufferlist& bl) const {
1376 ENCODE_START(1, 1, bl);
1377 encode(ret_err, bl);
1378 ENCODE_FINISH(bl);
1379 }
1380
1381 void decode(bufferlist::const_iterator& bl) {
1382 DECODE_START(1, bl);
1383 decode(ret_err, bl);
1384 DECODE_FINISH(bl);
1385 }
1386
1387 static void generate_test_instances(list<cls_rgw_guard_bucket_resharding_op*>& o);
1388 void dump(Formatter *f) const;
1389 };
1390 WRITE_CLASS_ENCODER(cls_rgw_guard_bucket_resharding_op)
1391
1392 struct cls_rgw_get_bucket_resharding_op {
1393
1394 void encode(bufferlist& bl) const {
1395 ENCODE_START(1, 1, bl);
1396 ENCODE_FINISH(bl);
1397 }
1398
1399 void decode(bufferlist::const_iterator& bl) {
1400 DECODE_START(1, bl);
1401 DECODE_FINISH(bl);
1402 }
1403
1404 static void generate_test_instances(list<cls_rgw_get_bucket_resharding_op*>& o);
1405 void dump(Formatter *f) const;
1406 };
1407 WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_op)
1408
1409 struct cls_rgw_get_bucket_resharding_ret {
1410 cls_rgw_bucket_instance_entry new_instance;
1411
1412 void encode(bufferlist& bl) const {
1413 ENCODE_START(1, 1, bl);
1414 encode(new_instance, bl);
1415 ENCODE_FINISH(bl);
1416 }
1417
1418 void decode(bufferlist::const_iterator& bl) {
1419 DECODE_START(1, bl);
1420 decode(new_instance, bl);
1421 DECODE_FINISH(bl);
1422 }
1423
1424 static void generate_test_instances(list<cls_rgw_get_bucket_resharding_ret*>& o);
1425 void dump(Formatter *f) const;
1426 };
1427 WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_ret)
1428
1429 #endif /* CEPH_CLS_RGW_OPS_H */