]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_service.h
import ceph quincy 17.2.6
[ceph.git] / ceph / src / rgw / rgw_service.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 #ifndef CEPH_RGW_SERVICE_H
5 #define CEPH_RGW_SERVICE_H
6
7
8 #include <string>
9 #include <vector>
10 #include <memory>
11
12 #include "common/async/yield_context.h"
13
14 #include "rgw/rgw_common.h"
15
16 struct RGWServices_Def;
17
18 class RGWServiceInstance
19 {
20 friend struct RGWServices_Def;
21
22 protected:
23 CephContext *cct;
24
25 enum StartState {
26 StateInit = 0,
27 StateStarting = 1,
28 StateStarted = 2,
29 } start_state{StateInit};
30
31 virtual void shutdown() {}
32 virtual int do_start(optional_yield, const DoutPrefixProvider *dpp) {
33 return 0;
34 }
35 public:
36 RGWServiceInstance(CephContext *_cct) : cct(_cct) {}
37 virtual ~RGWServiceInstance();
38
39 int start(optional_yield y, const DoutPrefixProvider *dpp);
40 bool is_started() {
41 return (start_state == StateStarted);
42 }
43
44 CephContext *ctx() {
45 return cct;
46 }
47 };
48
49 class RGWSI_Finisher;
50 class RGWSI_Bucket;
51 class RGWSI_Bucket_SObj;
52 class RGWSI_Bucket_Sync;
53 class RGWSI_Bucket_Sync_SObj;
54 class RGWSI_BucketIndex;
55 class RGWSI_BucketIndex_RADOS;
56 class RGWSI_BILog_RADOS;
57 class RGWSI_Cls;
58 class RGWSI_ConfigKey;
59 class RGWSI_ConfigKey_RADOS;
60 class RGWSI_MDLog;
61 class RGWSI_Meta;
62 class RGWSI_MetaBackend;
63 class RGWSI_MetaBackend_SObj;
64 class RGWSI_MetaBackend_OTP;
65 class RGWSI_Notify;
66 class RGWSI_OTP;
67 class RGWSI_RADOS;
68 class RGWSI_Zone;
69 class RGWSI_ZoneUtils;
70 class RGWSI_Quota;
71 class RGWSI_SyncModules;
72 class RGWSI_SysObj;
73 class RGWSI_SysObj_Core;
74 class RGWSI_SysObj_Cache;
75 class RGWSI_User;
76 class RGWSI_User_RADOS;
77 class RGWDataChangesLog;
78 class RGWSI_Role_RADOS;
79
80 struct RGWServices_Def
81 {
82 bool can_shutdown{false};
83 bool has_shutdown{false};
84
85 std::unique_ptr<RGWSI_Finisher> finisher;
86 std::unique_ptr<RGWSI_Bucket_SObj> bucket_sobj;
87 std::unique_ptr<RGWSI_Bucket_Sync_SObj> bucket_sync_sobj;
88 std::unique_ptr<RGWSI_BucketIndex_RADOS> bi_rados;
89 std::unique_ptr<RGWSI_BILog_RADOS> bilog_rados;
90 std::unique_ptr<RGWSI_Cls> cls;
91 std::unique_ptr<RGWSI_ConfigKey_RADOS> config_key_rados;
92 std::unique_ptr<RGWSI_MDLog> mdlog;
93 std::unique_ptr<RGWSI_Meta> meta;
94 std::unique_ptr<RGWSI_MetaBackend_SObj> meta_be_sobj;
95 std::unique_ptr<RGWSI_MetaBackend_OTP> meta_be_otp;
96 std::unique_ptr<RGWSI_Notify> notify;
97 std::unique_ptr<RGWSI_OTP> otp;
98 std::unique_ptr<RGWSI_RADOS> rados;
99 std::unique_ptr<RGWSI_Zone> zone;
100 std::unique_ptr<RGWSI_ZoneUtils> zone_utils;
101 std::unique_ptr<RGWSI_Quota> quota;
102 std::unique_ptr<RGWSI_SyncModules> sync_modules;
103 std::unique_ptr<RGWSI_SysObj> sysobj;
104 std::unique_ptr<RGWSI_SysObj_Core> sysobj_core;
105 std::unique_ptr<RGWSI_SysObj_Cache> sysobj_cache;
106 std::unique_ptr<RGWSI_User_RADOS> user_rados;
107 std::unique_ptr<RGWDataChangesLog> datalog_rados;
108 std::unique_ptr<RGWSI_Role_RADOS> role_rados;
109
110 RGWServices_Def();
111 ~RGWServices_Def();
112
113 int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
114 void shutdown();
115 };
116
117
118 struct RGWServices
119 {
120 RGWServices_Def _svc;
121
122 CephContext *cct;
123
124 RGWSI_Finisher *finisher{nullptr};
125 RGWSI_Bucket *bucket{nullptr};
126 RGWSI_Bucket_SObj *bucket_sobj{nullptr};
127 RGWSI_Bucket_Sync *bucket_sync{nullptr};
128 RGWSI_Bucket_Sync_SObj *bucket_sync_sobj{nullptr};
129 RGWSI_BucketIndex *bi{nullptr};
130 RGWSI_BucketIndex_RADOS *bi_rados{nullptr};
131 RGWSI_BILog_RADOS *bilog_rados{nullptr};
132 RGWSI_Cls *cls{nullptr};
133 RGWSI_ConfigKey_RADOS *config_key_rados{nullptr};
134 RGWSI_ConfigKey *config_key{nullptr};
135 RGWDataChangesLog *datalog_rados{nullptr};
136 RGWSI_MDLog *mdlog{nullptr};
137 RGWSI_Meta *meta{nullptr};
138 RGWSI_MetaBackend *meta_be_sobj{nullptr};
139 RGWSI_MetaBackend *meta_be_otp{nullptr};
140 RGWSI_Notify *notify{nullptr};
141 RGWSI_OTP *otp{nullptr};
142 RGWSI_RADOS *rados{nullptr};
143 RGWSI_Zone *zone{nullptr};
144 RGWSI_ZoneUtils *zone_utils{nullptr};
145 RGWSI_Quota *quota{nullptr};
146 RGWSI_SyncModules *sync_modules{nullptr};
147 RGWSI_SysObj *sysobj{nullptr};
148 RGWSI_SysObj_Cache *cache{nullptr};
149 RGWSI_SysObj_Core *core{nullptr};
150 RGWSI_User *user{nullptr};
151 RGWSI_Role_RADOS *role{nullptr};
152
153 int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
154
155 int init(CephContext *cct, bool have_cache, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp) {
156 return do_init(cct, have_cache, false, run_sync, y, dpp);
157 }
158
159 int init_raw(CephContext *cct, bool have_cache, optional_yield y, const DoutPrefixProvider *dpp) {
160 return do_init(cct, have_cache, true, false, y, dpp);
161 }
162 void shutdown() {
163 _svc.shutdown();
164 }
165 };
166
167 class RGWMetadataManager;
168 class RGWMetadataHandler;
169 class RGWUserCtl;
170 class RGWBucketCtl;
171 class RGWOTPCtl;
172
173 struct RGWCtlDef {
174 struct _meta {
175 std::unique_ptr<RGWMetadataManager> mgr;
176 std::unique_ptr<RGWMetadataHandler> bucket;
177 std::unique_ptr<RGWMetadataHandler> bucket_instance;
178 std::unique_ptr<RGWMetadataHandler> user;
179 std::unique_ptr<RGWMetadataHandler> otp;
180 std::unique_ptr<RGWMetadataHandler> role;
181
182 _meta();
183 ~_meta();
184 } meta;
185
186 std::unique_ptr<RGWUserCtl> user;
187 std::unique_ptr<RGWBucketCtl> bucket;
188 std::unique_ptr<RGWOTPCtl> otp;
189
190 RGWCtlDef();
191 ~RGWCtlDef();
192
193 int init(RGWServices& svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp);
194 };
195
196 struct RGWCtl {
197 CephContext *cct{nullptr};
198 RGWServices *svc{nullptr};
199
200 RGWCtlDef _ctl;
201
202 struct _meta {
203 RGWMetadataManager *mgr{nullptr};
204
205 RGWMetadataHandler *bucket{nullptr};
206 RGWMetadataHandler *bucket_instance{nullptr};
207 RGWMetadataHandler *user{nullptr};
208 RGWMetadataHandler *otp{nullptr};
209 RGWMetadataHandler *role{nullptr};
210 } meta;
211
212 RGWUserCtl *user{nullptr};
213 RGWBucketCtl *bucket{nullptr};
214 RGWOTPCtl *otp{nullptr};
215
216 int init(RGWServices *_svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp);
217 };
218
219 #endif