]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_meta_sync_status.h
update sources to v12.2.3
[ceph.git] / ceph / src / rgw / rgw_meta_sync_status.h
1 #ifndef RGW_META_SYNC_STATUS_H
2 #define RGW_META_SYNC_STATUS_H
3
4 #include <string>
5
6 #include "common/ceph_time.h"
7
8 struct rgw_meta_sync_info {
9 enum SyncState {
10 StateInit = 0,
11 StateBuildingFullSyncMaps = 1,
12 StateSync = 2,
13 };
14
15 uint16_t state;
16 uint32_t num_shards;
17 std::string period; //< period id of current metadata log
18 epoch_t realm_epoch = 0; //< realm epoch of period
19
20 void encode(bufferlist& bl) const {
21 ENCODE_START(2, 1, bl);
22 ::encode(state, bl);
23 ::encode(num_shards, bl);
24 ::encode(period, bl);
25 ::encode(realm_epoch, bl);
26 ENCODE_FINISH(bl);
27 }
28
29 void decode(bufferlist::iterator& bl) {
30 DECODE_START(1, bl);
31 ::decode(state, bl);
32 ::decode(num_shards, bl);
33 if (struct_v >= 2) {
34 ::decode(period, bl);
35 ::decode(realm_epoch, bl);
36 }
37 DECODE_FINISH(bl);
38 }
39
40 void decode_json(JSONObj *obj);
41 void dump(Formatter *f) const;
42 static void generate_test_instances(std::list<rgw_meta_sync_info*>& ls);
43
44 rgw_meta_sync_info() : state((int)StateInit), num_shards(0) {}
45 };
46 WRITE_CLASS_ENCODER(rgw_meta_sync_info)
47
48 struct rgw_meta_sync_marker {
49 enum SyncState {
50 FullSync = 0,
51 IncrementalSync = 1,
52 };
53 uint16_t state;
54 string marker;
55 string next_step_marker;
56 uint64_t total_entries;
57 uint64_t pos;
58 real_time timestamp;
59 epoch_t realm_epoch{0}; //< realm_epoch of period marker
60
61 rgw_meta_sync_marker() : state(FullSync), total_entries(0), pos(0) {}
62
63 void encode(bufferlist& bl) const {
64 ENCODE_START(2, 1, bl);
65 ::encode(state, bl);
66 ::encode(marker, bl);
67 ::encode(next_step_marker, bl);
68 ::encode(total_entries, bl);
69 ::encode(pos, bl);
70 ::encode(timestamp, bl);
71 ::encode(realm_epoch, bl);
72 ENCODE_FINISH(bl);
73 }
74
75 void decode(bufferlist::iterator& bl) {
76 DECODE_START(2, bl);
77 ::decode(state, bl);
78 ::decode(marker, bl);
79 ::decode(next_step_marker, bl);
80 ::decode(total_entries, bl);
81 ::decode(pos, bl);
82 ::decode(timestamp, bl);
83 if (struct_v >= 2) {
84 ::decode(realm_epoch, bl);
85 }
86 DECODE_FINISH(bl);
87 }
88
89 void decode_json(JSONObj *obj);
90 void dump(Formatter *f) const;
91 static void generate_test_instances(std::list<rgw_meta_sync_marker*>& ls);
92 };
93 WRITE_CLASS_ENCODER(rgw_meta_sync_marker)
94
95 struct rgw_meta_sync_status {
96 rgw_meta_sync_info sync_info;
97 map<uint32_t, rgw_meta_sync_marker> sync_markers;
98
99 rgw_meta_sync_status() {}
100
101 void encode(bufferlist& bl) const {
102 ENCODE_START(1, 1, bl);
103 ::encode(sync_info, bl);
104 ::encode(sync_markers, bl);
105 ENCODE_FINISH(bl);
106 }
107
108 void decode(bufferlist::iterator& bl) {
109 DECODE_START(1, bl);
110 ::decode(sync_info, bl);
111 ::decode(sync_markers, bl);
112 DECODE_FINISH(bl);
113 }
114
115 void dump(Formatter *f) const;
116 void decode_json(JSONObj *obj);
117 static void generate_test_instances(std::list<rgw_meta_sync_status*>& ls);
118 };
119 WRITE_CLASS_ENCODER(rgw_meta_sync_status)
120
121 #endif