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