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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CLS_QUEUE_OPS_H
#define CEPH_CLS_QUEUE_OPS_H
#include "common/ceph_json.h"
#include "cls/queue/cls_queue_types.h"
struct cls_queue_init_op {
uint64_t queue_size{0};
uint64_t max_urgent_data_size{0};
ceph::buffer::list bl_urgent_data;
cls_queue_init_op() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(queue_size, bl);
encode(max_urgent_data_size, bl);
encode(bl_urgent_data, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(queue_size, bl);
decode(max_urgent_data_size, bl);
decode(bl_urgent_data, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
f->dump_unsigned("queue_size", queue_size);
f->dump_unsigned("max_urgent_data_size", max_urgent_data_size);
f->dump_unsigned("urgent_data_len", bl_urgent_data.length());
}
static void generate_test_instances(std::list<cls_queue_init_op*>& o) {
o.push_back(new cls_queue_init_op);
o.push_back(new cls_queue_init_op);
o.back()->queue_size = 1024;
o.back()->max_urgent_data_size = 1024;
o.back()->bl_urgent_data.append(std::string_view("data"));
}
};
WRITE_CLASS_ENCODER(cls_queue_init_op)
struct cls_queue_enqueue_op {
std::vector<ceph::buffer::list> bl_data_vec;
cls_queue_enqueue_op() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(bl_data_vec, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(bl_data_vec, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
f->dump_unsigned("data_vec_len", bl_data_vec.size());
}
static void generate_test_instances(std::list<cls_queue_enqueue_op*>& o) {
o.push_back(new cls_queue_enqueue_op);
o.push_back(new cls_queue_enqueue_op);
o.back()->bl_data_vec.push_back(ceph::buffer::list());
o.back()->bl_data_vec.back().append(std::string_view("data"));
}
};
WRITE_CLASS_ENCODER(cls_queue_enqueue_op)
struct cls_queue_list_op {
uint64_t max{0};
std::string start_marker;
std::string end_marker;
cls_queue_list_op() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(max, bl);
encode(start_marker, bl);
encode(end_marker, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(max, bl);
decode(start_marker, bl);
if (struct_v > 1) {
decode(end_marker, bl);
}
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
f->dump_unsigned("max", max);
f->dump_string("start_marker", start_marker);
}
static void generate_test_instances(std::list<cls_queue_list_op*>& o) {
o.push_back(new cls_queue_list_op);
o.push_back(new cls_queue_list_op);
o.back()->max = 123;
o.back()->start_marker = "foo";
}
};
WRITE_CLASS_ENCODER(cls_queue_list_op)
struct cls_queue_list_ret {
bool is_truncated;
std::string next_marker;
std::vector<cls_queue_entry> entries;
cls_queue_list_ret() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(is_truncated, bl);
encode(next_marker, bl);
encode(entries, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(is_truncated, bl);
decode(next_marker, bl);
decode(entries, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
f->dump_bool("is_truncated", is_truncated);
f->dump_string("next_marker", next_marker);
encode_json("entries", entries, f);
}
static void generate_test_instances(std::list<cls_queue_list_ret*>& o) {
o.push_back(new cls_queue_list_ret);
o.back()->is_truncated = true;
o.back()->next_marker = "foo";
o.back()->entries.push_back(cls_queue_entry());
o.back()->entries.push_back(cls_queue_entry());
o.back()->entries.back().marker = "id";
o.back()->entries.back().data.append(std::string_view("data"));
}
};
WRITE_CLASS_ENCODER(cls_queue_list_ret)
struct cls_queue_remove_op {
std::string end_marker;
cls_queue_remove_op() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(end_marker, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(end_marker, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
f->dump_string("end_marker", end_marker);
}
static void generate_test_instances(std::list<cls_queue_remove_op*>& o) {
o.push_back(new cls_queue_remove_op);
o.push_back(new cls_queue_remove_op);
o.back()->end_marker = "foo";
}
};
WRITE_CLASS_ENCODER(cls_queue_remove_op)
struct cls_queue_get_capacity_ret {
uint64_t queue_capacity;
cls_queue_get_capacity_ret() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(queue_capacity, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(queue_capacity, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
f->dump_unsigned("queue_capacity", queue_capacity);
}
static void generate_test_instances(std::list<cls_queue_get_capacity_ret*>& o) {
o.push_back(new cls_queue_get_capacity_ret);
o.back()->queue_capacity = 123;
}
};
WRITE_CLASS_ENCODER(cls_queue_get_capacity_ret)
struct cls_queue_get_stats_ret {
uint64_t queue_size;
uint32_t queue_entries;
cls_queue_get_stats_ret() {}
void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(queue_size, bl);
encode(queue_entries, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(queue_size, bl);
decode(queue_entries, bl);
DECODE_FINISH(bl);
}
};
WRITE_CLASS_ENCODER(cls_queue_get_stats_ret)
#endif /* CEPH_CLS_QUEUE_OPS_H */
|