]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls/rgw/cls_rgw_ops.h
07ebeea12fde758122a897ffc2cdd766bfdea6ae
[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::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::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 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;
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::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 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;
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::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::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::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<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 };
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::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::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::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 {
418 rgw_bucket_dir dir;
419 bool is_truncated;
420
421 rgw_cls_list_ret() : is_truncated(false) {}
422
423 void encode(bufferlist &bl) const {
424 ENCODE_START(2, 2, bl);
425 ::encode(dir, bl);
426 ::encode(is_truncated, bl);
427 ENCODE_FINISH(bl);
428 }
429 void decode(bufferlist::iterator &bl) {
430 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
431 ::decode(dir, bl);
432 ::decode(is_truncated, bl);
433 DECODE_FINISH(bl);
434 }
435 void dump(Formatter *f) const;
436 static void generate_test_instances(list<rgw_cls_list_ret*>& o);
437 };
438 WRITE_CLASS_ENCODER(rgw_cls_list_ret)
439
440 struct rgw_cls_check_index_ret
441 {
442 rgw_bucket_dir_header existing_header;
443 rgw_bucket_dir_header calculated_header;
444
445 rgw_cls_check_index_ret() {}
446
447 void encode(bufferlist &bl) const {
448 ENCODE_START(1, 1, bl);
449 ::encode(existing_header, bl);
450 ::encode(calculated_header, bl);
451 ENCODE_FINISH(bl);
452 }
453 void decode(bufferlist::iterator &bl) {
454 DECODE_START(1, bl);
455 ::decode(existing_header, bl);
456 ::decode(calculated_header, bl);
457 DECODE_FINISH(bl);
458 }
459 void dump(Formatter *f) const;
460 static void generate_test_instances(list<rgw_cls_check_index_ret *>& o);
461 };
462 WRITE_CLASS_ENCODER(rgw_cls_check_index_ret)
463
464 struct rgw_cls_bucket_update_stats_op
465 {
466 bool absolute{false};
467 map<uint8_t, rgw_bucket_category_stats> stats;
468
469 rgw_cls_bucket_update_stats_op() {}
470
471 void encode(bufferlist &bl) const {
472 ENCODE_START(1, 1, bl);
473 ::encode(absolute, bl);
474 ::encode(stats, bl);
475 ENCODE_FINISH(bl);
476 }
477 void decode(bufferlist::iterator &bl) {
478 DECODE_START(1, bl);
479 ::decode(absolute, bl);
480 ::decode(stats, bl);
481 DECODE_FINISH(bl);
482 }
483 void dump(Formatter *f) const;
484 static void generate_test_instances(list<rgw_cls_bucket_update_stats_op *>& o);
485 };
486 WRITE_CLASS_ENCODER(rgw_cls_bucket_update_stats_op)
487
488 struct rgw_cls_obj_remove_op {
489 list<string> keep_attr_prefixes;
490
491 void encode(bufferlist& bl) const {
492 ENCODE_START(1, 1, bl);
493 ::encode(keep_attr_prefixes, bl);
494 ENCODE_FINISH(bl);
495 }
496
497 void decode(bufferlist::iterator& bl) {
498 DECODE_START(1, bl);
499 ::decode(keep_attr_prefixes, bl);
500 DECODE_FINISH(bl);
501 }
502 };
503 WRITE_CLASS_ENCODER(rgw_cls_obj_remove_op)
504
505 struct rgw_cls_obj_store_pg_ver_op {
506 string attr;
507
508 void encode(bufferlist& bl) const {
509 ENCODE_START(1, 1, bl);
510 ::encode(attr, bl);
511 ENCODE_FINISH(bl);
512 }
513
514 void decode(bufferlist::iterator& bl) {
515 DECODE_START(1, bl);
516 ::decode(attr, bl);
517 DECODE_FINISH(bl);
518 }
519 };
520 WRITE_CLASS_ENCODER(rgw_cls_obj_store_pg_ver_op)
521
522 struct rgw_cls_obj_check_attrs_prefix {
523 string check_prefix;
524 bool fail_if_exist;
525
526 rgw_cls_obj_check_attrs_prefix() : fail_if_exist(false) {}
527
528 void encode(bufferlist& bl) const {
529 ENCODE_START(1, 1, bl);
530 ::encode(check_prefix, bl);
531 ::encode(fail_if_exist, bl);
532 ENCODE_FINISH(bl);
533 }
534
535 void decode(bufferlist::iterator& bl) {
536 DECODE_START(1, bl);
537 ::decode(check_prefix, bl);
538 ::decode(fail_if_exist, bl);
539 DECODE_FINISH(bl);
540 }
541 };
542 WRITE_CLASS_ENCODER(rgw_cls_obj_check_attrs_prefix)
543
544 struct rgw_cls_obj_check_mtime {
545 ceph::real_time mtime;
546 RGWCheckMTimeType type;
547 bool high_precision_time;
548
549 rgw_cls_obj_check_mtime() : type(CLS_RGW_CHECK_TIME_MTIME_EQ), high_precision_time(false) {}
550
551 void encode(bufferlist& bl) const {
552 ENCODE_START(2, 1, bl);
553 ::encode(mtime, bl);
554 ::encode((uint8_t)type, bl);
555 ::encode(high_precision_time, bl);
556 ENCODE_FINISH(bl);
557 }
558
559 void decode(bufferlist::iterator& bl) {
560 DECODE_START(2, bl);
561 ::decode(mtime, bl);
562 uint8_t c;
563 ::decode(c, bl);
564 type = (RGWCheckMTimeType)c;
565 if (struct_v >= 2) {
566 ::decode(high_precision_time, bl);
567 }
568 DECODE_FINISH(bl);
569 }
570 };
571 WRITE_CLASS_ENCODER(rgw_cls_obj_check_mtime)
572
573 struct rgw_cls_usage_log_add_op {
574 rgw_usage_log_info info;
575 rgw_user user;
576
577 void encode(bufferlist& bl) const {
578 ENCODE_START(2, 1, bl);
579 ::encode(info, bl);
580 ::encode(user.to_str(), bl);
581 ENCODE_FINISH(bl);
582 }
583
584 void decode(bufferlist::iterator& bl) {
585 DECODE_START(2, bl);
586 ::decode(info, bl);
587 if (struct_v >= 2) {
588 string s;
589 ::decode(s, bl);
590 user.from_str(s);
591 }
592 DECODE_FINISH(bl);
593 }
594 };
595 WRITE_CLASS_ENCODER(rgw_cls_usage_log_add_op)
596
597 struct rgw_cls_bi_get_op {
598 cls_rgw_obj_key key;
599 BIIndexType type; /* namespace: plain, instance, olh */
600
601 rgw_cls_bi_get_op() : type(PlainIdx) {}
602
603 void encode(bufferlist& bl) const {
604 ENCODE_START(1, 1, bl);
605 ::encode(key, bl);
606 ::encode((uint8_t)type, bl);
607 ENCODE_FINISH(bl);
608 }
609
610 void decode(bufferlist::iterator& bl) {
611 DECODE_START(1, bl);
612 ::decode(key, bl);
613 uint8_t c;
614 ::decode(c, bl);
615 type = (BIIndexType)c;
616 DECODE_FINISH(bl);
617 }
618 };
619 WRITE_CLASS_ENCODER(rgw_cls_bi_get_op)
620
621 struct rgw_cls_bi_get_ret {
622 rgw_cls_bi_entry entry;
623
624 rgw_cls_bi_get_ret() {}
625
626 void encode(bufferlist& bl) const {
627 ENCODE_START(1, 1, bl);
628 ::encode(entry, bl);
629 ENCODE_FINISH(bl);
630 }
631
632 void decode(bufferlist::iterator& bl) {
633 DECODE_START(1, bl);
634 ::decode(entry, bl);
635 DECODE_FINISH(bl);
636 }
637 };
638 WRITE_CLASS_ENCODER(rgw_cls_bi_get_ret)
639
640 struct rgw_cls_bi_put_op {
641 rgw_cls_bi_entry entry;
642
643 rgw_cls_bi_put_op() {}
644
645 void encode(bufferlist& bl) const {
646 ENCODE_START(1, 1, bl);
647 ::encode(entry, bl);
648 ENCODE_FINISH(bl);
649 }
650
651 void decode(bufferlist::iterator& bl) {
652 DECODE_START(1, bl);
653 ::decode(entry, bl);
654 DECODE_FINISH(bl);
655 }
656 };
657 WRITE_CLASS_ENCODER(rgw_cls_bi_put_op)
658
659 struct rgw_cls_bi_list_op {
660 uint32_t max;
661 string name;
662 string marker;
663
664 rgw_cls_bi_list_op() : max(0) {}
665
666 void encode(bufferlist& bl) const {
667 ENCODE_START(1, 1, bl);
668 ::encode(max, bl);
669 ::encode(name, bl);
670 ::encode(marker, bl);
671 ENCODE_FINISH(bl);
672 }
673
674 void decode(bufferlist::iterator& bl) {
675 DECODE_START(1, bl);
676 ::decode(max, bl);
677 ::decode(name, bl);
678 ::decode(marker, bl);
679 DECODE_FINISH(bl);
680 }
681 };
682 WRITE_CLASS_ENCODER(rgw_cls_bi_list_op)
683
684 struct rgw_cls_bi_list_ret {
685 list<rgw_cls_bi_entry> entries;
686 bool is_truncated;
687
688 rgw_cls_bi_list_ret() : is_truncated(false) {}
689
690 void encode(bufferlist& bl) const {
691 ENCODE_START(1, 1, bl);
692 ::encode(entries, bl);
693 ::encode(is_truncated, bl);
694 ENCODE_FINISH(bl);
695 }
696
697 void decode(bufferlist::iterator& bl) {
698 DECODE_START(1, bl);
699 ::decode(entries, bl);
700 ::decode(is_truncated, bl);
701 DECODE_FINISH(bl);
702 }
703 };
704 WRITE_CLASS_ENCODER(rgw_cls_bi_list_ret)
705
706 struct rgw_cls_usage_log_read_op {
707 uint64_t start_epoch;
708 uint64_t end_epoch;
709 string owner;
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(1, 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_FINISH(bl);
722 }
723
724 void decode(bufferlist::iterator& bl) {
725 DECODE_START(1, bl);
726 ::decode(start_epoch, bl);
727 ::decode(end_epoch, bl);
728 ::decode(owner, bl);
729 ::decode(iter, bl);
730 ::decode(max_entries, bl);
731 DECODE_FINISH(bl);
732 }
733 };
734 WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_op)
735
736 struct rgw_cls_usage_log_read_ret {
737 map<rgw_user_bucket, rgw_usage_log_entry> usage;
738 bool truncated;
739 string next_iter;
740
741 void encode(bufferlist& bl) const {
742 ENCODE_START(1, 1, bl);
743 ::encode(usage, bl);
744 ::encode(truncated, bl);
745 ::encode(next_iter, bl);
746 ENCODE_FINISH(bl);
747 }
748
749 void decode(bufferlist::iterator& bl) {
750 DECODE_START(1, bl);
751 ::decode(usage, bl);
752 ::decode(truncated, bl);
753 ::decode(next_iter, bl);
754 DECODE_FINISH(bl);
755 }
756 };
757 WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_ret)
758
759 struct rgw_cls_usage_log_trim_op {
760 uint64_t start_epoch;
761 uint64_t end_epoch;
762 string user;
763
764 void encode(bufferlist& bl) const {
765 ENCODE_START(2, 2, bl);
766 ::encode(start_epoch, bl);
767 ::encode(end_epoch, bl);
768 ::encode(user, bl);
769 ENCODE_FINISH(bl);
770 }
771
772 void decode(bufferlist::iterator& bl) {
773 DECODE_START(2, bl);
774 ::decode(start_epoch, bl);
775 ::decode(end_epoch, bl);
776 ::decode(user, bl);
777 DECODE_FINISH(bl);
778 }
779 };
780 WRITE_CLASS_ENCODER(rgw_cls_usage_log_trim_op)
781
782 struct cls_rgw_gc_set_entry_op {
783 uint32_t expiration_secs;
784 cls_rgw_gc_obj_info info;
785 cls_rgw_gc_set_entry_op() : expiration_secs(0) {}
786
787 void encode(bufferlist& bl) const {
788 ENCODE_START(1, 1, bl);
789 ::encode(expiration_secs, bl);
790 ::encode(info, bl);
791 ENCODE_FINISH(bl);
792 }
793
794 void decode(bufferlist::iterator& bl) {
795 DECODE_START(1, bl);
796 ::decode(expiration_secs, bl);
797 ::decode(info, bl);
798 DECODE_FINISH(bl);
799 }
800
801 void dump(Formatter *f) const;
802 static void generate_test_instances(list<cls_rgw_gc_set_entry_op*>& ls);
803 };
804 WRITE_CLASS_ENCODER(cls_rgw_gc_set_entry_op)
805
806 struct cls_rgw_gc_defer_entry_op {
807 uint32_t expiration_secs;
808 string tag;
809 cls_rgw_gc_defer_entry_op() : expiration_secs(0) {}
810
811 void encode(bufferlist& bl) const {
812 ENCODE_START(1, 1, bl);
813 ::encode(expiration_secs, bl);
814 ::encode(tag, bl);
815 ENCODE_FINISH(bl);
816 }
817
818 void decode(bufferlist::iterator& bl) {
819 DECODE_START(1, bl);
820 ::decode(expiration_secs, bl);
821 ::decode(tag, bl);
822 DECODE_FINISH(bl);
823 }
824
825 void dump(Formatter *f) const;
826 static void generate_test_instances(list<cls_rgw_gc_defer_entry_op*>& ls);
827 };
828 WRITE_CLASS_ENCODER(cls_rgw_gc_defer_entry_op)
829
830 struct cls_rgw_gc_list_op {
831 string marker;
832 uint32_t max;
833 bool expired_only;
834
835 cls_rgw_gc_list_op() : max(0), expired_only(true) {}
836
837 void encode(bufferlist& bl) const {
838 ENCODE_START(2, 1, bl);
839 ::encode(marker, bl);
840 ::encode(max, bl);
841 ::encode(expired_only, bl);
842 ENCODE_FINISH(bl);
843 }
844
845 void decode(bufferlist::iterator& bl) {
846 DECODE_START(2, bl);
847 ::decode(marker, bl);
848 ::decode(max, bl);
849 if (struct_v >= 2) {
850 ::decode(expired_only, bl);
851 }
852 DECODE_FINISH(bl);
853 }
854
855 void dump(Formatter *f) const;
856 static void generate_test_instances(list<cls_rgw_gc_list_op*>& ls);
857 };
858 WRITE_CLASS_ENCODER(cls_rgw_gc_list_op)
859
860 struct cls_rgw_gc_list_ret {
861 list<cls_rgw_gc_obj_info> entries;
862 string next_marker;
863 bool truncated;
864
865 cls_rgw_gc_list_ret() : truncated(false) {}
866
867 void encode(bufferlist& bl) const {
868 ENCODE_START(2, 1, bl);
869 ::encode(entries, bl);
870 ::encode(next_marker, bl);
871 ::encode(truncated, bl);
872 ENCODE_FINISH(bl);
873 }
874
875 void decode(bufferlist::iterator& bl) {
876 DECODE_START(2, bl);
877 ::decode(entries, bl);
878 if (struct_v >= 2)
879 ::decode(next_marker, bl);
880 ::decode(truncated, bl);
881 DECODE_FINISH(bl);
882 }
883
884 void dump(Formatter *f) const;
885 static void generate_test_instances(list<cls_rgw_gc_list_ret*>& ls);
886 };
887 WRITE_CLASS_ENCODER(cls_rgw_gc_list_ret)
888
889 struct cls_rgw_gc_remove_op {
890 list<string> tags;
891
892 cls_rgw_gc_remove_op() {}
893
894 void encode(bufferlist& bl) const {
895 ENCODE_START(1, 1, bl);
896 ::encode(tags, bl);
897 ENCODE_FINISH(bl);
898 }
899
900 void decode(bufferlist::iterator& bl) {
901 DECODE_START(1, bl);
902 ::decode(tags, bl);
903 DECODE_FINISH(bl);
904 }
905
906 void dump(Formatter *f) const;
907 static void generate_test_instances(list<cls_rgw_gc_remove_op*>& ls);
908 };
909 WRITE_CLASS_ENCODER(cls_rgw_gc_remove_op)
910
911 struct cls_rgw_bi_log_list_op {
912 string marker;
913 uint32_t max;
914
915 cls_rgw_bi_log_list_op() : max(0) {}
916
917 void encode(bufferlist& bl) const {
918 ENCODE_START(1, 1, bl);
919 ::encode(marker, bl);
920 ::encode(max, bl);
921 ENCODE_FINISH(bl);
922 }
923
924 void decode(bufferlist::iterator& bl) {
925 DECODE_START(1, bl);
926 ::decode(marker, bl);
927 ::decode(max, bl);
928 DECODE_FINISH(bl);
929 }
930
931 void dump(Formatter *f) const;
932 static void generate_test_instances(list<cls_rgw_bi_log_list_op*>& ls);
933 };
934 WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_op)
935
936 struct cls_rgw_bi_log_trim_op {
937 string start_marker;
938 string end_marker;
939
940 cls_rgw_bi_log_trim_op() {}
941
942 void encode(bufferlist& bl) const {
943 ENCODE_START(1, 1, bl);
944 ::encode(start_marker, bl);
945 ::encode(end_marker, bl);
946 ENCODE_FINISH(bl);
947 }
948
949 void decode(bufferlist::iterator& bl) {
950 DECODE_START(1, bl);
951 ::decode(start_marker, bl);
952 ::decode(end_marker, bl);
953 DECODE_FINISH(bl);
954 }
955
956 void dump(Formatter *f) const;
957 static void generate_test_instances(list<cls_rgw_bi_log_trim_op*>& ls);
958 };
959 WRITE_CLASS_ENCODER(cls_rgw_bi_log_trim_op)
960
961 struct cls_rgw_bi_log_list_ret {
962 list<rgw_bi_log_entry> entries;
963 bool truncated;
964
965 cls_rgw_bi_log_list_ret() : truncated(false) {}
966
967 void encode(bufferlist& bl) const {
968 ENCODE_START(1, 1, bl);
969 ::encode(entries, bl);
970 ::encode(truncated, bl);
971 ENCODE_FINISH(bl);
972 }
973
974 void decode(bufferlist::iterator& bl) {
975 DECODE_START(1, bl);
976 ::decode(entries, bl);
977 ::decode(truncated, bl);
978 DECODE_FINISH(bl);
979 }
980
981 void dump(Formatter *f) const;
982 static void generate_test_instances(list<cls_rgw_bi_log_list_ret*>& ls);
983 };
984 WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_ret)
985
986 struct cls_rgw_lc_get_next_entry_op {
987 string marker;
988 cls_rgw_lc_get_next_entry_op() {}
989
990 void encode(bufferlist& bl) const {
991 ENCODE_START(1, 1, bl);
992 ::encode(marker, bl);
993 ENCODE_FINISH(bl);
994 }
995
996 void decode(bufferlist::iterator& bl) {
997 DECODE_START(1, bl);
998 ::decode(marker, bl);
999 DECODE_FINISH(bl);
1000 }
1001 };
1002 WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_op)
1003
1004 struct cls_rgw_lc_get_next_entry_ret {
1005 pair<string, int> entry;
1006
1007 cls_rgw_lc_get_next_entry_ret() {}
1008
1009 void encode(bufferlist& bl) const {
1010 ENCODE_START(1, 1, bl);
1011 ::encode(entry, bl);
1012 ENCODE_FINISH(bl);
1013 }
1014
1015 void decode(bufferlist::iterator& bl) {
1016 DECODE_START(1, bl);
1017 ::decode(entry, bl);
1018 DECODE_FINISH(bl);
1019 }
1020
1021 };
1022 WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_ret)
1023
1024 struct cls_rgw_lc_rm_entry_op {
1025 pair<string, int> entry;
1026 cls_rgw_lc_rm_entry_op() {}
1027
1028 void encode(bufferlist& bl) const {
1029 ENCODE_START(1, 1, bl);
1030 ::encode(entry, bl);
1031 ENCODE_FINISH(bl);
1032 }
1033
1034 void decode(bufferlist::iterator& bl) {
1035 DECODE_START(1, bl);
1036 ::decode(entry, bl);
1037 DECODE_FINISH(bl);
1038 }
1039 };
1040 WRITE_CLASS_ENCODER(cls_rgw_lc_rm_entry_op)
1041
1042 struct cls_rgw_lc_set_entry_op {
1043 pair<string, int> entry;
1044 cls_rgw_lc_set_entry_op() {}
1045
1046 void encode(bufferlist& bl) const {
1047 ENCODE_START(1, 1, bl);
1048 ::encode(entry, bl);
1049 ENCODE_FINISH(bl);
1050 }
1051
1052 void decode(bufferlist::iterator& bl) {
1053 DECODE_START(1, bl);
1054 ::decode(entry, bl);
1055 DECODE_FINISH(bl);
1056 }
1057 };
1058 WRITE_CLASS_ENCODER(cls_rgw_lc_set_entry_op)
1059
1060 struct cls_rgw_lc_put_head_op {
1061 cls_rgw_lc_obj_head head;
1062
1063
1064 cls_rgw_lc_put_head_op() {}
1065
1066 void encode(bufferlist& bl) const {
1067 ENCODE_START(1, 1, bl);
1068 ::encode(head, bl);
1069 ENCODE_FINISH(bl);
1070 }
1071
1072 void decode(bufferlist::iterator& bl) {
1073 DECODE_START(1, bl);
1074 ::decode(head, bl);
1075 DECODE_FINISH(bl);
1076 }
1077
1078 };
1079 WRITE_CLASS_ENCODER(cls_rgw_lc_put_head_op)
1080
1081 struct cls_rgw_lc_get_head_ret {
1082 cls_rgw_lc_obj_head head;
1083
1084 cls_rgw_lc_get_head_ret() {}
1085
1086 void encode(bufferlist& bl) const {
1087 ENCODE_START(1, 1, bl);
1088 ::encode(head, bl);
1089 ENCODE_FINISH(bl);
1090 }
1091
1092 void decode(bufferlist::iterator& bl) {
1093 DECODE_START(1, bl);
1094 ::decode(head, bl);
1095 DECODE_FINISH(bl);
1096 }
1097
1098 };
1099 WRITE_CLASS_ENCODER(cls_rgw_lc_get_head_ret)
1100
1101 struct cls_rgw_lc_list_entries_op {
1102 string marker;
1103 uint32_t max_entries;
1104
1105 cls_rgw_lc_list_entries_op() {}
1106
1107 void encode(bufferlist& bl) const {
1108 ENCODE_START(1, 1, bl);
1109 ::encode(marker, bl);
1110 ::encode(max_entries, bl);
1111 ENCODE_FINISH(bl);
1112 }
1113
1114 void decode(bufferlist::iterator& bl) {
1115 DECODE_START(1, bl);
1116 ::decode(marker, bl);
1117 ::decode(max_entries, bl);
1118 DECODE_FINISH(bl);
1119 }
1120
1121 };
1122 WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_op)
1123
1124 struct cls_rgw_lc_list_entries_ret {
1125 map<string, int> entries;
1126 bool is_truncated{false};
1127
1128 cls_rgw_lc_list_entries_ret() {}
1129
1130 void encode(bufferlist& bl) const {
1131 ENCODE_START(2, 1, bl);
1132 ::encode(entries, bl);
1133 ::encode(is_truncated, bl);
1134 ENCODE_FINISH(bl);
1135 }
1136
1137 void decode(bufferlist::iterator& bl) {
1138 DECODE_START(2, bl);
1139 ::decode(entries, bl);
1140 if (struct_v >= 2) {
1141 ::decode(is_truncated, bl);
1142 }
1143 DECODE_FINISH(bl);
1144 }
1145
1146 };
1147 WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_ret)
1148
1149 struct cls_rgw_reshard_add_op {
1150 cls_rgw_reshard_entry entry;
1151
1152 cls_rgw_reshard_add_op() {}
1153
1154 void encode(bufferlist& bl) const {
1155 ENCODE_START(1, 1, bl);
1156 ::encode(entry, bl);
1157 ENCODE_FINISH(bl);
1158 }
1159
1160 void decode(bufferlist::iterator& bl) {
1161 DECODE_START(1, bl);
1162 ::decode(entry, bl);
1163 DECODE_FINISH(bl);
1164 }
1165 static void generate_test_instances(list<cls_rgw_reshard_add_op*>& o);
1166 void dump(Formatter *f) const;
1167 };
1168 WRITE_CLASS_ENCODER(cls_rgw_reshard_add_op)
1169
1170 struct cls_rgw_reshard_list_op {
1171 uint32_t max{0};
1172 string marker;
1173
1174 cls_rgw_reshard_list_op() {}
1175
1176 void encode(bufferlist& bl) const {
1177 ENCODE_START(1, 1, bl);
1178 ::encode(max, bl);
1179 ::encode(marker, bl);
1180 ENCODE_FINISH(bl);
1181 }
1182
1183 void decode(bufferlist::iterator& bl) {
1184 DECODE_START(1, bl);
1185 ::decode(max, bl);
1186 ::decode(marker, bl);
1187 DECODE_FINISH(bl);
1188 }
1189 static void generate_test_instances(list<cls_rgw_reshard_list_op*>& o);
1190 void dump(Formatter *f) const;
1191 };
1192 WRITE_CLASS_ENCODER(cls_rgw_reshard_list_op)
1193
1194
1195 struct cls_rgw_reshard_list_ret {
1196 list<cls_rgw_reshard_entry> entries;
1197 bool is_truncated{false};
1198
1199 cls_rgw_reshard_list_ret() {}
1200
1201 void encode(bufferlist& bl) const {
1202 ENCODE_START(1, 1, bl);
1203 ::encode(entries, bl);
1204 ::encode(is_truncated, bl);
1205 ENCODE_FINISH(bl);
1206 }
1207
1208 void decode(bufferlist::iterator& bl) {
1209 DECODE_START(1, bl);
1210 ::decode(entries, bl);
1211 ::decode(is_truncated, bl);
1212 DECODE_FINISH(bl);
1213 }
1214 static void generate_test_instances(list<cls_rgw_reshard_list_ret*>& o);
1215 void dump(Formatter *f) const;
1216 };
1217 WRITE_CLASS_ENCODER(cls_rgw_reshard_list_ret)
1218
1219 struct cls_rgw_reshard_get_op {
1220 cls_rgw_reshard_entry entry;
1221
1222 cls_rgw_reshard_get_op() {}
1223
1224 void encode(bufferlist& bl) const {
1225 ENCODE_START(1, 1, bl);
1226 ::encode(entry, bl);
1227 ENCODE_FINISH(bl);
1228 }
1229
1230 void decode(bufferlist::iterator& bl) {
1231 DECODE_START(1, bl);
1232 ::decode(entry, bl);
1233 DECODE_FINISH(bl);
1234 }
1235 static void generate_test_instances(list<cls_rgw_reshard_get_op*>& o);
1236 void dump(Formatter *f) const;
1237 };
1238 WRITE_CLASS_ENCODER(cls_rgw_reshard_get_op)
1239
1240 struct cls_rgw_reshard_get_ret {
1241 cls_rgw_reshard_entry entry;
1242
1243 cls_rgw_reshard_get_ret() {}
1244
1245 void encode(bufferlist& bl) const {
1246 ENCODE_START(1, 1, bl);
1247 ::encode(entry, bl);
1248 ENCODE_FINISH(bl);
1249 }
1250
1251 void decode(bufferlist::iterator& bl) {
1252 DECODE_START(1, bl);
1253 ::decode(entry, bl);
1254 DECODE_FINISH(bl);
1255 }
1256 static void generate_test_instances(list<cls_rgw_reshard_get_ret*>& o);
1257 void dump(Formatter *f) const;
1258 };
1259 WRITE_CLASS_ENCODER(cls_rgw_reshard_get_ret)
1260
1261 struct cls_rgw_reshard_remove_op {
1262 string tenant;
1263 string bucket_name;
1264 string bucket_id;
1265
1266 cls_rgw_reshard_remove_op() {}
1267
1268 void encode(bufferlist& bl) const {
1269 ENCODE_START(1, 1, bl);
1270 ::encode(tenant, bl);
1271 ::encode(bucket_name, bl);
1272 ::encode(bucket_id, bl);
1273 ENCODE_FINISH(bl);
1274 }
1275
1276 void decode(bufferlist::iterator& bl) {
1277 DECODE_START(1, bl);
1278 ::decode(tenant, bl);
1279 ::decode(bucket_name, bl);
1280 ::decode(bucket_id, bl);
1281 DECODE_FINISH(bl);
1282 }
1283 static void generate_test_instances(list<cls_rgw_reshard_remove_op*>& o);
1284 void dump(Formatter *f) const;
1285 };
1286 WRITE_CLASS_ENCODER(cls_rgw_reshard_remove_op)
1287
1288 struct cls_rgw_set_bucket_resharding_op {
1289 cls_rgw_bucket_instance_entry entry;
1290
1291 void encode(bufferlist& bl) const {
1292 ENCODE_START(1, 1, bl);
1293 ::encode(entry, bl);
1294 ENCODE_FINISH(bl);
1295 }
1296
1297 void decode(bufferlist::iterator& bl) {
1298 DECODE_START(1, bl);
1299 ::decode(entry, bl);
1300 DECODE_FINISH(bl);
1301 }
1302 static void generate_test_instances(list<cls_rgw_set_bucket_resharding_op*>& o);
1303 void dump(Formatter *f) const;
1304 };
1305 WRITE_CLASS_ENCODER(cls_rgw_set_bucket_resharding_op)
1306
1307 struct cls_rgw_clear_bucket_resharding_op {
1308 void encode(bufferlist& bl) const {
1309 ENCODE_START(1, 1, bl);
1310 ENCODE_FINISH(bl);
1311 }
1312
1313 void decode(bufferlist::iterator& bl) {
1314 DECODE_START(1, bl);
1315 DECODE_FINISH(bl);
1316 }
1317 static void generate_test_instances(list<cls_rgw_clear_bucket_resharding_op*>& o);
1318 void dump(Formatter *f) const;
1319 };
1320 WRITE_CLASS_ENCODER(cls_rgw_clear_bucket_resharding_op)
1321
1322 struct cls_rgw_guard_bucket_resharding_op {
1323 int ret_err{0};
1324
1325 void encode(bufferlist& bl) const {
1326 ENCODE_START(1, 1, bl);
1327 ::encode(ret_err, bl);
1328 ENCODE_FINISH(bl);
1329 }
1330
1331 void decode(bufferlist::iterator& bl) {
1332 DECODE_START(1, bl);
1333 ::decode(ret_err, bl);
1334 DECODE_FINISH(bl);
1335 }
1336
1337 static void generate_test_instances(list<cls_rgw_guard_bucket_resharding_op*>& o);
1338 void dump(Formatter *f) const;
1339 };
1340 WRITE_CLASS_ENCODER(cls_rgw_guard_bucket_resharding_op)
1341
1342 struct cls_rgw_get_bucket_resharding_op {
1343
1344 void encode(bufferlist& bl) const {
1345 ENCODE_START(1, 1, bl);
1346 ENCODE_FINISH(bl);
1347 }
1348
1349 void decode(bufferlist::iterator& bl) {
1350 DECODE_START(1, bl);
1351 DECODE_FINISH(bl);
1352 }
1353
1354 static void generate_test_instances(list<cls_rgw_get_bucket_resharding_op*>& o);
1355 void dump(Formatter *f) const;
1356 };
1357 WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_op)
1358
1359 struct cls_rgw_get_bucket_resharding_ret {
1360 cls_rgw_bucket_instance_entry new_instance;
1361
1362 void encode(bufferlist& bl) const {
1363 ENCODE_START(1, 1, bl);
1364 ::encode(new_instance, bl);
1365 ENCODE_FINISH(bl);
1366 }
1367
1368 void decode(bufferlist::iterator& bl) {
1369 DECODE_START(1, bl);
1370 ::decode(new_instance, bl);
1371 DECODE_FINISH(bl);
1372 }
1373
1374 static void generate_test_instances(list<cls_rgw_get_bucket_resharding_ret*>& o);
1375 void dump(Formatter *f) const;
1376 };
1377 WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_ret)
1378
1379 #endif /* CEPH_CLS_RGW_OPS_H */