1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
4 #ifndef RGW_META_SYNC_STATUS_H
5 #define RGW_META_SYNC_STATUS_H
9 #include "common/ceph_time.h"
11 struct rgw_meta_sync_info
{
14 StateBuildingFullSyncMaps
= 1,
20 std::string period
; //< period id of current metadata log
21 epoch_t realm_epoch
= 0; //< realm epoch of period
23 void encode(bufferlist
& bl
) const {
24 ENCODE_START(2, 1, bl
);
26 encode(num_shards
, bl
);
28 encode(realm_epoch
, bl
);
32 void decode(bufferlist::const_iterator
& bl
) {
35 decode(num_shards
, bl
);
38 decode(realm_epoch
, bl
);
43 void decode_json(JSONObj
*obj
);
44 void dump(Formatter
*f
) const;
45 static void generate_test_instances(std::list
<rgw_meta_sync_info
*>& ls
);
47 rgw_meta_sync_info() : state((int)StateInit
), num_shards(0) {}
49 WRITE_CLASS_ENCODER(rgw_meta_sync_info
)
51 struct rgw_meta_sync_marker
{
58 std::string next_step_marker
;
59 uint64_t total_entries
;
62 epoch_t realm_epoch
{0}; //< realm_epoch of period marker
64 rgw_meta_sync_marker() : state(FullSync
), total_entries(0), pos(0) {}
66 void encode(bufferlist
& bl
) const {
67 ENCODE_START(2, 1, bl
);
70 encode(next_step_marker
, bl
);
71 encode(total_entries
, bl
);
73 encode(timestamp
, bl
);
74 encode(realm_epoch
, bl
);
78 void decode(bufferlist::const_iterator
& bl
) {
82 decode(next_step_marker
, bl
);
83 decode(total_entries
, bl
);
85 decode(timestamp
, bl
);
87 decode(realm_epoch
, bl
);
92 void decode_json(JSONObj
*obj
);
93 void dump(Formatter
*f
) const;
94 static void generate_test_instances(std::list
<rgw_meta_sync_marker
*>& ls
);
96 WRITE_CLASS_ENCODER(rgw_meta_sync_marker
)
98 struct rgw_meta_sync_status
{
99 rgw_meta_sync_info sync_info
;
100 std::map
<uint32_t, rgw_meta_sync_marker
> sync_markers
;
102 rgw_meta_sync_status() {}
104 void encode(bufferlist
& bl
) const {
105 ENCODE_START(1, 1, bl
);
106 encode(sync_info
, bl
);
107 encode(sync_markers
, bl
);
111 void decode(bufferlist::const_iterator
& bl
) {
113 decode(sync_info
, bl
);
114 decode(sync_markers
, bl
);
118 void dump(Formatter
*f
) const;
119 void decode_json(JSONObj
*obj
);
120 static void generate_test_instances(std::list
<rgw_meta_sync_status
*>& ls
);
122 WRITE_CLASS_ENCODER(rgw_meta_sync_status
)