};
-class RGWOTPMetadataHandler : public RGWMetadataHandler_GenericMetaBE {
+class RGWOTPMetadataHandler : public RGWOTPMetadataHandlerBase {
friend class RGWOTPCtl;
struct Svc {
int init(RGWSI_Zone *zone,
RGWSI_MetaBackend *_meta_be,
RGWSI_OTP *_otp) {
+ base_init(zone->ctx(), _otp->get_be_handler().get());
svc.zone = zone;
svc.meta_be = _meta_be;
svc.otp = _otp;
#include "services/svc_meta_be_otp.h"
#include "rgw_basic_types.h"
+#include "rgw_metadata.h"
class RGWObjVersionTracker;
class RGWSI_OTP;
class RGWSI_MetaBackend;
+class RGWOTPMetadataHandlerBase : public RGWMetadataHandler_GenericMetaBE {
+public:
+ virtual ~RGWOTPMetadataHandlerBase() {}
+ virtual int init(RGWSI_Zone *zone,
+ RGWSI_MetaBackend *_meta_be,
+ RGWSI_OTP *_otp) = 0;
+};
+
class RGWOTPMetaHandlerAllocator {
public:
static RGWMetadataHandler *alloc();
bucket_meta_handler->init(svc.bucket, bucket.get());
bi_meta_handler->init(svc.zone, svc.bucket, svc.bi);
+ RGWOTPMetadataHandlerBase *otp_handler = static_cast<RGWOTPMetadataHandlerBase *>(meta.otp.get());
+ otp_handler->init(svc.zone, svc.meta_be_otp, svc.otp);
+
user->init(bucket.get());
bucket->init(user.get(),
(RGWBucketMetadataHandler *)bucket_meta_handler,
} ctl;
RGWUserMetadataHandler *umhandler;
- RGWSI_MetaBackend_Handler *be_handler;
+ RGWSI_MetaBackend_Handler *be_handler{nullptr};
public:
RGWUserCtl(RGWSI_Zone *zone_svc,
RGWSI_MetaBackend_Handler::Op *RGWSI_MetaBackend_Handler::alloc_op()
{
- return new Op_ManagedCtx(be);
+ return new Op_ManagedCtx(this);
}
-RGWSI_MetaBackend_Handler::Op_ManagedCtx::Op_ManagedCtx(RGWSI_MetaBackend *_be) : Op(_be, _be->alloc_ctx())
+RGWSI_MetaBackend_Handler::Op_ManagedCtx::Op_ManagedCtx(RGWSI_MetaBackend_Handler *handler) : Op(handler->be, handler->be->alloc_ctx())
{
- pctx.reset(ctx());
+ auto c = ctx();
+ c->init(handler);
+ pctx.reset(c);
}
class Op_ManagedCtx : public Op {
std::unique_ptr<RGWSI_MetaBackend::Context> pctx;
public:
- Op_ManagedCtx(RGWSI_MetaBackend *_be);
+ Op_ManagedCtx(RGWSI_MetaBackend_Handler *handler);
};
RGWSI_MetaBackend_Handler(RGWSI_MetaBackend *_be) : be(_be) {}
zone_svc(_zone_svc) {}
void get_pool_and_oid(const string& key, rgw_pool *pool, string *oid) override {
- *pool = zone_svc->get_zone_params().otp_pool;
- *oid = key;
+ if (pool) {
+ *pool = zone_svc->get_zone_params().otp_pool;
+ }
+
+ if (oid) {
+ *oid = key;
+ }
}
const string& get_oid_prefix() override {
class RGWSI_User : public RGWServiceInstance
{
-protected:
- RGWSI_MetaBackend_Handler *be_handler{nullptr};
-
public:
RGWSI_User(CephContext *cct);
virtual ~RGWSI_User();
return rgw_user(key);
}
- RGWSI_MetaBackend_Handler *get_be_handler() {
- return be_handler;
- }
+ virtual RGWSI_MetaBackend_Handler *get_be_handler() = 0;
/* base svc_user interfaces */
RGWSI_MetaBackend *_meta_be_svc,
RGWSI_SyncModules *_sync_modules);
+ RGWSI_MetaBackend_Handler *get_be_handler() override {
+ return be_handler;
+ }
+
int read_user_info(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
RGWUserInfo *info,