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
|
// -*- 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 <vector>
#include <memory>
#include "common/async/yield_context.h"
#include "rgw_common.h"
struct RGWServices_Def;
class RGWServiceInstance
{
friend struct RGWServices_Def;
protected:
CephContext *cct;
enum StartState {
StateInit = 0,
StateStarting = 1,
StateStarted = 2,
} start_state{StateInit};
virtual void shutdown() {}
virtual int do_start(optional_yield, const DoutPrefixProvider *dpp) {
return 0;
}
public:
RGWServiceInstance(CephContext *_cct) : cct(_cct) {}
virtual ~RGWServiceInstance();
int start(optional_yield y, const DoutPrefixProvider *dpp);
bool is_started() {
return (start_state == StateStarted);
}
CephContext *ctx() {
return cct;
}
};
class RGWSI_Finisher;
class RGWSI_Bucket;
class RGWSI_Bucket_SObj;
class RGWSI_Bucket_Sync;
class RGWSI_Bucket_Sync_SObj;
class RGWSI_BucketIndex;
class RGWSI_BucketIndex_RADOS;
class RGWSI_BILog_RADOS;
class RGWSI_Cls;
class RGWSI_ConfigKey;
class RGWSI_ConfigKey_RADOS;
class RGWSI_MDLog;
class RGWSI_Meta;
class RGWSI_MetaBackend;
class RGWSI_MetaBackend_SObj;
class RGWSI_MetaBackend_OTP;
class RGWSI_Notify;
class RGWSI_OTP;
class RGWSI_RADOS;
class RGWSI_Zone;
class RGWSI_ZoneUtils;
class RGWSI_Quota;
class RGWSI_SyncModules;
class RGWSI_SysObj;
class RGWSI_SysObj_Core;
class RGWSI_SysObj_Cache;
class RGWSI_User;
class RGWSI_User_RADOS;
class RGWDataChangesLog;
class RGWSI_Role_RADOS;
struct RGWServices_Def
{
bool can_shutdown{false};
bool has_shutdown{false};
std::unique_ptr<RGWSI_Finisher> finisher;
std::unique_ptr<RGWSI_Bucket_SObj> bucket_sobj;
std::unique_ptr<RGWSI_Bucket_Sync_SObj> bucket_sync_sobj;
std::unique_ptr<RGWSI_BucketIndex_RADOS> bi_rados;
std::unique_ptr<RGWSI_BILog_RADOS> bilog_rados;
std::unique_ptr<RGWSI_Cls> cls;
std::unique_ptr<RGWSI_ConfigKey_RADOS> config_key_rados;
std::unique_ptr<RGWSI_MDLog> mdlog;
std::unique_ptr<RGWSI_Meta> meta;
std::unique_ptr<RGWSI_MetaBackend_SObj> meta_be_sobj;
std::unique_ptr<RGWSI_MetaBackend_OTP> meta_be_otp;
std::unique_ptr<RGWSI_Notify> notify;
std::unique_ptr<RGWSI_OTP> otp;
std::unique_ptr<RGWSI_RADOS> rados;
std::unique_ptr<RGWSI_Zone> zone;
std::unique_ptr<RGWSI_ZoneUtils> zone_utils;
std::unique_ptr<RGWSI_Quota> quota;
std::unique_ptr<RGWSI_SyncModules> sync_modules;
std::unique_ptr<RGWSI_SysObj> sysobj;
std::unique_ptr<RGWSI_SysObj_Core> sysobj_core;
std::unique_ptr<RGWSI_SysObj_Cache> sysobj_cache;
std::unique_ptr<RGWSI_User_RADOS> user_rados;
std::unique_ptr<RGWDataChangesLog> datalog_rados;
std::unique_ptr<RGWSI_Role_RADOS> role_rados;
RGWServices_Def();
~RGWServices_Def();
int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
void shutdown();
};
struct RGWServices
{
RGWServices_Def _svc;
CephContext *cct;
RGWSI_Finisher *finisher{nullptr};
RGWSI_Bucket *bucket{nullptr};
RGWSI_Bucket_SObj *bucket_sobj{nullptr};
RGWSI_Bucket_Sync *bucket_sync{nullptr};
RGWSI_Bucket_Sync_SObj *bucket_sync_sobj{nullptr};
RGWSI_BucketIndex *bi{nullptr};
RGWSI_BucketIndex_RADOS *bi_rados{nullptr};
RGWSI_BILog_RADOS *bilog_rados{nullptr};
RGWSI_Cls *cls{nullptr};
RGWSI_ConfigKey_RADOS *config_key_rados{nullptr};
RGWSI_ConfigKey *config_key{nullptr};
RGWDataChangesLog *datalog_rados{nullptr};
RGWSI_MDLog *mdlog{nullptr};
RGWSI_Meta *meta{nullptr};
RGWSI_MetaBackend *meta_be_sobj{nullptr};
RGWSI_MetaBackend *meta_be_otp{nullptr};
RGWSI_Notify *notify{nullptr};
RGWSI_OTP *otp{nullptr};
RGWSI_RADOS *rados{nullptr};
RGWSI_Zone *zone{nullptr};
RGWSI_ZoneUtils *zone_utils{nullptr};
RGWSI_Quota *quota{nullptr};
RGWSI_SyncModules *sync_modules{nullptr};
RGWSI_SysObj *sysobj{nullptr};
RGWSI_SysObj_Cache *cache{nullptr};
RGWSI_SysObj_Core *core{nullptr};
RGWSI_User *user{nullptr};
RGWSI_Role_RADOS *role{nullptr};
int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
int init(CephContext *cct, bool have_cache, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp) {
return do_init(cct, have_cache, false, run_sync, y, dpp);
}
int init_raw(CephContext *cct, bool have_cache, optional_yield y, const DoutPrefixProvider *dpp) {
return do_init(cct, have_cache, true, false, y, dpp);
}
void shutdown() {
_svc.shutdown();
}
};
class RGWMetadataManager;
class RGWMetadataHandler;
class RGWUserCtl;
class RGWBucketCtl;
class RGWOTPCtl;
struct RGWCtlDef {
struct _meta {
std::unique_ptr<RGWMetadataManager> mgr;
std::unique_ptr<RGWMetadataHandler> bucket;
std::unique_ptr<RGWMetadataHandler> bucket_instance;
std::unique_ptr<RGWMetadataHandler> user;
std::unique_ptr<RGWMetadataHandler> otp;
std::unique_ptr<RGWMetadataHandler> role;
_meta();
~_meta();
} meta;
std::unique_ptr<RGWUserCtl> user;
std::unique_ptr<RGWBucketCtl> bucket;
std::unique_ptr<RGWOTPCtl> otp;
RGWCtlDef();
~RGWCtlDef();
int init(RGWServices& svc, rgw::sal::Driver* driver, const DoutPrefixProvider *dpp);
};
struct RGWCtl {
CephContext *cct{nullptr};
RGWServices *svc{nullptr};
RGWCtlDef _ctl;
struct _meta {
RGWMetadataManager *mgr{nullptr};
RGWMetadataHandler *bucket{nullptr};
RGWMetadataHandler *bucket_instance{nullptr};
RGWMetadataHandler *user{nullptr};
RGWMetadataHandler *otp{nullptr};
RGWMetadataHandler *role{nullptr};
} meta;
RGWUserCtl *user{nullptr};
RGWBucketCtl *bucket{nullptr};
RGWOTPCtl *otp{nullptr};
int init(RGWServices *_svc, rgw::sal::Driver* driver, const DoutPrefixProvider *dpp);
};
|