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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef RGW_REST_LOG_H
#define RGW_REST_LOG_H
#include "rgw_metadata.h"
class RGWOp_BILog_List : public RGWRESTOp {
bool sent_header;
public:
RGWOp_BILog_List() : sent_header(false) {}
~RGWOp_BILog_List() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("bilog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void send_response() override;
virtual void send_response(list<rgw_bi_log_entry>& entries, string& marker);
virtual void send_response_end();
void execute() override;
const char* name() const override {
return "list_bucket_index_log";
}
};
class RGWOp_BILog_Info : public RGWRESTOp {
string bucket_ver;
string master_ver;
string max_marker;
bool syncstopped;
public:
RGWOp_BILog_Info() : bucket_ver(), master_ver(), syncstopped(false) {}
~RGWOp_BILog_Info() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("bilog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void send_response() override;
void execute() override;
const char* name() const override {
return "bucket_index_log_info";
}
};
class RGWOp_BILog_Delete : public RGWRESTOp {
public:
RGWOp_BILog_Delete() {}
~RGWOp_BILog_Delete() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("bilog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "trim_bucket_index_log";
}
};
class RGWOp_MDLog_List : public RGWRESTOp {
list<cls_log_entry> entries;
string last_marker;
bool truncated;
public:
RGWOp_MDLog_List() : truncated(false) {}
~RGWOp_MDLog_List() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const char* name() const override {
return "list_metadata_log";
}
};
class RGWOp_MDLog_Info : public RGWRESTOp {
unsigned num_objects;
RGWPeriodHistory::Cursor period;
public:
RGWOp_MDLog_Info() : num_objects(0) {}
~RGWOp_MDLog_Info() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const char* name() const override {
return "get_metadata_log_info";
}
};
class RGWOp_MDLog_ShardInfo : public RGWRESTOp {
RGWMetadataLogInfo info;
public:
RGWOp_MDLog_ShardInfo() {}
~RGWOp_MDLog_ShardInfo() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const char* name() const override {
return "get_metadata_log_shard_info";
}
};
class RGWOp_MDLog_Lock : public RGWRESTOp {
public:
RGWOp_MDLog_Lock() {}
~RGWOp_MDLog_Lock() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "lock_mdlog_object";
}
};
class RGWOp_MDLog_Unlock : public RGWRESTOp {
public:
RGWOp_MDLog_Unlock() {}
~RGWOp_MDLog_Unlock() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "unlock_mdlog_object";
}
};
class RGWOp_MDLog_Notify : public RGWRESTOp {
public:
RGWOp_MDLog_Notify() {}
~RGWOp_MDLog_Notify() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "mdlog_notify";
}
};
class RGWOp_MDLog_Delete : public RGWRESTOp {
public:
RGWOp_MDLog_Delete() {}
~RGWOp_MDLog_Delete() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "trim_metadata_log";
}
};
class RGWOp_DATALog_List : public RGWRESTOp {
list<rgw_data_change_log_entry> entries;
string last_marker;
bool truncated;
bool extra_info;
public:
RGWOp_DATALog_List() : truncated(false), extra_info(false) {}
~RGWOp_DATALog_List() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const char* name() const override {
return "list_data_changes_log";
}
};
class RGWOp_DATALog_Info : public RGWRESTOp {
unsigned num_objects;
public:
RGWOp_DATALog_Info() : num_objects(0) {}
~RGWOp_DATALog_Info() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const char* name() const override {
return "get_data_changes_log_info";
}
};
class RGWOp_DATALog_ShardInfo : public RGWRESTOp {
RGWDataChangesLogInfo info;
public:
RGWOp_DATALog_ShardInfo() {}
~RGWOp_DATALog_ShardInfo() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const char* name() const override {
return "get_data_changes_log_shard_info";
}
};
class RGWOp_DATALog_Lock : public RGWRESTOp {
public:
RGWOp_DATALog_Lock() {}
~RGWOp_DATALog_Lock() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "lock_datalog_object";
}
};
class RGWOp_DATALog_Unlock : public RGWRESTOp {
public:
RGWOp_DATALog_Unlock() {}
~RGWOp_DATALog_Unlock() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "unlock_datalog_object";
}
};
class RGWOp_DATALog_Notify : public RGWRESTOp {
public:
RGWOp_DATALog_Notify() {}
~RGWOp_DATALog_Notify() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "datalog_notify";
}
};
class RGWOp_DATALog_Delete : public RGWRESTOp {
public:
RGWOp_DATALog_Delete() {}
~RGWOp_DATALog_Delete() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute() override;
const char* name() const override {
return "trim_data_changes_log";
}
};
class RGWHandler_Log : public RGWHandler_Auth_S3 {
protected:
RGWOp *op_get() override;
RGWOp *op_delete() override;
RGWOp *op_post() override;
int read_permissions(RGWOp*) override {
return 0;
}
public:
using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
~RGWHandler_Log() override = default;
};
class RGWRESTMgr_Log : public RGWRESTMgr {
public:
RGWRESTMgr_Log() = default;
~RGWRESTMgr_Log() override = default;
RGWHandler_REST* get_handler(struct req_state* const,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefixs) override {
return new RGWHandler_Log(auth_registry);
}
};
#endif /* RGW_REST_LOG_H */
|