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"
11 using ceph::bufferlist
;
12 using ceph::Formatter
;
14 void rgw_zone_set_entry::from_str(const string
& s
)
16 auto pos
= s
.find(':');
17 if (pos
== string::npos
) {
21 zone
= s
.substr(0, pos
);
22 location_key
= s
.substr(pos
+ 1);
26 string
rgw_zone_set_entry::to_str() const
30 s
= s
+ ":" + *location_key
;
35 void rgw_zone_set_entry::encode(bufferlist
&bl
) const
37 /* no ENCODE_START, ENCODE_END for backward compatibility */
38 ceph::encode(to_str(), bl
);
41 void rgw_zone_set_entry::decode(bufferlist::const_iterator
&bl
)
43 /* no DECODE_START, DECODE_END for backward compatibility */
49 void rgw_zone_set_entry::dump(Formatter
*f
) const
51 encode_json("entry", to_str(), f
);
54 void rgw_zone_set_entry::decode_json(JSONObj
*obj
) {
56 JSONDecoder::decode_json("entry", s
, obj
);
60 void rgw_zone_set::insert(const string
& zone
, std::optional
<string
> location_key
)
62 entries
.insert(rgw_zone_set_entry(zone
, location_key
));
65 bool rgw_zone_set::exists(const string
& zone
, std::optional
<string
> location_key
) const
67 return entries
.find(rgw_zone_set_entry(zone
, location_key
)) != entries
.end();
70 void encode_json(const char *name
, const rgw_zone_set
& zs
, ceph::Formatter
*f
)
72 encode_json(name
, zs
.entries
, f
);
75 void decode_json_obj(rgw_zone_set
& zs
, JSONObj
*obj
)
77 decode_json_obj(zs
.entries
, obj
);
80 std::string_view
to_string(RGWModifyOp op
)
83 case CLS_RGW_OP_ADD
: return "write";
84 case CLS_RGW_OP_DEL
: return "del";
85 case CLS_RGW_OP_CANCEL
: return "cancel";
86 case CLS_RGW_OP_LINK_OLH
: return "link_olh";
87 case CLS_RGW_OP_LINK_OLH_DM
: return "link_olh_del";
88 case CLS_RGW_OP_UNLINK_INSTANCE
: return "unlink_instance";
89 case CLS_RGW_OP_SYNCSTOP
: return "syncstop";
90 case CLS_RGW_OP_RESYNC
: return "resync";
92 case CLS_RGW_OP_UNKNOWN
: return "unknown";
96 RGWModifyOp
parse_modify_op(std::string_view name
)
98 if (name
== "write") {
99 return CLS_RGW_OP_ADD
;
100 } else if (name
== "del") {
101 return CLS_RGW_OP_DEL
;
102 } else if (name
== "cancel") {
103 return CLS_RGW_OP_CANCEL
;
104 } else if (name
== "link_olh") {
105 return CLS_RGW_OP_LINK_OLH
;
106 } else if (name
== "link_olh_del") {
107 return CLS_RGW_OP_LINK_OLH_DM
;
108 } else if (name
== "unlink_instance") {
109 return CLS_RGW_OP_UNLINK_INSTANCE
;
110 } else if (name
== "syncstop") {
111 return CLS_RGW_OP_SYNCSTOP
;
112 } else if (name
== "resync") {
113 return CLS_RGW_OP_RESYNC
;
115 return CLS_RGW_OP_UNKNOWN
;
119 std::string_view
to_string(RGWObjCategory c
)
122 case RGWObjCategory::None
: return "rgw.none";
123 case RGWObjCategory::Main
: return "rgw.main";
124 case RGWObjCategory::Shadow
: return "rgw.shadow";
125 case RGWObjCategory::MultiMeta
: return "rgw.multimeta";
126 case RGWObjCategory::CloudTiered
: return "rgw.cloudtiered";
127 default: return "unknown";
131 void rgw_bucket_pending_info::generate_test_instances(list
<rgw_bucket_pending_info
*>& o
)
133 rgw_bucket_pending_info
*i
= new rgw_bucket_pending_info
;
134 i
->state
= CLS_RGW_STATE_COMPLETE
;
135 i
->op
= CLS_RGW_OP_DEL
;
137 o
.push_back(new rgw_bucket_pending_info
);
140 void rgw_bucket_pending_info::dump(Formatter
*f
) const
142 encode_json("state", (int)state
, f
);
143 utime_t
ut(timestamp
);
144 encode_json("timestamp", ut
, f
);
145 encode_json("op", (int)op
, f
);
148 void rgw_bucket_pending_info::decode_json(JSONObj
*obj
) {
150 JSONDecoder::decode_json("state", val
, obj
);
151 state
= (RGWPendingState
)val
;
152 utime_t
ut(timestamp
);
153 JSONDecoder::decode_json("timestamp", ut
, obj
);
154 JSONDecoder::decode_json("op", val
, obj
);
158 void cls_rgw_obj_key::decode_json(JSONObj
*obj
) {
159 JSONDecoder::decode_json("name", name
, obj
);
160 JSONDecoder::decode_json("instance", instance
, obj
);
163 void rgw_bucket_dir_entry_meta::generate_test_instances(list
<rgw_bucket_dir_entry_meta
*>& o
)
165 rgw_bucket_dir_entry_meta
*m
= new rgw_bucket_dir_entry_meta
;
166 m
->category
= RGWObjCategory::Main
;
170 m
->owner_display_name
= "display name";
171 m
->content_type
= "content/type";
173 o
.push_back(new rgw_bucket_dir_entry_meta
);
176 void rgw_bucket_dir_entry_meta::dump(Formatter
*f
) const
178 encode_json("category", (int)category
, f
);
179 encode_json("size", size
, f
);
181 encode_json("mtime", ut
, f
);
182 encode_json("etag", etag
, f
);
183 encode_json("storage_class", storage_class
, f
);
184 encode_json("owner", owner
, f
);
185 encode_json("owner_display_name", owner_display_name
, f
);
186 encode_json("content_type", content_type
, f
);
187 encode_json("accounted_size", accounted_size
, f
);
188 encode_json("user_data", user_data
, f
);
189 encode_json("appendable", appendable
, f
);
192 void rgw_bucket_dir_entry_meta::decode_json(JSONObj
*obj
) {
194 JSONDecoder::decode_json("category", val
, obj
);
195 category
= static_cast<RGWObjCategory
>(val
);
196 JSONDecoder::decode_json("size", size
, obj
);
198 JSONDecoder::decode_json("mtime", ut
, obj
);
199 mtime
= ut
.to_real_time();
200 JSONDecoder::decode_json("etag", etag
, obj
);
201 JSONDecoder::decode_json("storage_class", storage_class
, obj
);
202 JSONDecoder::decode_json("owner", owner
, obj
);
203 JSONDecoder::decode_json("owner_display_name", owner_display_name
, obj
);
204 JSONDecoder::decode_json("content_type", content_type
, obj
);
205 JSONDecoder::decode_json("accounted_size", accounted_size
, obj
);
206 JSONDecoder::decode_json("user_data", user_data
, obj
);
207 JSONDecoder::decode_json("appendable", appendable
, obj
);
210 void rgw_bucket_dir_entry::generate_test_instances(list
<rgw_bucket_dir_entry
*>& o
)
212 list
<rgw_bucket_dir_entry_meta
*> l
;
213 rgw_bucket_dir_entry_meta::generate_test_instances(l
);
215 for (auto iter
= l
.begin(); iter
!= l
.end(); ++iter
) {
216 rgw_bucket_dir_entry_meta
*m
= *iter
;
217 rgw_bucket_dir_entry
*e
= new rgw_bucket_dir_entry
;
218 e
->key
.name
= "name";
221 e
->locator
= "locator";
230 o
.push_back(new rgw_bucket_dir_entry
);
233 void rgw_bucket_entry_ver::dump(Formatter
*f
) const
235 encode_json("pool", pool
, f
);
236 encode_json("epoch", epoch
, f
);
239 void rgw_bucket_entry_ver::decode_json(JSONObj
*obj
) {
240 JSONDecoder::decode_json("pool", pool
, obj
);
241 JSONDecoder::decode_json("epoch", epoch
, obj
);
244 void rgw_bucket_entry_ver::generate_test_instances(list
<rgw_bucket_entry_ver
*>& ls
)
246 ls
.push_back(new rgw_bucket_entry_ver
);
247 ls
.push_back(new rgw_bucket_entry_ver
);
248 ls
.back()->pool
= 123;
249 ls
.back()->epoch
= 12322;
253 void rgw_bucket_dir_entry::dump(Formatter
*f
) const
255 encode_json("name", key
.name
, f
);
256 encode_json("instance", key
.instance
, f
);
257 encode_json("ver", ver
, f
);
258 encode_json("locator", locator
, f
);
259 encode_json("exists", exists
, f
);
260 encode_json("meta", meta
, f
);
261 encode_json("tag", tag
, f
);
262 encode_json("flags", (int)flags
, f
);
263 encode_json("pending_map", pending_map
, f
);
264 encode_json("versioned_epoch", versioned_epoch
, f
);
267 void rgw_bucket_dir_entry::decode_json(JSONObj
*obj
) {
268 JSONDecoder::decode_json("name", key
.name
, obj
);
269 JSONDecoder::decode_json("instance", key
.instance
, obj
);
270 JSONDecoder::decode_json("ver", ver
, obj
);
271 JSONDecoder::decode_json("locator", locator
, obj
);
272 JSONDecoder::decode_json("exists", exists
, obj
);
273 JSONDecoder::decode_json("meta", meta
, obj
);
274 JSONDecoder::decode_json("tag", tag
, obj
);
276 JSONDecoder::decode_json("flags", val
, obj
);
277 flags
= (uint16_t)val
;
278 JSONDecoder::decode_json("pending_map", pending_map
, obj
);
279 JSONDecoder::decode_json("versioned_epoch", versioned_epoch
, obj
);
282 static void dump_bi_entry(bufferlist bl
, BIIndexType index_type
, Formatter
*formatter
)
284 auto iter
= bl
.cbegin();
285 switch (index_type
) {
286 case BIIndexType::Plain
:
287 case BIIndexType::Instance
:
289 rgw_bucket_dir_entry entry
;
291 encode_json("entry", entry
, formatter
);
294 case BIIndexType::OLH
:
296 rgw_bucket_olh_entry entry
;
298 encode_json("entry", entry
, formatter
);
306 void rgw_cls_bi_entry::decode_json(JSONObj
*obj
, cls_rgw_obj_key
*effective_key
) {
307 JSONDecoder::decode_json("idx", idx
, obj
);
309 JSONDecoder::decode_json("type", s
, obj
);
311 type
= BIIndexType::Plain
;
312 } else if (s
== "instance") {
313 type
= BIIndexType::Instance
;
314 } else if (s
== "olh") {
315 type
= BIIndexType::OLH
;
317 type
= BIIndexType::Invalid
;
321 case BIIndexType::Plain
:
322 case BIIndexType::Instance
:
324 rgw_bucket_dir_entry entry
;
325 JSONDecoder::decode_json("entry", entry
, obj
);
329 *effective_key
= entry
.key
;
333 case BIIndexType::OLH
:
335 rgw_bucket_olh_entry entry
;
336 JSONDecoder::decode_json("entry", entry
, obj
);
340 *effective_key
= entry
.key
;
349 void rgw_cls_bi_entry::dump(Formatter
*f
) const
353 case BIIndexType::Plain
:
356 case BIIndexType::Instance
:
357 type_str
= "instance";
359 case BIIndexType::OLH
:
363 type_str
= "invalid";
365 encode_json("type", type_str
, f
);
366 encode_json("idx", idx
, f
);
367 dump_bi_entry(data
, type
, f
);
370 bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key
*key
,
371 RGWObjCategory
*category
,
372 rgw_bucket_category_stats
*accounted_stats
)
374 bool account
= false;
375 auto iter
= data
.cbegin();
378 case BIIndexType::Plain
:
380 // NO BREAK; falls through to case InstanceIdx:
381 case BIIndexType::Instance
:
383 rgw_bucket_dir_entry entry
;
385 account
= (account
&& entry
.exists
);
387 *category
= entry
.meta
.category
;
388 accounted_stats
->num_entries
++;
389 accounted_stats
->total_size
+= entry
.meta
.accounted_size
;
390 accounted_stats
->total_size_rounded
+= cls_rgw_get_rounded_size(entry
.meta
.accounted_size
);
391 accounted_stats
->actual_size
+= entry
.meta
.size
;
394 case BIIndexType::OLH
:
396 rgw_bucket_olh_entry entry
;
408 void rgw_bucket_olh_entry::dump(Formatter
*f
) const
410 encode_json("key", key
, f
);
411 encode_json("delete_marker", delete_marker
, f
);
412 encode_json("epoch", epoch
, f
);
413 encode_json("pending_log", pending_log
, f
);
414 encode_json("tag", tag
, f
);
415 encode_json("exists", exists
, f
);
416 encode_json("pending_removal", pending_removal
, f
);
419 void rgw_bucket_olh_entry::decode_json(JSONObj
*obj
)
421 JSONDecoder::decode_json("key", key
, obj
);
422 JSONDecoder::decode_json("delete_marker", delete_marker
, obj
);
423 JSONDecoder::decode_json("epoch", epoch
, obj
);
424 JSONDecoder::decode_json("pending_log", pending_log
, obj
);
425 JSONDecoder::decode_json("tag", tag
, obj
);
426 JSONDecoder::decode_json("exists", exists
, obj
);
427 JSONDecoder::decode_json("pending_removal", pending_removal
, obj
);
430 void rgw_bucket_olh_log_entry::generate_test_instances(list
<rgw_bucket_olh_log_entry
*>& o
)
432 rgw_bucket_olh_log_entry
*entry
= new rgw_bucket_olh_log_entry
;
434 entry
->op
= CLS_RGW_OLH_OP_LINK_OLH
;
435 entry
->op_tag
= "op_tag";
436 entry
->key
.name
= "key.name";
437 entry
->key
.instance
= "key.instance";
438 entry
->delete_marker
= true;
440 o
.push_back(new rgw_bucket_olh_log_entry
);
443 void rgw_bucket_olh_log_entry::dump(Formatter
*f
) const
445 encode_json("epoch", epoch
, f
);
448 case CLS_RGW_OLH_OP_LINK_OLH
:
451 case CLS_RGW_OLH_OP_UNLINK_OLH
:
452 op_str
= "unlink_olh";
454 case CLS_RGW_OLH_OP_REMOVE_INSTANCE
:
455 op_str
= "remove_instance";
460 encode_json("op", op_str
, f
);
461 encode_json("op_tag", op_tag
, f
);
462 encode_json("key", key
, f
);
463 encode_json("delete_marker", delete_marker
, f
);
466 void rgw_bucket_olh_log_entry::decode_json(JSONObj
*obj
)
468 JSONDecoder::decode_json("epoch", epoch
, obj
);
470 JSONDecoder::decode_json("op", op_str
, obj
);
471 if (op_str
== "link_olh") {
472 op
= CLS_RGW_OLH_OP_LINK_OLH
;
473 } else if (op_str
== "unlink_olh") {
474 op
= CLS_RGW_OLH_OP_UNLINK_OLH
;
475 } else if (op_str
== "remove_instance") {
476 op
= CLS_RGW_OLH_OP_REMOVE_INSTANCE
;
478 op
= CLS_RGW_OLH_OP_UNKNOWN
;
480 JSONDecoder::decode_json("op_tag", op_tag
, obj
);
481 JSONDecoder::decode_json("key", key
, obj
);
482 JSONDecoder::decode_json("delete_marker", delete_marker
, obj
);
484 void rgw_bi_log_entry::decode_json(JSONObj
*obj
)
486 JSONDecoder::decode_json("op_id", id
, obj
);
487 JSONDecoder::decode_json("op_tag", tag
, obj
);
489 JSONDecoder::decode_json("op", op_str
, obj
);
490 op
= parse_modify_op(op_str
);
491 JSONDecoder::decode_json("object", object
, obj
);
492 JSONDecoder::decode_json("instance", instance
, obj
);
494 JSONDecoder::decode_json("state", state_str
, obj
);
495 if (state_str
== "pending") {
496 state
= CLS_RGW_STATE_PENDING_MODIFY
;
497 } else if (state_str
== "complete") {
498 state
= CLS_RGW_STATE_COMPLETE
;
500 state
= CLS_RGW_STATE_UNKNOWN
;
502 JSONDecoder::decode_json("index_ver", index_ver
, obj
);
504 JSONDecoder::decode_json("timestamp", ut
, obj
);
505 timestamp
= ut
.to_real_time();
507 JSONDecoder::decode_json("bilog_flags", f
, obj
);
508 JSONDecoder::decode_json("ver", ver
, obj
);
509 bilog_flags
= (uint16_t)f
;
510 JSONDecoder::decode_json("owner", owner
, obj
);
511 JSONDecoder::decode_json("owner_display_name", owner_display_name
, obj
);
512 JSONDecoder::decode_json("zones_trace", zones_trace
, obj
);
515 void rgw_bi_log_entry::dump(Formatter
*f
) const
517 f
->dump_string("op_id", id
);
518 f
->dump_string("op_tag", tag
);
519 f
->dump_string("op", to_string(op
));
520 f
->dump_string("object", object
);
521 f
->dump_string("instance", instance
);
524 case CLS_RGW_STATE_PENDING_MODIFY
:
525 f
->dump_string("state", "pending");
527 case CLS_RGW_STATE_COMPLETE
:
528 f
->dump_string("state", "complete");
531 f
->dump_string("state", "invalid");
535 f
->dump_int("index_ver", index_ver
);
536 utime_t
ut(timestamp
);
537 ut
.gmtime_nsec(f
->dump_stream("timestamp"));
538 f
->open_object_section("ver");
541 f
->dump_int("bilog_flags", bilog_flags
);
542 f
->dump_bool("versioned", (bilog_flags
& RGW_BILOG_FLAG_VERSIONED_OP
) != 0);
543 f
->dump_string("owner", owner
);
544 f
->dump_string("owner_display_name", owner_display_name
);
545 encode_json("zones_trace", zones_trace
, f
);
548 void rgw_bi_log_entry::generate_test_instances(list
<rgw_bi_log_entry
*>& ls
)
550 ls
.push_back(new rgw_bi_log_entry
);
551 ls
.push_back(new rgw_bi_log_entry
);
552 ls
.back()->id
= "midf";
553 ls
.back()->object
= "obj";
554 ls
.back()->timestamp
= ceph::real_clock::from_ceph_timespec({ceph_le32(2), ceph_le32(3)});
555 ls
.back()->index_ver
= 4323;
556 ls
.back()->tag
= "tagasdfds";
557 ls
.back()->op
= CLS_RGW_OP_DEL
;
558 ls
.back()->state
= CLS_RGW_STATE_PENDING_MODIFY
;
561 void rgw_bucket_category_stats::generate_test_instances(list
<rgw_bucket_category_stats
*>& o
)
563 rgw_bucket_category_stats
*s
= new rgw_bucket_category_stats
;
564 s
->total_size
= 1024;
565 s
->total_size_rounded
= 4096;
567 s
->actual_size
= 1024;
569 o
.push_back(new rgw_bucket_category_stats
);
572 void rgw_bucket_category_stats::dump(Formatter
*f
) const
574 f
->dump_unsigned("total_size", total_size
);
575 f
->dump_unsigned("total_size_rounded", total_size_rounded
);
576 f
->dump_unsigned("num_entries", num_entries
);
577 f
->dump_unsigned("actual_size", actual_size
);
580 void rgw_bucket_dir_header::generate_test_instances(list
<rgw_bucket_dir_header
*>& o
)
582 list
<rgw_bucket_category_stats
*> l
;
583 rgw_bucket_category_stats::generate_test_instances(l
);
586 for (auto iter
= l
.begin(); iter
!= l
.end(); ++iter
, ++i
) {
587 RGWObjCategory c
= static_cast<RGWObjCategory
>(i
);
588 rgw_bucket_dir_header
*h
= new rgw_bucket_dir_header
;
589 rgw_bucket_category_stats
*s
= *iter
;
597 o
.push_back(new rgw_bucket_dir_header
);
600 void rgw_bucket_dir_header::dump(Formatter
*f
) const
602 f
->dump_int("ver", ver
);
603 f
->dump_int("master_ver", master_ver
);
604 f
->open_array_section("stats");
605 for (auto iter
= stats
.begin(); iter
!= stats
.end(); ++iter
) {
606 f
->dump_int("category", int(iter
->first
));
607 f
->open_object_section("category_stats");
608 iter
->second
.dump(f
);
612 ::encode_json("new_instance", new_instance
, f
);
615 void rgw_bucket_dir::generate_test_instances(list
<rgw_bucket_dir
*>& o
)
617 list
<rgw_bucket_dir_header
*> l
;
618 rgw_bucket_dir_header::generate_test_instances(l
);
621 for (auto iter
= l
.begin(); iter
!= l
.end(); ++iter
, ++i
) {
622 rgw_bucket_dir
*d
= new rgw_bucket_dir
;
623 rgw_bucket_dir_header
*h
= *iter
;
626 list
<rgw_bucket_dir_entry
*> el
;
627 for (auto 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 for (auto it
= usage_map
.begin(); it
!= usage_map
.end(); it
++) {
675 const rgw_usage_data
& total_usage
= it
->second
;
676 f
->open_object_section("entry");
677 f
->dump_string("category", it
->first
.c_str());
678 f
->dump_unsigned("bytes_sent", total_usage
.bytes_sent
);
679 f
->dump_unsigned("bytes_received", total_usage
.bytes_received
);
680 f
->dump_unsigned("ops", total_usage
.ops
);
681 f
->dump_unsigned("successful_ops", total_usage
.successful_ops
);
688 void rgw_usage_log_entry::generate_test_instances(list
<rgw_usage_log_entry
*> &o
)
690 rgw_usage_log_entry
*entry
= new rgw_usage_log_entry
;
691 rgw_usage_data usage_data
{1024, 2048};
692 entry
->owner
= rgw_user("owner");
693 entry
->payer
= rgw_user("payer");
694 entry
->bucket
= "bucket";
696 entry
->total_usage
.bytes_sent
= usage_data
.bytes_sent
;
697 entry
->total_usage
.bytes_received
= usage_data
.bytes_received
;
698 entry
->total_usage
.ops
= usage_data
.ops
;
699 entry
->total_usage
.successful_ops
= usage_data
.successful_ops
;
700 entry
->usage_map
["get_obj"] = usage_data
;
702 o
.push_back(new rgw_usage_log_entry
);
705 void cls_rgw_reshard_entry::generate_key(const string
& tenant
, const string
& bucket_name
, string
*key
)
707 *key
= tenant
+ ":" + bucket_name
;
710 void cls_rgw_reshard_entry::get_key(string
*key
) const
712 generate_key(tenant
, bucket_name
, key
);
715 void cls_rgw_reshard_entry::dump(Formatter
*f
) const
718 encode_json("time",ut
, f
);
719 encode_json("tenant", tenant
, f
);
720 encode_json("bucket_name", bucket_name
, f
);
721 encode_json("bucket_id", bucket_id
, f
);
722 encode_json("new_instance_id", new_instance_id
, f
);
723 encode_json("old_num_shards", old_num_shards
, f
);
724 encode_json("tentative_new_num_shards", new_num_shards
, f
);
727 void cls_rgw_reshard_entry::generate_test_instances(list
<cls_rgw_reshard_entry
*>& ls
)
729 ls
.push_back(new cls_rgw_reshard_entry
);
730 ls
.push_back(new cls_rgw_reshard_entry
);
731 ls
.back()->time
= ceph::real_clock::from_ceph_timespec({ceph_le32(2), ceph_le32(3)});
732 ls
.back()->tenant
= "tenant";
733 ls
.back()->bucket_name
= "bucket1""";
734 ls
.back()->bucket_id
= "bucket_id";
735 ls
.back()->new_instance_id
= "new_instance_id";
736 ls
.back()->old_num_shards
= 8;
737 ls
.back()->new_num_shards
= 64;
740 void cls_rgw_bucket_instance_entry::dump(Formatter
*f
) const
742 encode_json("reshard_status", to_string(reshard_status
), f
);
743 encode_json("new_bucket_instance_id", new_bucket_instance_id
, f
);
744 encode_json("num_shards", num_shards
, f
);
748 void cls_rgw_bucket_instance_entry::generate_test_instances(
749 list
<cls_rgw_bucket_instance_entry
*>& ls
)
751 ls
.push_back(new cls_rgw_bucket_instance_entry
);
752 ls
.push_back(new cls_rgw_bucket_instance_entry
);
753 ls
.back()->reshard_status
= RESHARD_STATUS::IN_PROGRESS
;
754 ls
.back()->new_bucket_instance_id
= "new_instance_id";
757 void cls_rgw_lc_obj_head::dump(Formatter
*f
) const
759 encode_json("start_date", start_date
, f
);
760 encode_json("marker", marker
, f
);
763 void cls_rgw_lc_obj_head::generate_test_instances(list
<cls_rgw_lc_obj_head
*>& ls
)