1 #ifndef CEPH_CLS_RGW_TYPES_H
2 #define CEPH_CLS_RGW_TYPES_H
4 #include "common/ceph_time.h"
5 #include "common/Formatter.h"
7 #include "rgw/rgw_basic_types.h"
9 #define CEPH_RGW_REMOVE 'r'
10 #define CEPH_RGW_UPDATE 'u'
11 #define CEPH_RGW_TAG_TIMEOUT 120
12 #define CEPH_RGW_DIR_SUGGEST_LOG_OP 0x80
13 #define CEPH_RGW_DIR_SUGGEST_OP_MASK 0x7f
21 using rgw_zone_set
= std::set
<std::string
>;
23 enum RGWPendingState
{
24 CLS_RGW_STATE_PENDING_MODIFY
= 0,
25 CLS_RGW_STATE_COMPLETE
= 1,
26 CLS_RGW_STATE_UNKNOWN
= 2,
32 CLS_RGW_OP_CANCEL
= 2,
33 CLS_RGW_OP_UNKNOWN
= 3,
34 CLS_RGW_OP_LINK_OLH
= 4,
35 CLS_RGW_OP_LINK_OLH_DM
= 5, /* creation of delete marker */
36 CLS_RGW_OP_UNLINK_INSTANCE
= 6,
40 RGW_BILOG_FLAG_VERSIONED_OP
= 0x1,
43 enum RGWCheckMTimeType
{
44 CLS_RGW_CHECK_TIME_MTIME_EQ
= 0,
45 CLS_RGW_CHECK_TIME_MTIME_LT
= 1,
46 CLS_RGW_CHECK_TIME_MTIME_LE
= 2,
47 CLS_RGW_CHECK_TIME_MTIME_GT
= 3,
48 CLS_RGW_CHECK_TIME_MTIME_GE
= 4,
51 #define ROUND_BLOCK_SIZE 4096
53 static inline uint64_t cls_rgw_get_rounded_size(uint64_t size
)
55 return (size
+ ROUND_BLOCK_SIZE
- 1) & ~(ROUND_BLOCK_SIZE
- 1);
58 struct rgw_bucket_pending_info
{
59 RGWPendingState state
;
60 ceph::real_time timestamp
;
63 rgw_bucket_pending_info() : state(CLS_RGW_STATE_PENDING_MODIFY
), op(0) {}
65 void encode(bufferlist
&bl
) const {
66 ENCODE_START(2, 2, bl
);
67 uint8_t s
= (uint8_t)state
;
69 ::encode(timestamp
, bl
);
73 void decode(bufferlist::iterator
&bl
) {
74 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
77 state
= (RGWPendingState
)s
;
78 ::decode(timestamp
, bl
);
82 void dump(Formatter
*f
) const;
83 void decode_json(JSONObj
*obj
);
84 static void generate_test_instances(list
<rgw_bucket_pending_info
*>& o
);
86 WRITE_CLASS_ENCODER(rgw_bucket_pending_info
)
88 struct rgw_bucket_dir_entry_meta
{
91 ceph::real_time mtime
;
94 string owner_display_name
;
96 uint64_t accounted_size
;
99 rgw_bucket_dir_entry_meta() :
100 category(0), size(0), accounted_size(0) { }
102 void encode(bufferlist
&bl
) const {
103 ENCODE_START(5, 3, bl
);
104 ::encode(category
, bl
);
109 ::encode(owner_display_name
, bl
);
110 ::encode(content_type
, bl
);
111 ::encode(accounted_size
, bl
);
112 ::encode(user_data
, bl
);
115 void decode(bufferlist::iterator
&bl
) {
116 DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl
);
117 ::decode(category
, bl
);
122 ::decode(owner_display_name
, bl
);
124 ::decode(content_type
, bl
);
126 ::decode(accounted_size
, bl
);
128 accounted_size
= size
;
130 ::decode(user_data
, bl
);
133 void dump(Formatter
*f
) const;
134 void decode_json(JSONObj
*obj
);
135 static void generate_test_instances(list
<rgw_bucket_dir_entry_meta
*>& o
);
137 WRITE_CLASS_ENCODER(rgw_bucket_dir_entry_meta
)
140 void encode_packed_val(T val
, bufferlist
& bl
)
142 if ((uint64_t)val
< 0x80) {
143 ::encode((uint8_t)val
, bl
);
145 unsigned char c
= 0x80;
147 if ((uint64_t)val
< 0x100) {
150 ::encode((uint8_t)val
, bl
);
151 } else if ((uint64_t)val
<= 0x10000) {
154 ::encode((uint16_t)val
, bl
);
155 } else if ((uint64_t)val
<= 0x1000000) {
158 ::encode((uint32_t)val
, bl
);
162 ::encode((uint64_t)val
, bl
);
168 void decode_packed_val(T
& val
, bufferlist::iterator
& bl
)
209 throw buffer::error();
213 struct rgw_bucket_entry_ver
{
217 rgw_bucket_entry_ver() : pool(-1), epoch(0) {}
219 void encode(bufferlist
&bl
) const {
220 ENCODE_START(1, 1, bl
);
221 ::encode_packed_val(pool
, bl
);
222 ::encode_packed_val(epoch
, bl
);
225 void decode(bufferlist::iterator
&bl
) {
227 ::decode_packed_val(pool
, bl
);
228 ::decode_packed_val(epoch
, bl
);
231 void dump(Formatter
*f
) const;
232 void decode_json(JSONObj
*obj
);
233 static void generate_test_instances(list
<rgw_bucket_entry_ver
*>& o
);
235 WRITE_CLASS_ENCODER(rgw_bucket_entry_ver
)
237 struct cls_rgw_obj_key
{
242 cls_rgw_obj_key(const string
&_name
) : name(_name
) {}
243 cls_rgw_obj_key(const string
& n
, const string
& i
) : name(n
), instance(i
) {}
245 void set(const string
& _name
) {
249 bool operator==(const cls_rgw_obj_key
& k
) const {
250 return (name
.compare(k
.name
) == 0) &&
251 (instance
.compare(k
.instance
) == 0);
253 bool operator<(const cls_rgw_obj_key
& k
) const {
254 int r
= name
.compare(k
.name
);
256 r
= instance
.compare(k
.instance
);
260 bool operator<=(const cls_rgw_obj_key
& k
) const {
266 void encode(bufferlist
&bl
) const {
267 ENCODE_START(1, 1, bl
);
269 ::encode(instance
, bl
);
272 void decode(bufferlist::iterator
&bl
) {
275 ::decode(instance
, bl
);
278 void dump(Formatter
*f
) const {
279 f
->dump_string("name", name
);
280 f
->dump_string("instance", instance
);
282 void decode_json(JSONObj
*obj
);
283 static void generate_test_instances(list
<cls_rgw_obj_key
*>& ls
) {
284 ls
.push_back(new cls_rgw_obj_key
);
285 ls
.push_back(new cls_rgw_obj_key
);
286 ls
.back()->name
= "name";
287 ls
.back()->instance
= "instance";
290 WRITE_CLASS_ENCODER(cls_rgw_obj_key
)
293 #define RGW_BUCKET_DIRENT_FLAG_VER 0x1 /* a versioned object instance */
294 #define RGW_BUCKET_DIRENT_FLAG_CURRENT 0x2 /* the last object instance of a versioned object */
295 #define RGW_BUCKET_DIRENT_FLAG_DELETE_MARKER 0x4 /* delete marker */
296 #define RGW_BUCKET_DIRENT_FLAG_VER_MARKER 0x8 /* object is versioned, a placeholder for the plain entry */
298 struct rgw_bucket_dir_entry
{
300 rgw_bucket_entry_ver ver
;
303 struct rgw_bucket_dir_entry_meta meta
;
304 multimap
<string
, struct rgw_bucket_pending_info
> pending_map
;
308 uint64_t versioned_epoch
;
310 rgw_bucket_dir_entry() :
311 exists(false), index_ver(0), flags(0), versioned_epoch(0) {}
313 void encode(bufferlist
&bl
) const {
314 ENCODE_START(8, 3, bl
);
315 ::encode(key
.name
, bl
);
316 ::encode(ver
.epoch
, bl
);
317 ::encode(exists
, bl
);
319 ::encode(pending_map
, bl
);
320 ::encode(locator
, bl
);
322 ::encode_packed_val(index_ver
, bl
);
324 ::encode(key
.instance
, bl
);
326 ::encode(versioned_epoch
, bl
);
329 void decode(bufferlist::iterator
&bl
) {
330 DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl
);
331 ::decode(key
.name
, bl
);
332 ::decode(ver
.epoch
, bl
);
333 ::decode(exists
, bl
);
335 ::decode(pending_map
, bl
);
337 ::decode(locator
, bl
);
345 ::decode_packed_val(index_ver
, bl
);
349 ::decode(key
.instance
, bl
);
355 ::decode(versioned_epoch
, bl
);
361 int test_flags
= RGW_BUCKET_DIRENT_FLAG_VER
| RGW_BUCKET_DIRENT_FLAG_CURRENT
;
362 return (flags
& RGW_BUCKET_DIRENT_FLAG_VER
) == 0 ||
363 (flags
& test_flags
) == test_flags
;
365 bool is_delete_marker() { return (flags
& RGW_BUCKET_DIRENT_FLAG_DELETE_MARKER
) != 0; }
367 return is_current() && !is_delete_marker();
369 bool is_valid() { return (flags
& RGW_BUCKET_DIRENT_FLAG_VER_MARKER
) == 0; }
371 void dump(Formatter
*f
) const;
372 void decode_json(JSONObj
*obj
);
373 static void generate_test_instances(list
<rgw_bucket_dir_entry
*>& o
);
375 WRITE_CLASS_ENCODER(rgw_bucket_dir_entry
)
384 struct rgw_bucket_category_stats
;
386 struct rgw_cls_bi_entry
{
391 rgw_cls_bi_entry() : type(InvalidIdx
) {}
393 void encode(bufferlist
& bl
) const {
394 ENCODE_START(1, 1, bl
);
395 ::encode((uint8_t)type
, bl
);
401 void decode(bufferlist::iterator
& bl
) {
405 type
= (BIIndexType
)c
;
411 void dump(Formatter
*f
) const;
412 void decode_json(JSONObj
*obj
, cls_rgw_obj_key
*effective_key
= NULL
);
414 bool get_info(cls_rgw_obj_key
*key
, uint8_t *category
, rgw_bucket_category_stats
*accounted_stats
);
416 WRITE_CLASS_ENCODER(rgw_cls_bi_entry
)
419 CLS_RGW_OLH_OP_UNKNOWN
= 0,
420 CLS_RGW_OLH_OP_LINK_OLH
= 1,
421 CLS_RGW_OLH_OP_UNLINK_OLH
= 2, /* object does not exist */
422 CLS_RGW_OLH_OP_REMOVE_INSTANCE
= 3,
425 struct rgw_bucket_olh_log_entry
{
432 rgw_bucket_olh_log_entry() : epoch(0), op(CLS_RGW_OLH_OP_UNKNOWN
), delete_marker(false) {}
435 void encode(bufferlist
&bl
) const {
436 ENCODE_START(1, 1, bl
);
438 ::encode((__u8
)op
, bl
);
439 ::encode(op_tag
, bl
);
441 ::encode(delete_marker
, bl
);
444 void decode(bufferlist::iterator
&bl
) {
450 ::decode(op_tag
, bl
);
452 ::decode(delete_marker
, bl
);
455 static void generate_test_instances(list
<rgw_bucket_olh_log_entry
*>& o
);
456 void dump(Formatter
*f
) const;
457 void decode_json(JSONObj
*obj
);
459 WRITE_CLASS_ENCODER(rgw_bucket_olh_log_entry
)
461 struct rgw_bucket_olh_entry
{
465 map
<uint64_t, vector
<struct rgw_bucket_olh_log_entry
> > pending_log
;
468 bool pending_removal
;
470 rgw_bucket_olh_entry() : delete_marker(false), epoch(0), exists(false), pending_removal(false) {}
472 void encode(bufferlist
&bl
) const {
473 ENCODE_START(1, 1, bl
);
475 ::encode(delete_marker
, bl
);
477 ::encode(pending_log
, bl
);
479 ::encode(exists
, bl
);
480 ::encode(pending_removal
, bl
);
483 void decode(bufferlist::iterator
&bl
) {
486 ::decode(delete_marker
, bl
);
488 ::decode(pending_log
, bl
);
490 ::decode(exists
, bl
);
491 ::decode(pending_removal
, bl
);
494 void dump(Formatter
*f
) const;
495 void decode_json(JSONObj
*obj
);
497 WRITE_CLASS_ENCODER(rgw_bucket_olh_entry
)
499 struct rgw_bi_log_entry
{
503 ceph::real_time timestamp
;
504 rgw_bucket_entry_ver ver
;
506 RGWPendingState state
;
509 uint16_t bilog_flags
;
510 string owner
; /* only being set if it's a delete marker */
511 string owner_display_name
; /* only being set if it's a delete marker */
512 rgw_zone_set zones_trace
;
514 rgw_bi_log_entry() : op(CLS_RGW_OP_UNKNOWN
), state(CLS_RGW_STATE_PENDING_MODIFY
), index_ver(0), bilog_flags(0) {}
516 void encode(bufferlist
&bl
) const {
517 ENCODE_START(4, 1, bl
);
519 ::encode(object
, bl
);
520 ::encode(timestamp
, bl
);
523 uint8_t c
= (uint8_t)op
;
527 encode_packed_val(index_ver
, bl
);
528 ::encode(instance
, bl
);
529 ::encode(bilog_flags
, bl
);
531 ::encode(owner_display_name
, bl
);
532 ::encode(zones_trace
, bl
);
535 void decode(bufferlist::iterator
&bl
) {
538 ::decode(object
, bl
);
539 ::decode(timestamp
, bl
);
546 state
= (RGWPendingState
)c
;
547 decode_packed_val(index_ver
, bl
);
549 ::decode(instance
, bl
);
550 ::decode(bilog_flags
, bl
);
554 ::decode(owner_display_name
, bl
);
557 ::decode(zones_trace
, bl
);
561 void dump(Formatter
*f
) const;
562 void decode_json(JSONObj
*obj
);
563 static void generate_test_instances(list
<rgw_bi_log_entry
*>& o
);
565 bool is_versioned() {
566 return ((bilog_flags
& RGW_BILOG_FLAG_VERSIONED_OP
) != 0);
569 WRITE_CLASS_ENCODER(rgw_bi_log_entry
)
571 struct rgw_bucket_category_stats
{
573 uint64_t total_size_rounded
;
574 uint64_t num_entries
;
575 uint64_t actual_size
{0}; //< account for compression, encryption
577 rgw_bucket_category_stats() : total_size(0), total_size_rounded(0), num_entries(0) {}
579 void encode(bufferlist
&bl
) const {
580 ENCODE_START(3, 2, bl
);
581 ::encode(total_size
, bl
);
582 ::encode(total_size_rounded
, bl
);
583 ::encode(num_entries
, bl
);
584 ::encode(actual_size
, bl
);
587 void decode(bufferlist::iterator
&bl
) {
588 DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl
);
589 ::decode(total_size
, bl
);
590 ::decode(total_size_rounded
, bl
);
591 ::decode(num_entries
, bl
);
593 ::decode(actual_size
, bl
);
595 actual_size
= total_size
;
599 void dump(Formatter
*f
) const;
600 static void generate_test_instances(list
<rgw_bucket_category_stats
*>& o
);
602 WRITE_CLASS_ENCODER(rgw_bucket_category_stats
)
604 enum cls_rgw_reshard_status
{
605 CLS_RGW_RESHARD_NONE
= 0,
606 CLS_RGW_RESHARD_IN_PROGRESS
= 1,
607 CLS_RGW_RESHARD_DONE
= 2,
610 struct cls_rgw_bucket_instance_entry
{
611 cls_rgw_reshard_status reshard_status
{CLS_RGW_RESHARD_NONE
};
612 string new_bucket_instance_id
;
613 int32_t num_shards
{-1};
615 void encode(bufferlist
& bl
) const {
616 ENCODE_START(1, 1, bl
);
617 ::encode((uint8_t)reshard_status
, bl
);
618 ::encode(new_bucket_instance_id
, bl
);
619 ::encode(num_shards
, bl
);
623 void decode(bufferlist::iterator
& bl
) {
627 reshard_status
= (cls_rgw_reshard_status
)s
;
628 ::decode(new_bucket_instance_id
, bl
);
629 ::decode(num_shards
, bl
);
633 void dump(Formatter
*f
) const;
634 static void generate_test_instances(list
<cls_rgw_bucket_instance_entry
*>& o
);
637 reshard_status
= CLS_RGW_RESHARD_NONE
;
638 new_bucket_instance_id
.clear();
641 void set_status(const string
& new_instance_id
, int32_t new_num_shards
, cls_rgw_reshard_status s
) {
643 new_bucket_instance_id
= new_instance_id
;
644 num_shards
= new_num_shards
;
647 bool resharding() const {
648 return reshard_status
!= CLS_RGW_RESHARD_NONE
;
650 bool resharding_in_progress() const {
651 return reshard_status
== CLS_RGW_RESHARD_IN_PROGRESS
;
654 WRITE_CLASS_ENCODER(cls_rgw_bucket_instance_entry
)
656 struct rgw_bucket_dir_header
{
657 map
<uint8_t, rgw_bucket_category_stats
> stats
;
658 uint64_t tag_timeout
;
662 cls_rgw_bucket_instance_entry new_instance
;
664 rgw_bucket_dir_header() : tag_timeout(0), ver(0), master_ver(0) {}
666 void encode(bufferlist
&bl
) const {
667 ENCODE_START(6, 2, bl
);
669 ::encode(tag_timeout
, bl
);
671 ::encode(master_ver
, bl
);
672 ::encode(max_marker
, bl
);
673 ::encode(new_instance
, bl
);
676 void decode(bufferlist::iterator
&bl
) {
677 DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, bl
);
680 ::decode(tag_timeout
, bl
);
686 ::decode(master_ver
, bl
);
691 ::decode(max_marker
, bl
);
694 ::decode(new_instance
, bl
);
696 new_instance
= cls_rgw_bucket_instance_entry();
700 void dump(Formatter
*f
) const;
701 static void generate_test_instances(list
<rgw_bucket_dir_header
*>& o
);
703 bool resharding() const {
704 return new_instance
.resharding();
706 bool resharding_in_progress() const {
707 return new_instance
.resharding_in_progress();
710 WRITE_CLASS_ENCODER(rgw_bucket_dir_header
)
712 struct rgw_bucket_dir
{
713 struct rgw_bucket_dir_header header
;
714 std::map
<string
, struct rgw_bucket_dir_entry
> m
;
716 void encode(bufferlist
&bl
) const {
717 ENCODE_START(2, 2, bl
);
718 ::encode(header
, bl
);
722 void decode(bufferlist::iterator
&bl
) {
723 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
724 ::decode(header
, bl
);
728 void dump(Formatter
*f
) const;
729 static void generate_test_instances(list
<rgw_bucket_dir
*>& o
);
731 WRITE_CLASS_ENCODER(rgw_bucket_dir
)
733 struct rgw_usage_data
{
735 uint64_t bytes_received
;
737 uint64_t successful_ops
;
739 rgw_usage_data() : bytes_sent(0), bytes_received(0), ops(0), successful_ops(0) {}
740 rgw_usage_data(uint64_t sent
, uint64_t received
) : bytes_sent(sent
), bytes_received(received
), ops(0), successful_ops(0) {}
742 void encode(bufferlist
& bl
) const {
743 ENCODE_START(1, 1, bl
);
744 ::encode(bytes_sent
, bl
);
745 ::encode(bytes_received
, bl
);
747 ::encode(successful_ops
, bl
);
751 void decode(bufferlist::iterator
& bl
) {
753 ::decode(bytes_sent
, bl
);
754 ::decode(bytes_received
, bl
);
756 ::decode(successful_ops
, bl
);
760 void aggregate(const rgw_usage_data
& usage
) {
761 bytes_sent
+= usage
.bytes_sent
;
762 bytes_received
+= usage
.bytes_received
;
764 successful_ops
+= usage
.successful_ops
;
767 WRITE_CLASS_ENCODER(rgw_usage_data
)
770 struct rgw_usage_log_entry
{
772 rgw_user payer
; /* if empty, same as owner */
775 rgw_usage_data total_usage
; /* this one is kept for backwards compatibility */
776 map
<string
, rgw_usage_data
> usage_map
;
778 rgw_usage_log_entry() : epoch(0) {}
779 rgw_usage_log_entry(string
& o
, string
& b
) : owner(o
), bucket(b
), epoch(0) {}
780 rgw_usage_log_entry(string
& o
, string
& p
, string
& b
) : owner(o
), payer(p
), bucket(b
), epoch(0) {}
782 void encode(bufferlist
& bl
) const {
783 ENCODE_START(3, 1, bl
);
784 ::encode(owner
.to_str(), bl
);
785 ::encode(bucket
, bl
);
787 ::encode(total_usage
.bytes_sent
, bl
);
788 ::encode(total_usage
.bytes_received
, bl
);
789 ::encode(total_usage
.ops
, bl
);
790 ::encode(total_usage
.successful_ops
, bl
);
791 ::encode(usage_map
, bl
);
792 ::encode(payer
.to_str(), bl
);
797 void decode(bufferlist::iterator
& bl
) {
802 ::decode(bucket
, bl
);
804 ::decode(total_usage
.bytes_sent
, bl
);
805 ::decode(total_usage
.bytes_received
, bl
);
806 ::decode(total_usage
.ops
, bl
);
807 ::decode(total_usage
.successful_ops
, bl
);
809 usage_map
[""] = total_usage
;
811 ::decode(usage_map
, bl
);
821 void aggregate(const rgw_usage_log_entry
& e
, map
<string
, bool> *categories
= NULL
) {
829 map
<string
, rgw_usage_data
>::const_iterator iter
;
830 for (iter
= e
.usage_map
.begin(); iter
!= e
.usage_map
.end(); ++iter
) {
831 if (!categories
|| !categories
->size() || categories
->count(iter
->first
)) {
832 add(iter
->first
, iter
->second
);
837 void sum(rgw_usage_data
& usage
, map
<string
, bool>& categories
) const {
838 usage
= rgw_usage_data();
839 for (map
<string
, rgw_usage_data
>::const_iterator iter
= usage_map
.begin(); iter
!= usage_map
.end(); ++iter
) {
840 if (!categories
.size() || categories
.count(iter
->first
)) {
841 usage
.aggregate(iter
->second
);
846 void add(const string
& category
, const rgw_usage_data
& data
) {
847 usage_map
[category
].aggregate(data
);
848 total_usage
.aggregate(data
);
851 WRITE_CLASS_ENCODER(rgw_usage_log_entry
)
853 struct rgw_usage_log_info
{
854 vector
<rgw_usage_log_entry
> entries
;
856 void encode(bufferlist
& bl
) const {
857 ENCODE_START(1, 1, bl
);
858 ::encode(entries
, bl
);
862 void decode(bufferlist::iterator
& bl
) {
864 ::decode(entries
, bl
);
868 rgw_usage_log_info() {}
870 WRITE_CLASS_ENCODER(rgw_usage_log_info
)
872 struct rgw_user_bucket
{
877 rgw_user_bucket(const string
& u
, const string
& b
) : user(u
), bucket(b
) {}
879 void encode(bufferlist
& bl
) const {
880 ENCODE_START(1, 1, bl
);
882 ::encode(bucket
, bl
);
886 void decode(bufferlist::iterator
& bl
) {
889 ::decode(bucket
, bl
);
893 bool operator<(const rgw_user_bucket
& ub2
) const {
894 int comp
= user
.compare(ub2
.user
);
898 return bucket
.compare(ub2
.bucket
) < 0;
903 WRITE_CLASS_ENCODER(rgw_user_bucket
)
907 CLS_RGW_GC_DEL_BUCKET
,
916 cls_rgw_obj(string
& _p
, cls_rgw_obj_key
& _k
) : pool(_p
), key(_k
) {}
918 void encode(bufferlist
& bl
) const {
919 ENCODE_START(2, 1, bl
);
921 ::encode(key
.name
, bl
);
927 void decode(bufferlist::iterator
& bl
) {
930 ::decode(key
.name
, bl
);
938 void dump(Formatter
*f
) const {
939 f
->dump_string("pool", pool
);
940 f
->dump_string("oid", key
.name
);
941 f
->dump_string("key", loc
);
942 f
->dump_string("instance", key
.instance
);
944 static void generate_test_instances(list
<cls_rgw_obj
*>& ls
) {
945 ls
.push_back(new cls_rgw_obj
);
946 ls
.push_back(new cls_rgw_obj
);
947 ls
.back()->pool
= "mypool";
948 ls
.back()->key
.name
= "myoid";
949 ls
.back()->loc
= "mykey";
952 WRITE_CLASS_ENCODER(cls_rgw_obj
)
954 struct cls_rgw_obj_chain
{
955 list
<cls_rgw_obj
> objs
;
957 cls_rgw_obj_chain() {}
959 void push_obj(const string
& pool
, const cls_rgw_obj_key
& key
, const string
& loc
) {
967 void encode(bufferlist
& bl
) const {
968 ENCODE_START(1, 1, bl
);
973 void decode(bufferlist::iterator
& bl
) {
979 void dump(Formatter
*f
) const {
980 f
->open_array_section("objs");
981 for (list
<cls_rgw_obj
>::const_iterator p
= objs
.begin(); p
!= objs
.end(); ++p
) {
982 f
->open_object_section("obj");
988 static void generate_test_instances(list
<cls_rgw_obj_chain
*>& ls
) {
989 ls
.push_back(new cls_rgw_obj_chain
);
996 WRITE_CLASS_ENCODER(cls_rgw_obj_chain
)
998 struct cls_rgw_gc_obj_info
1001 cls_rgw_obj_chain chain
;
1002 ceph::real_time time
;
1004 cls_rgw_gc_obj_info() {}
1006 void encode(bufferlist
& bl
) const {
1007 ENCODE_START(1, 1, bl
);
1009 ::encode(chain
, bl
);
1014 void decode(bufferlist::iterator
& bl
) {
1015 DECODE_START(1, bl
);
1017 ::decode(chain
, bl
);
1022 void dump(Formatter
*f
) const {
1023 f
->dump_string("tag", tag
);
1024 f
->open_object_section("chain");
1027 f
->dump_stream("time") << time
;
1029 static void generate_test_instances(list
<cls_rgw_gc_obj_info
*>& ls
) {
1030 ls
.push_back(new cls_rgw_gc_obj_info
);
1031 ls
.push_back(new cls_rgw_gc_obj_info
);
1032 ls
.back()->tag
= "footag";
1033 ceph_timespec ts
{21, 32};
1034 ls
.back()->time
= ceph::real_clock::from_ceph_timespec(ts
);
1037 WRITE_CLASS_ENCODER(cls_rgw_gc_obj_info
)
1039 struct cls_rgw_lc_obj_head
1044 cls_rgw_lc_obj_head() {}
1046 void encode(bufferlist
& bl
) const {
1047 ENCODE_START(1, 1, bl
);
1048 uint64_t t
= start_date
;
1050 ::encode(marker
, bl
);
1054 void decode(bufferlist::iterator
& bl
) {
1055 DECODE_START(1, bl
);
1058 start_date
= static_cast<time_t>(t
);
1059 ::decode(marker
, bl
);
1064 WRITE_CLASS_ENCODER(cls_rgw_lc_obj_head
)
1066 struct cls_rgw_reshard_entry
1068 ceph::real_time time
;
1072 string new_instance_id
;
1073 uint32_t old_num_shards
{0};
1074 uint32_t new_num_shards
{0};
1076 cls_rgw_reshard_entry() {}
1078 void encode(bufferlist
& bl
) const {
1079 ENCODE_START(1, 1, bl
);
1081 ::encode(tenant
, bl
);
1082 ::encode(bucket_name
, bl
);
1083 ::encode(bucket_id
, bl
);
1084 ::encode(new_instance_id
, bl
);
1085 ::encode(old_num_shards
, bl
);
1086 ::encode(new_num_shards
, bl
);
1090 void decode(bufferlist::iterator
& bl
) {
1091 DECODE_START(1, bl
);
1093 ::decode(tenant
, bl
);
1094 ::decode(bucket_name
, bl
);
1095 ::decode(bucket_id
, bl
);
1096 ::decode(new_instance_id
, bl
);
1097 ::decode(old_num_shards
, bl
);
1098 ::decode(new_num_shards
, bl
);
1102 void dump(Formatter
*f
) const;
1103 static void generate_test_instances(list
<cls_rgw_reshard_entry
*>& o
);
1105 static void generate_key(const string
& tenant
, const string
& bucket_name
, string
*key
);
1106 void get_key(string
*key
) const;
1108 WRITE_CLASS_ENCODER(cls_rgw_reshard_entry
)