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