1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "cls/rgw/cls_rgw_types.h"
5 #include "common/ceph_json.h"
6 #include "include/utime.h"
9 void rgw_zone_set_entry::from_str(const string
& s
)
11 auto pos
= s
.find(':');
12 if (pos
== string::npos
) {
16 zone
= s
.substr(0, pos
);
17 location_key
= s
.substr(pos
+ 1);
21 string
rgw_zone_set_entry::to_str() const
25 s
= s
+ ":" + *location_key
;
30 void rgw_zone_set_entry::encode(bufferlist
&bl
) const
32 /* no ENCODE_START, ENCODE_END for backward compatibility */
33 ceph::encode(to_str(), bl
);
36 void rgw_zone_set_entry::decode(bufferlist::const_iterator
&bl
)
38 /* no DECODE_START, DECODE_END for backward compatibility */
44 void rgw_zone_set_entry::dump(Formatter
*f
) const
46 encode_json("entry", to_str(), f
);
49 void rgw_zone_set_entry::decode_json(JSONObj
*obj
) {
51 JSONDecoder::decode_json("entry", s
, obj
);
55 void rgw_zone_set::insert(const string
& zone
, std::optional
<string
> location_key
)
57 entries
.insert(rgw_zone_set_entry(zone
, location_key
));
60 bool rgw_zone_set::exists(const string
& zone
, std::optional
<string
> location_key
) const
62 return entries
.find(rgw_zone_set_entry(zone
, location_key
)) != entries
.end();
65 void encode_json(const char *name
, const rgw_zone_set
& zs
, ceph::Formatter
*f
)
67 encode_json(name
, zs
.entries
, f
);
70 void decode_json_obj(rgw_zone_set
& zs
, JSONObj
*obj
)
72 decode_json_obj(zs
.entries
, obj
);
75 void rgw_bucket_pending_info::generate_test_instances(list
<rgw_bucket_pending_info
*>& o
)
77 rgw_bucket_pending_info
*i
= new rgw_bucket_pending_info
;
78 i
->state
= CLS_RGW_STATE_COMPLETE
;
79 i
->op
= CLS_RGW_OP_DEL
;
81 o
.push_back(new rgw_bucket_pending_info
);
84 void rgw_bucket_pending_info::dump(Formatter
*f
) const
86 encode_json("state", (int)state
, f
);
87 utime_t
ut(timestamp
);
88 encode_json("timestamp", ut
, f
);
89 encode_json("op", (int)op
, f
);
92 void rgw_bucket_pending_info::decode_json(JSONObj
*obj
) {
94 JSONDecoder::decode_json("state", val
, obj
);
95 state
= (RGWPendingState
)val
;
96 utime_t
ut(timestamp
);
97 JSONDecoder::decode_json("timestamp", ut
, obj
);
98 JSONDecoder::decode_json("op", val
, obj
);
102 void cls_rgw_obj_key::decode_json(JSONObj
*obj
) {
103 JSONDecoder::decode_json("name", name
, obj
);
104 JSONDecoder::decode_json("instance", instance
, obj
);
107 void rgw_bucket_dir_entry_meta::generate_test_instances(list
<rgw_bucket_dir_entry_meta
*>& o
)
109 rgw_bucket_dir_entry_meta
*m
= new rgw_bucket_dir_entry_meta
;
110 m
->category
= RGWObjCategory::Main
;
114 m
->owner_display_name
= "display name";
115 m
->content_type
= "content/type";
117 o
.push_back(new rgw_bucket_dir_entry_meta
);
120 void rgw_bucket_dir_entry_meta::dump(Formatter
*f
) const
122 encode_json("category", (int)category
, f
);
123 encode_json("size", size
, f
);
125 encode_json("mtime", ut
, f
);
126 encode_json("etag", etag
, f
);
127 encode_json("storage_class", storage_class
, f
);
128 encode_json("owner", owner
, f
);
129 encode_json("owner_display_name", owner_display_name
, f
);
130 encode_json("content_type", content_type
, f
);
131 encode_json("accounted_size", accounted_size
, f
);
132 encode_json("user_data", user_data
, f
);
133 encode_json("appendable", appendable
, f
);
136 void rgw_bucket_dir_entry_meta::decode_json(JSONObj
*obj
) {
138 JSONDecoder::decode_json("category", val
, obj
);
139 category
= static_cast<RGWObjCategory
>(val
);
140 JSONDecoder::decode_json("size", size
, obj
);
142 JSONDecoder::decode_json("mtime", ut
, obj
);
143 mtime
= ut
.to_real_time();
144 JSONDecoder::decode_json("etag", etag
, obj
);
145 JSONDecoder::decode_json("storage_class", storage_class
, obj
);
146 JSONDecoder::decode_json("owner", owner
, obj
);
147 JSONDecoder::decode_json("owner_display_name", owner_display_name
, obj
);
148 JSONDecoder::decode_json("content_type", content_type
, obj
);
149 JSONDecoder::decode_json("accounted_size", accounted_size
, obj
);
150 JSONDecoder::decode_json("user_data", user_data
, obj
);
151 JSONDecoder::decode_json("appendable", appendable
, obj
);
154 void rgw_bucket_dir_entry::generate_test_instances(list
<rgw_bucket_dir_entry
*>& o
)
156 list
<rgw_bucket_dir_entry_meta
*> l
;
157 rgw_bucket_dir_entry_meta::generate_test_instances(l
);
159 list
<rgw_bucket_dir_entry_meta
*>::iterator iter
;
160 for (iter
= l
.begin(); iter
!= l
.end(); ++iter
) {
161 rgw_bucket_dir_entry_meta
*m
= *iter
;
162 rgw_bucket_dir_entry
*e
= new rgw_bucket_dir_entry
;
163 e
->key
.name
= "name";
166 e
->locator
= "locator";
175 o
.push_back(new rgw_bucket_dir_entry
);
178 void rgw_bucket_entry_ver::dump(Formatter
*f
) const
180 encode_json("pool", pool
, f
);
181 encode_json("epoch", epoch
, f
);
184 void rgw_bucket_entry_ver::decode_json(JSONObj
*obj
) {
185 JSONDecoder::decode_json("pool", pool
, obj
);
186 JSONDecoder::decode_json("epoch", epoch
, obj
);
189 void rgw_bucket_entry_ver::generate_test_instances(list
<rgw_bucket_entry_ver
*>& ls
)
191 ls
.push_back(new rgw_bucket_entry_ver
);
192 ls
.push_back(new rgw_bucket_entry_ver
);
193 ls
.back()->pool
= 123;
194 ls
.back()->epoch
= 12322;
198 void rgw_bucket_dir_entry::dump(Formatter
*f
) const
200 encode_json("name", key
.name
, f
);
201 encode_json("instance", key
.instance
, f
);
202 encode_json("ver", ver
, f
);
203 encode_json("locator", locator
, f
);
204 encode_json("exists", exists
, f
);
205 encode_json("meta", meta
, f
);
206 encode_json("tag", tag
, f
);
207 encode_json("flags", (int)flags
, f
);
208 encode_json("pending_map", pending_map
, f
);
209 encode_json("versioned_epoch", versioned_epoch
, f
);
212 void rgw_bucket_dir_entry::decode_json(JSONObj
*obj
) {
213 JSONDecoder::decode_json("name", key
.name
, obj
);
214 JSONDecoder::decode_json("instance", key
.instance
, obj
);
215 JSONDecoder::decode_json("ver", ver
, obj
);
216 JSONDecoder::decode_json("locator", locator
, obj
);
217 JSONDecoder::decode_json("exists", exists
, obj
);
218 JSONDecoder::decode_json("meta", meta
, obj
);
219 JSONDecoder::decode_json("tag", tag
, obj
);
221 JSONDecoder::decode_json("flags", val
, obj
);
222 flags
= (uint16_t)val
;
223 JSONDecoder::decode_json("pending_map", pending_map
, obj
);
224 JSONDecoder::decode_json("versioned_epoch", versioned_epoch
, obj
);
227 static void dump_bi_entry(bufferlist bl
, BIIndexType index_type
, Formatter
*formatter
)
229 auto iter
= bl
.cbegin();
230 switch (index_type
) {
231 case BIIndexType::Plain
:
232 case BIIndexType::Instance
:
234 rgw_bucket_dir_entry entry
;
236 encode_json("entry", entry
, formatter
);
239 case BIIndexType::OLH
:
241 rgw_bucket_olh_entry entry
;
243 encode_json("entry", entry
, formatter
);
251 void rgw_cls_bi_entry::decode_json(JSONObj
*obj
, cls_rgw_obj_key
*effective_key
) {
252 JSONDecoder::decode_json("idx", idx
, obj
);
254 JSONDecoder::decode_json("type", s
, obj
);
256 type
= BIIndexType::Plain
;
257 } else if (s
== "instance") {
258 type
= BIIndexType::Instance
;
259 } else if (s
== "olh") {
260 type
= BIIndexType::OLH
;
262 type
= BIIndexType::Invalid
;
266 case BIIndexType::Plain
:
267 case BIIndexType::Instance
:
269 rgw_bucket_dir_entry entry
;
270 JSONDecoder::decode_json("entry", entry
, obj
);
274 *effective_key
= entry
.key
;
278 case BIIndexType::OLH
:
280 rgw_bucket_olh_entry entry
;
281 JSONDecoder::decode_json("entry", entry
, obj
);
285 *effective_key
= entry
.key
;
294 void rgw_cls_bi_entry::dump(Formatter
*f
) const
298 case BIIndexType::Plain
:
301 case BIIndexType::Instance
:
302 type_str
= "instance";
304 case BIIndexType::OLH
:
308 type_str
= "invalid";
310 encode_json("type", type_str
, f
);
311 encode_json("idx", idx
, f
);
312 dump_bi_entry(data
, type
, f
);
315 bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key
*key
,
316 RGWObjCategory
*category
,
317 rgw_bucket_category_stats
*accounted_stats
)
319 bool account
= false;
320 auto iter
= data
.cbegin();
323 case BIIndexType::Plain
:
325 // NO BREAK; falls through to case InstanceIdx:
326 case BIIndexType::Instance
:
328 rgw_bucket_dir_entry entry
;
330 account
= (account
&& entry
.exists
);
332 *category
= entry
.meta
.category
;
333 accounted_stats
->num_entries
++;
334 accounted_stats
->total_size
+= entry
.meta
.accounted_size
;
335 accounted_stats
->total_size_rounded
+= cls_rgw_get_rounded_size(entry
.meta
.accounted_size
);
336 accounted_stats
->actual_size
+= entry
.meta
.size
;
339 case BIIndexType::OLH
:
341 rgw_bucket_olh_entry entry
;
353 void rgw_bucket_olh_entry::dump(Formatter
*f
) const
355 encode_json("key", key
, f
);
356 encode_json("delete_marker", delete_marker
, f
);
357 encode_json("epoch", epoch
, f
);
358 encode_json("pending_log", pending_log
, f
);
359 encode_json("tag", tag
, f
);
360 encode_json("exists", exists
, f
);
361 encode_json("pending_removal", pending_removal
, f
);
364 void rgw_bucket_olh_entry::decode_json(JSONObj
*obj
)
366 JSONDecoder::decode_json("key", key
, obj
);
367 JSONDecoder::decode_json("delete_marker", delete_marker
, obj
);
368 JSONDecoder::decode_json("epoch", epoch
, obj
);
369 JSONDecoder::decode_json("pending_log", pending_log
, obj
);
370 JSONDecoder::decode_json("tag", tag
, obj
);
371 JSONDecoder::decode_json("exists", exists
, obj
);
372 JSONDecoder::decode_json("pending_removal", pending_removal
, obj
);
375 void rgw_bucket_olh_log_entry::generate_test_instances(list
<rgw_bucket_olh_log_entry
*>& o
)
377 rgw_bucket_olh_log_entry
*entry
= new rgw_bucket_olh_log_entry
;
379 entry
->op
= CLS_RGW_OLH_OP_LINK_OLH
;
380 entry
->op_tag
= "op_tag";
381 entry
->key
.name
= "key.name";
382 entry
->key
.instance
= "key.instance";
383 entry
->delete_marker
= true;
385 o
.push_back(new rgw_bucket_olh_log_entry
);
388 void rgw_bucket_olh_log_entry::dump(Formatter
*f
) const
390 encode_json("epoch", epoch
, f
);
393 case CLS_RGW_OLH_OP_LINK_OLH
:
396 case CLS_RGW_OLH_OP_UNLINK_OLH
:
397 op_str
= "unlink_olh";
399 case CLS_RGW_OLH_OP_REMOVE_INSTANCE
:
400 op_str
= "remove_instance";
405 encode_json("op", op_str
, f
);
406 encode_json("op_tag", op_tag
, f
);
407 encode_json("key", key
, f
);
408 encode_json("delete_marker", delete_marker
, f
);
411 void rgw_bucket_olh_log_entry::decode_json(JSONObj
*obj
)
413 JSONDecoder::decode_json("epoch", epoch
, obj
);
415 JSONDecoder::decode_json("op", op_str
, obj
);
416 if (op_str
== "link_olh") {
417 op
= CLS_RGW_OLH_OP_LINK_OLH
;
418 } else if (op_str
== "unlink_olh") {
419 op
= CLS_RGW_OLH_OP_UNLINK_OLH
;
420 } else if (op_str
== "remove_instance") {
421 op
= CLS_RGW_OLH_OP_REMOVE_INSTANCE
;
423 op
= CLS_RGW_OLH_OP_UNKNOWN
;
425 JSONDecoder::decode_json("op_tag", op_tag
, obj
);
426 JSONDecoder::decode_json("key", key
, obj
);
427 JSONDecoder::decode_json("delete_marker", delete_marker
, obj
);
429 void rgw_bi_log_entry::decode_json(JSONObj
*obj
)
431 JSONDecoder::decode_json("op_id", id
, obj
);
432 JSONDecoder::decode_json("op_tag", tag
, obj
);
434 JSONDecoder::decode_json("op", op_str
, obj
);
435 if (op_str
== "write") {
437 } else if (op_str
== "del") {
439 } else if (op_str
== "cancel") {
440 op
= CLS_RGW_OP_CANCEL
;
441 } else if (op_str
== "unknown") {
442 op
= CLS_RGW_OP_UNKNOWN
;
443 } else if (op_str
== "link_olh") {
444 op
= CLS_RGW_OP_LINK_OLH
;
445 } else if (op_str
== "link_olh_del") {
446 op
= CLS_RGW_OP_LINK_OLH_DM
;
447 } else if (op_str
== "unlink_instance") {
448 op
= CLS_RGW_OP_UNLINK_INSTANCE
;
449 } else if (op_str
== "syncstop") {
450 op
= CLS_RGW_OP_SYNCSTOP
;
451 } else if (op_str
== "resync") {
452 op
= CLS_RGW_OP_RESYNC
;
454 op
= CLS_RGW_OP_UNKNOWN
;
456 JSONDecoder::decode_json("object", object
, obj
);
457 JSONDecoder::decode_json("instance", instance
, obj
);
459 JSONDecoder::decode_json("state", state_str
, obj
);
460 if (state_str
== "pending") {
461 state
= CLS_RGW_STATE_PENDING_MODIFY
;
462 } else if (state_str
== "complete") {
463 state
= CLS_RGW_STATE_COMPLETE
;
465 state
= CLS_RGW_STATE_UNKNOWN
;
467 JSONDecoder::decode_json("index_ver", index_ver
, obj
);
469 JSONDecoder::decode_json("timestamp", ut
, obj
);
470 timestamp
= ut
.to_real_time();
472 JSONDecoder::decode_json("bilog_flags", f
, obj
);
473 JSONDecoder::decode_json("ver", ver
, obj
);
474 bilog_flags
= (uint16_t)f
;
475 JSONDecoder::decode_json("owner", owner
, obj
);
476 JSONDecoder::decode_json("owner_display_name", owner_display_name
, obj
);
477 JSONDecoder::decode_json("zones_trace", zones_trace
, obj
);
480 void rgw_bi_log_entry::dump(Formatter
*f
) const
482 f
->dump_string("op_id", id
);
483 f
->dump_string("op_tag", tag
);
486 f
->dump_string("op", "write");
489 f
->dump_string("op", "del");
491 case CLS_RGW_OP_CANCEL
:
492 f
->dump_string("op", "cancel");
494 case CLS_RGW_OP_UNKNOWN
:
495 f
->dump_string("op", "unknown");
497 case CLS_RGW_OP_LINK_OLH
:
498 f
->dump_string("op", "link_olh");
500 case CLS_RGW_OP_LINK_OLH_DM
:
501 f
->dump_string("op", "link_olh_del");
503 case CLS_RGW_OP_UNLINK_INSTANCE
:
504 f
->dump_string("op", "unlink_instance");
506 case CLS_RGW_OP_SYNCSTOP
:
507 f
->dump_string("op", "syncstop");
509 case CLS_RGW_OP_RESYNC
:
510 f
->dump_string("op", "resync");
513 f
->dump_string("op", "invalid");
517 f
->dump_string("object", object
);
518 f
->dump_string("instance", instance
);
521 case CLS_RGW_STATE_PENDING_MODIFY
:
522 f
->dump_string("state", "pending");
524 case CLS_RGW_STATE_COMPLETE
:
525 f
->dump_string("state", "complete");
528 f
->dump_string("state", "invalid");
532 f
->dump_int("index_ver", index_ver
);
533 utime_t
ut(timestamp
);
534 ut
.gmtime_nsec(f
->dump_stream("timestamp"));
535 f
->open_object_section("ver");
538 f
->dump_int("bilog_flags", bilog_flags
);
539 f
->dump_bool("versioned", (bilog_flags
& RGW_BILOG_FLAG_VERSIONED_OP
) != 0);
540 f
->dump_string("owner", owner
);
541 f
->dump_string("owner_display_name", owner_display_name
);
542 encode_json("zones_trace", zones_trace
, f
);
545 void rgw_bi_log_entry::generate_test_instances(list
<rgw_bi_log_entry
*>& ls
)
547 ls
.push_back(new rgw_bi_log_entry
);
548 ls
.push_back(new rgw_bi_log_entry
);
549 ls
.back()->id
= "midf";
550 ls
.back()->object
= "obj";
551 ls
.back()->timestamp
= ceph::real_clock::from_ceph_timespec({init_le32(2), init_le32(3)});
552 ls
.back()->index_ver
= 4323;
553 ls
.back()->tag
= "tagasdfds";
554 ls
.back()->op
= CLS_RGW_OP_DEL
;
555 ls
.back()->state
= CLS_RGW_STATE_PENDING_MODIFY
;
558 void rgw_bucket_category_stats::generate_test_instances(list
<rgw_bucket_category_stats
*>& o
)
560 rgw_bucket_category_stats
*s
= new rgw_bucket_category_stats
;
561 s
->total_size
= 1024;
562 s
->total_size_rounded
= 4096;
564 s
->actual_size
= 1024;
566 o
.push_back(new rgw_bucket_category_stats
);
569 void rgw_bucket_category_stats::dump(Formatter
*f
) const
571 f
->dump_unsigned("total_size", total_size
);
572 f
->dump_unsigned("total_size_rounded", total_size_rounded
);
573 f
->dump_unsigned("num_entries", num_entries
);
574 f
->dump_unsigned("actual_size", actual_size
);
577 void rgw_bucket_dir_header::generate_test_instances(list
<rgw_bucket_dir_header
*>& o
)
579 list
<rgw_bucket_category_stats
*> l
;
580 list
<rgw_bucket_category_stats
*>::iterator iter
;
581 rgw_bucket_category_stats::generate_test_instances(l
);
584 for (i
= 0, iter
= l
.begin(); iter
!= l
.end(); ++iter
, ++i
) {
585 RGWObjCategory c
= static_cast<RGWObjCategory
>(i
);
586 rgw_bucket_dir_header
*h
= new rgw_bucket_dir_header
;
587 rgw_bucket_category_stats
*s
= *iter
;
595 o
.push_back(new rgw_bucket_dir_header
);
598 void rgw_bucket_dir_header::dump(Formatter
*f
) const
600 f
->dump_int("ver", ver
);
601 f
->dump_int("master_ver", master_ver
);
602 f
->open_array_section("stats");
603 for (auto iter
= stats
.begin(); iter
!= stats
.end(); ++iter
) {
604 f
->dump_int("category", int(iter
->first
));
605 f
->open_object_section("category_stats");
606 iter
->second
.dump(f
);
610 ::encode_json("new_instance", new_instance
, f
);
613 void rgw_bucket_dir::generate_test_instances(list
<rgw_bucket_dir
*>& o
)
615 list
<rgw_bucket_dir_header
*> l
;
616 list
<rgw_bucket_dir_header
*>::iterator iter
;
617 rgw_bucket_dir_header::generate_test_instances(l
);
620 for (i
= 0, iter
= l
.begin(); iter
!= l
.end(); ++iter
, ++i
) {
621 rgw_bucket_dir
*d
= new rgw_bucket_dir
;
622 rgw_bucket_dir_header
*h
= *iter
;
625 list
<rgw_bucket_dir_entry
*> el
;
626 list
<rgw_bucket_dir_entry
*>::iterator eiter
;
627 for (eiter
= el
.begin(); eiter
!= el
.end(); ++eiter
) {
628 rgw_bucket_dir_entry
*e
= *eiter
;
629 d
->m
[e
->key
.name
] = *e
;
639 o
.push_back(new rgw_bucket_dir
);
642 void rgw_bucket_dir::dump(Formatter
*f
) const
644 f
->open_object_section("header");
647 auto iter
= m
.cbegin();
648 f
->open_array_section("map");
649 for (; iter
!= m
.cend(); ++iter
) {
650 f
->dump_string("key", iter
->first
);
651 f
->open_object_section("dir_entry");
652 iter
->second
.dump(f
);
658 void rgw_usage_log_entry::dump(Formatter
*f
) const
660 f
->dump_string("owner", owner
.to_str());
661 f
->dump_string("payer", payer
.to_str());
662 f
->dump_string("bucket", bucket
);
663 f
->dump_unsigned("epoch", epoch
);
665 f
->open_object_section("total_usage");
666 f
->dump_unsigned("bytes_sent", total_usage
.bytes_sent
);
667 f
->dump_unsigned("bytes_received", total_usage
.bytes_received
);
668 f
->dump_unsigned("ops", total_usage
.ops
);
669 f
->dump_unsigned("successful_ops", total_usage
.successful_ops
);
672 f
->open_array_section("categories");
673 if (usage_map
.size() > 0) {
674 map
<string
, rgw_usage_data
>::const_iterator it
;
675 for (it
= usage_map
.begin(); it
!= usage_map
.end(); it
++) {
676 const rgw_usage_data
& total_usage
= it
->second
;
677 f
->open_object_section("entry");
678 f
->dump_string("category", it
->first
.c_str());
679 f
->dump_unsigned("bytes_sent", total_usage
.bytes_sent
);
680 f
->dump_unsigned("bytes_received", total_usage
.bytes_received
);
681 f
->dump_unsigned("ops", total_usage
.ops
);
682 f
->dump_unsigned("successful_ops", total_usage
.successful_ops
);
689 void rgw_usage_log_entry::generate_test_instances(list
<rgw_usage_log_entry
*> &o
)
691 rgw_usage_log_entry
*entry
= new rgw_usage_log_entry
;
692 rgw_usage_data usage_data
{1024, 2048};
693 entry
->owner
= rgw_user("owner");
694 entry
->payer
= rgw_user("payer");
695 entry
->bucket
= "bucket";
697 entry
->total_usage
.bytes_sent
= usage_data
.bytes_sent
;
698 entry
->total_usage
.bytes_received
= usage_data
.bytes_received
;
699 entry
->total_usage
.ops
= usage_data
.ops
;
700 entry
->total_usage
.successful_ops
= usage_data
.successful_ops
;
701 entry
->usage_map
["get_obj"] = usage_data
;
703 o
.push_back(new rgw_usage_log_entry
);
706 void cls_rgw_reshard_entry::generate_key(const string
& tenant
, const string
& bucket_name
, string
*key
)
708 *key
= tenant
+ ":" + bucket_name
;
711 void cls_rgw_reshard_entry::get_key(string
*key
) const
713 generate_key(tenant
, bucket_name
, key
);
716 void cls_rgw_reshard_entry::dump(Formatter
*f
) const
719 encode_json("time",ut
, f
);
720 encode_json("tenant", tenant
, f
);
721 encode_json("bucket_name", bucket_name
, f
);
722 encode_json("bucket_id", bucket_id
, f
);
723 encode_json("new_instance_id", new_instance_id
, f
);
724 encode_json("old_num_shards", old_num_shards
, f
);
725 encode_json("new_num_shards", new_num_shards
, f
);
729 void cls_rgw_reshard_entry::generate_test_instances(list
<cls_rgw_reshard_entry
*>& ls
)
731 ls
.push_back(new cls_rgw_reshard_entry
);
732 ls
.push_back(new cls_rgw_reshard_entry
);
733 ls
.back()->time
= ceph::real_clock::from_ceph_timespec({init_le32(2), init_le32(3)});
734 ls
.back()->tenant
= "tenant";
735 ls
.back()->bucket_name
= "bucket1""";
736 ls
.back()->bucket_id
= "bucket_id";
737 ls
.back()->new_instance_id
= "new_instance_id";
738 ls
.back()->old_num_shards
= 8;
739 ls
.back()->new_num_shards
= 64;
742 void cls_rgw_bucket_instance_entry::dump(Formatter
*f
) const
744 encode_json("reshard_status", to_string(reshard_status
), f
);
745 encode_json("new_bucket_instance_id", new_bucket_instance_id
, f
);
746 encode_json("num_shards", num_shards
, f
);
750 void cls_rgw_bucket_instance_entry::generate_test_instances(
751 list
<cls_rgw_bucket_instance_entry
*>& ls
)
753 ls
.push_back(new cls_rgw_bucket_instance_entry
);
754 ls
.push_back(new cls_rgw_bucket_instance_entry
);
755 ls
.back()->reshard_status
= RESHARD_STATUS::IN_PROGRESS
;
756 ls
.back()->new_bucket_instance_id
= "new_instance_id";
759 void cls_rgw_lc_obj_head::dump(Formatter
*f
) const
761 encode_json("start_date", start_date
, f
);
762 encode_json("marker", marker
, f
);
765 void cls_rgw_lc_obj_head::generate_test_instances(list
<cls_rgw_lc_obj_head
*>& ls
)