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
|
// -*- 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_REPLICA_LOG_H
#define RGW_REST_REPLICA_LOG_H
class RGWOp_OBJLog_GetBounds : public RGWRESTOp {
string prefix;
string obj_type;
RGWReplicaBounds bounds;
public:
RGWOp_OBJLog_GetBounds(const char *_prefix, const char *type)
: prefix(_prefix), obj_type(type){}
~RGWOp_OBJLog_GetBounds() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap(obj_type.c_str(), RGW_CAP_READ);
}
int verify_permission() override {
return check_caps(s->user->caps);
}
void execute() override;
void send_response() override;
const string name() override {
string s = "replica";
s.append(obj_type);
s.append("_getbounds");
return s;
}
};
class RGWOp_OBJLog_SetBounds : public RGWRESTOp {
string prefix;
string obj_type;
public:
RGWOp_OBJLog_SetBounds(const char *_prefix, const char *type)
: prefix(_prefix), obj_type(type){}
~RGWOp_OBJLog_SetBounds() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap(obj_type.c_str(), RGW_CAP_WRITE);
}
void execute() override;
const string name() override {
string s = "replica";
s.append(obj_type);
s.append("_updatebounds");
return s;
}
};
class RGWOp_OBJLog_DeleteBounds : public RGWRESTOp {
string prefix;
string obj_type;
public:
RGWOp_OBJLog_DeleteBounds(const char *_prefix, const char *type)
: prefix(_prefix), obj_type(type){}
~RGWOp_OBJLog_DeleteBounds() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap(obj_type.c_str(), RGW_CAP_WRITE);
}
void execute() override;
const string name() override {
string s = "replica";
s.append(obj_type);
s.append("_deletebound");
return s;
}
};
class RGWOp_BILog_GetBounds : public RGWRESTOp {
RGWReplicaBounds bounds;
public:
RGWOp_BILog_GetBounds() {}
~RGWOp_BILog_GetBounds() 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 execute() override;
void send_response() override;
const string name() override {
return "replicabilog_getbounds";
}
};
class RGWOp_BILog_SetBounds : public RGWRESTOp {
public:
RGWOp_BILog_SetBounds() {}
~RGWOp_BILog_SetBounds() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("bilog", RGW_CAP_WRITE);
}
void execute() override;
const string name() override {
return "replicabilog_updatebounds";
}
};
class RGWOp_BILog_DeleteBounds : public RGWRESTOp {
public:
RGWOp_BILog_DeleteBounds() {}
~RGWOp_BILog_DeleteBounds() override {}
int check_caps(RGWUserCaps& caps) override {
return caps.check_cap("bilog", RGW_CAP_WRITE);
}
void execute() override;
const string name() override {
return "replicabilog_deletebound";
}
};
class RGWHandler_ReplicaLog : 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:
RGWHandler_ReplicaLog() : RGWHandler_Auth_S3() {}
~RGWHandler_ReplicaLog() override {}
};
class RGWRESTMgr_ReplicaLog : public RGWRESTMgr {
public:
RGWRESTMgr_ReplicaLog() = default;
~RGWRESTMgr_ReplicaLog() override = default;
RGWHandler_REST* get_handler(struct req_state*,
const std::string&) override {
return new RGWHandler_ReplicaLog;
}
};
#endif /*!RGW_REST_REPLICA_LOG_H*/
|