1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef RGW_REST_LOG_H
16 #define RGW_REST_LOG_H
18 #include "rgw_metadata.h"
20 class RGWOp_BILog_List
: public RGWRESTOp
{
23 RGWOp_BILog_List() : sent_header(false) {}
24 ~RGWOp_BILog_List() override
{}
26 int check_caps(RGWUserCaps
& caps
) override
{
27 return caps
.check_cap("bilog", RGW_CAP_READ
);
29 int verify_permission() override
{
30 return check_caps(s
->user
->caps
);
32 void send_response() override
;
33 virtual void send_response(list
<rgw_bi_log_entry
>& entries
, string
& marker
);
34 virtual void send_response_end();
35 void execute() override
;
36 const string
name() override
{
37 return "list_bucket_index_log";
41 class RGWOp_BILog_Info
: public RGWRESTOp
{
47 RGWOp_BILog_Info() : bucket_ver(), master_ver(), syncstopped(false) {}
48 ~RGWOp_BILog_Info() override
{}
50 int check_caps(RGWUserCaps
& caps
) override
{
51 return caps
.check_cap("bilog", RGW_CAP_READ
);
53 int verify_permission() override
{
54 return check_caps(s
->user
->caps
);
56 void send_response() override
;
57 void execute() override
;
58 const string
name() override
{
59 return "bucket_index_log_info";
63 class RGWOp_BILog_Delete
: public RGWRESTOp
{
65 RGWOp_BILog_Delete() {}
66 ~RGWOp_BILog_Delete() override
{}
68 int check_caps(RGWUserCaps
& caps
) override
{
69 return caps
.check_cap("bilog", RGW_CAP_WRITE
);
71 void execute() override
;
72 const string
name() override
{
73 return "trim_bucket_index_log";
77 class RGWOp_MDLog_List
: public RGWRESTOp
{
78 list
<cls_log_entry
> entries
;
82 RGWOp_MDLog_List() : truncated(false) {}
83 ~RGWOp_MDLog_List() override
{}
85 int check_caps(RGWUserCaps
& caps
) override
{
86 return caps
.check_cap("mdlog", RGW_CAP_READ
);
88 int verify_permission() override
{
89 return check_caps(s
->user
->caps
);
91 void execute() override
;
92 void send_response() override
;
93 const string
name() override
{
94 return "list_metadata_log";
98 class RGWOp_MDLog_Info
: public RGWRESTOp
{
100 RGWPeriodHistory::Cursor period
;
102 RGWOp_MDLog_Info() : num_objects(0) {}
103 ~RGWOp_MDLog_Info() override
{}
105 int check_caps(RGWUserCaps
& caps
) override
{
106 return caps
.check_cap("mdlog", RGW_CAP_READ
);
108 int verify_permission() override
{
109 return check_caps(s
->user
->caps
);
111 void execute() override
;
112 void send_response() override
;
113 const string
name() override
{
114 return "get_metadata_log_info";
118 class RGWOp_MDLog_ShardInfo
: public RGWRESTOp
{
119 RGWMetadataLogInfo info
;
121 RGWOp_MDLog_ShardInfo() {}
122 ~RGWOp_MDLog_ShardInfo() override
{}
124 int check_caps(RGWUserCaps
& caps
) override
{
125 return caps
.check_cap("mdlog", RGW_CAP_READ
);
127 int verify_permission() override
{
128 return check_caps(s
->user
->caps
);
130 void execute() override
;
131 void send_response() override
;
132 const string
name() override
{
133 return "get_metadata_log_shard_info";
137 class RGWOp_MDLog_Lock
: public RGWRESTOp
{
139 RGWOp_MDLog_Lock() {}
140 ~RGWOp_MDLog_Lock() override
{}
142 int check_caps(RGWUserCaps
& caps
) override
{
143 return caps
.check_cap("mdlog", RGW_CAP_WRITE
);
145 void execute() override
;
146 const string
name() override
{
147 return "lock_mdlog_object";
151 class RGWOp_MDLog_Unlock
: public RGWRESTOp
{
153 RGWOp_MDLog_Unlock() {}
154 ~RGWOp_MDLog_Unlock() override
{}
156 int check_caps(RGWUserCaps
& caps
) override
{
157 return caps
.check_cap("mdlog", RGW_CAP_WRITE
);
159 void execute() override
;
160 const string
name() override
{
161 return "unlock_mdlog_object";
165 class RGWOp_MDLog_Notify
: public RGWRESTOp
{
167 RGWOp_MDLog_Notify() {}
168 ~RGWOp_MDLog_Notify() override
{}
170 int check_caps(RGWUserCaps
& caps
) override
{
171 return caps
.check_cap("mdlog", RGW_CAP_WRITE
);
173 void execute() override
;
174 const string
name() override
{
175 return "mdlog_notify";
179 class RGWOp_MDLog_Delete
: public RGWRESTOp
{
181 RGWOp_MDLog_Delete() {}
182 ~RGWOp_MDLog_Delete() override
{}
184 int check_caps(RGWUserCaps
& caps
) override
{
185 return caps
.check_cap("mdlog", RGW_CAP_WRITE
);
187 void execute() override
;
188 const string
name() override
{
189 return "trim_metadata_log";
193 class RGWOp_DATALog_List
: public RGWRESTOp
{
194 list
<rgw_data_change_log_entry
> entries
;
199 RGWOp_DATALog_List() : truncated(false), extra_info(false) {}
200 ~RGWOp_DATALog_List() override
{}
202 int check_caps(RGWUserCaps
& caps
) override
{
203 return caps
.check_cap("datalog", RGW_CAP_READ
);
205 int verify_permission() override
{
206 return check_caps(s
->user
->caps
);
208 void execute() override
;
209 void send_response() override
;
210 const string
name() override
{
211 return "list_data_changes_log";
215 class RGWOp_DATALog_Info
: public RGWRESTOp
{
216 unsigned num_objects
;
218 RGWOp_DATALog_Info() : num_objects(0) {}
219 ~RGWOp_DATALog_Info() override
{}
221 int check_caps(RGWUserCaps
& caps
) override
{
222 return caps
.check_cap("datalog", RGW_CAP_READ
);
224 int verify_permission() override
{
225 return check_caps(s
->user
->caps
);
227 void execute() override
;
228 void send_response() override
;
229 const string
name() override
{
230 return "get_data_changes_log_info";
234 class RGWOp_DATALog_ShardInfo
: public RGWRESTOp
{
235 RGWDataChangesLogInfo info
;
237 RGWOp_DATALog_ShardInfo() {}
238 ~RGWOp_DATALog_ShardInfo() override
{}
240 int check_caps(RGWUserCaps
& caps
) override
{
241 return caps
.check_cap("datalog", RGW_CAP_READ
);
243 int verify_permission() override
{
244 return check_caps(s
->user
->caps
);
246 void execute() override
;
247 void send_response() override
;
248 const string
name() override
{
249 return "get_data_changes_log_shard_info";
253 class RGWOp_DATALog_Lock
: public RGWRESTOp
{
255 RGWOp_DATALog_Lock() {}
256 ~RGWOp_DATALog_Lock() override
{}
258 int check_caps(RGWUserCaps
& caps
) override
{
259 return caps
.check_cap("datalog", RGW_CAP_WRITE
);
261 void execute() override
;
262 const string
name() override
{
263 return "lock_datalog_object";
267 class RGWOp_DATALog_Unlock
: public RGWRESTOp
{
269 RGWOp_DATALog_Unlock() {}
270 ~RGWOp_DATALog_Unlock() override
{}
272 int check_caps(RGWUserCaps
& caps
) override
{
273 return caps
.check_cap("datalog", RGW_CAP_WRITE
);
275 void execute() override
;
276 const string
name() override
{
277 return "unlock_datalog_object";
281 class RGWOp_DATALog_Notify
: public RGWRESTOp
{
283 RGWOp_DATALog_Notify() {}
284 ~RGWOp_DATALog_Notify() override
{}
286 int check_caps(RGWUserCaps
& caps
) override
{
287 return caps
.check_cap("datalog", RGW_CAP_WRITE
);
289 void execute() override
;
290 const string
name() override
{
291 return "datalog_notify";
295 class RGWOp_DATALog_Delete
: public RGWRESTOp
{
297 RGWOp_DATALog_Delete() {}
298 ~RGWOp_DATALog_Delete() override
{}
300 int check_caps(RGWUserCaps
& caps
) override
{
301 return caps
.check_cap("datalog", RGW_CAP_WRITE
);
303 void execute() override
;
304 const string
name() override
{
305 return "trim_data_changes_log";
309 class RGWHandler_Log
: public RGWHandler_Auth_S3
{
311 RGWOp
*op_get() override
;
312 RGWOp
*op_delete() override
;
313 RGWOp
*op_post() override
;
315 int read_permissions(RGWOp
*) override
{
319 using RGWHandler_Auth_S3::RGWHandler_Auth_S3
;
320 ~RGWHandler_Log() override
= default;
323 class RGWRESTMgr_Log
: public RGWRESTMgr
{
325 RGWRESTMgr_Log() = default;
326 ~RGWRESTMgr_Log() override
= default;
328 RGWHandler_REST
* get_handler(struct req_state
* const,
329 const rgw::auth::StrategyRegistry
& auth_registry
,
330 const std::string
& frontend_prefixs
) override
{
331 return new RGWHandler_Log(auth_registry
);
335 #endif /* RGW_REST_LOG_H */