]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_service.h
buildsys: change download over to reef release
[ceph.git] / ceph / src / rgw / rgw_service.h
CommitLineData
11fdf7f2 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
11fdf7f2
TL
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
f67539c2
TL
12#include "common/async/yield_context.h"
13
11fdf7f2
TL
14#include "rgw/rgw_common.h"
15
16struct RGWServices_Def;
17
18class RGWServiceInstance
19{
20 friend struct RGWServices_Def;
21
22protected:
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() {}
b3b6e05e 32 virtual int do_start(optional_yield, const DoutPrefixProvider *dpp) {
11fdf7f2
TL
33 return 0;
34 }
35public:
36 RGWServiceInstance(CephContext *_cct) : cct(_cct) {}
20effc67 37 virtual ~RGWServiceInstance();
11fdf7f2 38
b3b6e05e 39 int start(optional_yield y, const DoutPrefixProvider *dpp);
11fdf7f2
TL
40 bool is_started() {
41 return (start_state == StateStarted);
42 }
43
44 CephContext *ctx() {
45 return cct;
46 }
47};
48
49class RGWSI_Finisher;
9f95a23c
TL
50class RGWSI_Bucket;
51class RGWSI_Bucket_SObj;
52class RGWSI_Bucket_Sync;
53class RGWSI_Bucket_Sync_SObj;
54class RGWSI_BucketIndex;
55class RGWSI_BucketIndex_RADOS;
56class RGWSI_BILog_RADOS;
57class RGWSI_Cls;
58class RGWSI_ConfigKey;
59class RGWSI_ConfigKey_RADOS;
9f95a23c
TL
60class RGWSI_MDLog;
61class RGWSI_Meta;
62class RGWSI_MetaBackend;
63class RGWSI_MetaBackend_SObj;
64class RGWSI_MetaBackend_OTP;
11fdf7f2 65class RGWSI_Notify;
9f95a23c 66class RGWSI_OTP;
11fdf7f2
TL
67class RGWSI_RADOS;
68class RGWSI_Zone;
69class RGWSI_ZoneUtils;
70class RGWSI_Quota;
71class RGWSI_SyncModules;
72class RGWSI_SysObj;
73class RGWSI_SysObj_Core;
74class RGWSI_SysObj_Cache;
9f95a23c
TL
75class RGWSI_User;
76class RGWSI_User_RADOS;
f67539c2 77class RGWDataChangesLog;
39ae355f 78class RGWSI_Role_RADOS;
11fdf7f2
TL
79
80struct RGWServices_Def
81{
82 bool can_shutdown{false};
83 bool has_shutdown{false};
84
85 std::unique_ptr<RGWSI_Finisher> finisher;
9f95a23c
TL
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;
9f95a23c
TL
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;
11fdf7f2 96 std::unique_ptr<RGWSI_Notify> notify;
9f95a23c 97 std::unique_ptr<RGWSI_OTP> otp;
11fdf7f2
TL
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;
9f95a23c 106 std::unique_ptr<RGWSI_User_RADOS> user_rados;
f67539c2 107 std::unique_ptr<RGWDataChangesLog> datalog_rados;
39ae355f 108 std::unique_ptr<RGWSI_Role_RADOS> role_rados;
11fdf7f2
TL
109
110 RGWServices_Def();
111 ~RGWServices_Def();
112
b3b6e05e 113 int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
11fdf7f2
TL
114 void shutdown();
115};
116
117
118struct RGWServices
119{
120 RGWServices_Def _svc;
121
9f95a23c
TL
122 CephContext *cct;
123
11fdf7f2 124 RGWSI_Finisher *finisher{nullptr};
9f95a23c
TL
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};
f67539c2 135 RGWDataChangesLog *datalog_rados{nullptr};
9f95a23c
TL
136 RGWSI_MDLog *mdlog{nullptr};
137 RGWSI_Meta *meta{nullptr};
138 RGWSI_MetaBackend *meta_be_sobj{nullptr};
139 RGWSI_MetaBackend *meta_be_otp{nullptr};
11fdf7f2 140 RGWSI_Notify *notify{nullptr};
9f95a23c 141 RGWSI_OTP *otp{nullptr};
11fdf7f2
TL
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};
9f95a23c 150 RGWSI_User *user{nullptr};
39ae355f 151 RGWSI_Role_RADOS *role{nullptr};
11fdf7f2 152
b3b6e05e 153 int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
11fdf7f2 154
b3b6e05e
TL
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);
11fdf7f2
TL
157 }
158
b3b6e05e
TL
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);
11fdf7f2
TL
161 }
162 void shutdown() {
163 _svc.shutdown();
164 }
165};
166
9f95a23c
TL
167class RGWMetadataManager;
168class RGWMetadataHandler;
169class RGWUserCtl;
170class RGWBucketCtl;
171class RGWOTPCtl;
172
173struct 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;
39ae355f 180 std::unique_ptr<RGWMetadataHandler> role;
9f95a23c
TL
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
39ae355f 193 int init(RGWServices& svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp);
9f95a23c
TL
194};
195
196struct 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};
39ae355f 209 RGWMetadataHandler *role{nullptr};
9f95a23c
TL
210 } meta;
211
212 RGWUserCtl *user{nullptr};
213 RGWBucketCtl *bucket{nullptr};
214 RGWOTPCtl *otp{nullptr};
215
39ae355f 216 int init(RGWServices *_svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp);
9f95a23c 217};
11fdf7f2
TL
218
219#endif