services/svc_mdlog.cc
services/svc_meta.cc
services/svc_meta_be.cc
- services/svc_meta_be_otp.cc
services/svc_meta_be_sobj.cc
services/svc_notify.cc
- services/svc_otp.cc
services/svc_quota.cc
services/svc_sync_modules.cc
services/svc_role_rados.cc
#include "services/svc_meta.h"
#include "services/svc_meta_be.h"
#include "services/svc_meta_be_sobj.h"
-#include "services/svc_meta_be_otp.h"
#include "services/svc_notify.h"
-#include "services/svc_otp.h"
#include "services/svc_zone.h"
#include "services/svc_zone_utils.h"
#include "services/svc_quota.h"
mdlog = std::make_unique<RGWSI_MDLog>(cct, run_sync);
meta = std::make_unique<RGWSI_Meta>(cct);
meta_be_sobj = std::make_unique<RGWSI_MetaBackend_SObj>(cct);
- meta_be_otp = std::make_unique<RGWSI_MetaBackend_OTP>(cct);
notify = std::make_unique<RGWSI_Notify>(cct);
- otp = std::make_unique<RGWSI_OTP>(cct);
zone = std::make_unique<RGWSI_Zone>(cct);
zone_utils = std::make_unique<RGWSI_ZoneUtils>(cct);
quota = std::make_unique<RGWSI_Quota>(cct);
sysobj_cache = std::make_unique<RGWSI_SysObj_Cache>(dpp, cct);
}
- vector<RGWSI_MetaBackend *> meta_bes{meta_be_sobj.get(), meta_be_otp.get()};
+ vector<RGWSI_MetaBackend *> meta_bes{meta_be_sobj.get()};
async_processor->start();
finisher->init();
cls.get(), async_processor.get());
meta->init(sysobj.get(), mdlog.get(), meta_bes);
meta_be_sobj->init(sysobj.get(), mdlog.get());
- meta_be_otp->init(sysobj.get(), mdlog.get(), cls.get());
notify->init(zone.get(), driver->getRados()->get_rados_handle(),
finisher.get());
- otp->init(zone.get(), meta.get(), meta_be_otp.get());
zone->init(sysobj.get(), driver->getRados()->get_rados_handle(),
sync_modules.get(), bucket_sync_sobj.get());
zone_utils->init(driver->getRados()->get_rados_handle(), zone.get());
return r;
}
- r = otp->start(y, dpp);
- if (r < 0) {
- ldpp_dout(dpp, 0) << "ERROR: failed to start otp service (" << cpp_strerror(-r) << dendl;
- return r;
- }
-
r = role_rados->start(y, dpp);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start role_rados service (" << cpp_strerror(-r) << dendl;
datalog_rados.reset();
user_rados->shutdown();
sync_modules->shutdown();
- otp->shutdown();
notify->shutdown();
- meta_be_otp->shutdown();
meta_be_sobj->shutdown();
meta->shutdown();
mdlog->shutdown();
mdlog = _svc.mdlog.get();
meta = _svc.meta.get();
meta_be_sobj = _svc.meta_be_sobj.get();
- meta_be_otp = _svc.meta_be_otp.get();
notify = _svc.notify.get();
- otp = _svc.otp.get();
zone = _svc.zone.get();
zone_utils = _svc.zone_utils.get();
quota = _svc.quota.get();
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_Zone> zone;
std::unique_ptr<RGWSI_ZoneUtils> zone_utils;
std::unique_ptr<RGWSI_Quota> quota;
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_Zone *zone{nullptr};
RGWSI_ZoneUtils *zone_utils{nullptr};
RGWSI_Quota *quota{nullptr};
#include "services/svc_cls.h"
#include "services/svc_bilog_rados.h"
#include "services/svc_mdlog.h"
-#include "services/svc_meta_be_otp.h"
#include "services/svc_user.h"
#include "services/svc_zone.h"
enum Type {
MDBE_SOBJ = 0,
- MDBE_OTP = 1,
};
RGWSI_MetaBackend(CephContext *cct) : RGWServiceInstance(cct) {}
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab ft=cpp
-
-#include "svc_meta_be_otp.h"
-
-#include "rgw_tools.h"
-#include "rgw_metadata.h"
-#include "rgw_mdlog.h"
-
-#define dout_subsys ceph_subsys_rgw
-
-using namespace std;
-
-RGWSI_MetaBackend_OTP::RGWSI_MetaBackend_OTP(CephContext *cct) : RGWSI_MetaBackend_SObj(cct) {
-}
-
-RGWSI_MetaBackend_OTP::~RGWSI_MetaBackend_OTP() {
-}
-
-string RGWSI_MetaBackend_OTP::get_meta_key(const rgw_user& user)
-{
- return string("otp:user:") + user.to_str();
-}
-
-RGWSI_MetaBackend_Handler *RGWSI_MetaBackend_OTP::alloc_be_handler()
-{
- return new RGWSI_MetaBackend_Handler_OTP(this);
-}
-
-RGWSI_MetaBackend::Context *RGWSI_MetaBackend_OTP::alloc_ctx()
-{
- return new Context_OTP;
-}
-
-int RGWSI_MetaBackend_OTP::call_with_get_params(ceph::real_time *pmtime, std::function<int(RGWSI_MetaBackend::GetParams&)> cb)
-{
- otp_devices_list_t devices;
- RGWSI_MBOTP_GetParams params;
- params.pdevices = &devices;
- params.pmtime = pmtime;
- return cb(params);
-}
-
-int RGWSI_MetaBackend_OTP::get_entry(RGWSI_MetaBackend::Context *_ctx,
- const string& key,
- RGWSI_MetaBackend::GetParams& _params,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- bool get_raw_attrs)
-{
- RGWSI_MBOTP_GetParams& params = static_cast<RGWSI_MBOTP_GetParams&>(_params);
-
- int r = cls_svc->mfa.list_mfa(dpp, key, params.pdevices, objv_tracker, params.pmtime, y);
- if (r < 0) {
- return r;
- }
-
- return 0;
-}
-
-int RGWSI_MetaBackend_OTP::put_entry(const DoutPrefixProvider *dpp,
- RGWSI_MetaBackend::Context *_ctx,
- const string& key,
- RGWSI_MetaBackend::PutParams& _params,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y)
-{
- RGWSI_MBOTP_PutParams& params = static_cast<RGWSI_MBOTP_PutParams&>(_params);
-
- return cls_svc->mfa.set_mfa(dpp, key, params.devices, true, objv_tracker, params.mtime, y);
-}
-
+++ /dev/null
-
-
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab ft=cpp
-
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation. See file COPYING.
- *
- */
-
-
-#pragma once
-
-#include "rgw_service.h"
-
-#include "svc_cls.h"
-#include "svc_meta_be.h"
-#include "svc_meta_be_sobj.h"
-#include "svc_sys_obj.h"
-
-
-using RGWSI_MBOTP_Handler_Module = RGWSI_MBSObj_Handler_Module;
-using RGWSI_MetaBackend_Handler_OTP = RGWSI_MetaBackend_Handler_SObj;
-
-using otp_devices_list_t = std::list<rados::cls::otp::otp_info_t>;
-
-struct RGWSI_MBOTP_GetParams : public RGWSI_MetaBackend::GetParams {
- otp_devices_list_t *pdevices{nullptr};
-};
-
-struct RGWSI_MBOTP_PutParams : public RGWSI_MetaBackend::PutParams {
- otp_devices_list_t devices;
-};
-
-using RGWSI_MBOTP_RemoveParams = RGWSI_MBSObj_RemoveParams;
-
-class RGWSI_MetaBackend_OTP : public RGWSI_MetaBackend_SObj
-{
- RGWSI_Cls *cls_svc{nullptr};
-
-public:
- struct Context_OTP : public RGWSI_MetaBackend_SObj::Context_SObj {
- otp_devices_list_t devices;
- };
-
- RGWSI_MetaBackend_OTP(CephContext *cct);
- virtual ~RGWSI_MetaBackend_OTP();
-
- RGWSI_MetaBackend::Type get_type() {
- return MDBE_OTP;
- }
-
- static std::string get_meta_key(const rgw_user& user);
-
- void init(RGWSI_SysObj *_sysobj_svc,
- RGWSI_MDLog *_mdlog_svc,
- RGWSI_Cls *_cls_svc) {
- RGWSI_MetaBackend_SObj::init(_sysobj_svc, _mdlog_svc);
- cls_svc = _cls_svc;
- }
-
- RGWSI_MetaBackend_Handler *alloc_be_handler() override;
- RGWSI_MetaBackend::Context *alloc_ctx() override;
-
- int call_with_get_params(ceph::real_time *pmtime, std::function<int(RGWSI_MetaBackend::GetParams&)> cb) override;
-
- int get_entry(RGWSI_MetaBackend::Context *ctx,
- const std::string& key,
- RGWSI_MetaBackend::GetParams& _params,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- bool get_raw_attrs=false);
- int put_entry(const DoutPrefixProvider *dpp,
- RGWSI_MetaBackend::Context *ctx,
- const std::string& key,
- RGWSI_MetaBackend::PutParams& _params,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y);
-};
-
-
enum RGWSI_META_BE_TYPES {
SOBJ = 1,
- OTP = 2,
BUCKET = 3,
BI = 4,
USER = 5,
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab ft=cpp
-
-#include "svc_otp.h"
-#include "svc_zone.h"
-#include "svc_meta.h"
-#include "svc_meta_be_sobj.h"
-
-#include "rgw_zone.h"
-
-#define dout_subsys ceph_subsys_rgw
-
-using namespace std;
-
-class RGW_MB_Handler_Module_OTP : public RGWSI_MBSObj_Handler_Module {
- RGWSI_Zone *zone_svc;
- string prefix;
-public:
- RGW_MB_Handler_Module_OTP(RGWSI_Zone *_zone_svc) : RGWSI_MBSObj_Handler_Module("otp"),
- zone_svc(_zone_svc) {}
-
- void get_pool_and_oid(const string& key, rgw_pool *pool, string *oid) override {
- if (pool) {
- *pool = zone_svc->get_zone_params().otp_pool;
- }
-
- if (oid) {
- *oid = key;
- }
- }
-
- const string& get_oid_prefix() override {
- return prefix;
- }
-
- bool is_valid_oid(const string& oid) override {
- return true;
- }
-
- string key_to_oid(const string& key) override {
- return key;
- }
-
- string oid_to_key(const string& oid) override {
- return oid;
- }
-};
-
-RGWSI_OTP::RGWSI_OTP(CephContext *cct): RGWServiceInstance(cct) {
-}
-
-RGWSI_OTP::~RGWSI_OTP() {
-}
-
-void RGWSI_OTP::init(RGWSI_Zone *_zone_svc,
- RGWSI_Meta *_meta_svc,
- RGWSI_MetaBackend *_meta_be_svc)
-{
- svc.otp = this;
- svc.zone = _zone_svc;
- svc.meta = _meta_svc;
- svc.meta_be = _meta_be_svc;
-}
-
-int RGWSI_OTP::do_start(optional_yield, const DoutPrefixProvider *dpp)
-{
- /* create first backend handler for bucket entrypoints */
-
- RGWSI_MetaBackend_Handler *_otp_be_handler;
-
- int r = svc.meta->create_be_handler(RGWSI_MetaBackend::Type::MDBE_OTP, &_otp_be_handler);
- if (r < 0) {
- ldout(ctx(), 0) << "ERROR: failed to create be handler: r=" << r << dendl;
- return r;
- }
-
- be_handler = _otp_be_handler;
-
- RGWSI_MetaBackend_Handler_OTP *otp_be_handler = static_cast<RGWSI_MetaBackend_Handler_OTP *>(_otp_be_handler);
-
- auto otp_be_module = new RGW_MB_Handler_Module_OTP(svc.zone);
- be_module.reset(otp_be_module);
- otp_be_handler->set_module(otp_be_module);
-
- return 0;
-}
-
-int RGWSI_OTP::read_all(RGWSI_OTP_BE_Ctx& ctx,
- const string& key,
- otp_devices_list_t *devices,
- real_time *pmtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y, const DoutPrefixProvider *dpp)
-{
- RGWSI_MBOTP_GetParams params;
- params.pdevices = devices;
- params.pmtime = pmtime;
-
- int ret = svc.meta_be->get_entry(ctx.get(), key, params, objv_tracker, y, dpp);
- if (ret < 0) {
- return ret;
- }
-
- return 0;
-}
-
-int RGWSI_OTP::read_all(RGWSI_OTP_BE_Ctx& ctx,
- const rgw_user& uid,
- otp_devices_list_t *devices,
- real_time *pmtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y,
- const DoutPrefixProvider *dpp)
-{
- return read_all(ctx,
- uid.to_str(),
- devices,
- pmtime,
- objv_tracker,
- y,
- dpp);
-}
-
-int RGWSI_OTP::store_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const string& key,
- const otp_devices_list_t& devices,
- real_time mtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y)
-{
- RGWSI_MBOTP_PutParams params;
- params.mtime = mtime;
- params.devices = devices;
-
- int ret = svc.meta_be->put_entry(dpp, ctx.get(), key, params, objv_tracker, y);
- if (ret < 0) {
- return ret;
- }
-
- return 0;
-}
-
-int RGWSI_OTP::store_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const rgw_user& uid,
- const otp_devices_list_t& devices,
- real_time mtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y)
-{
- return store_all(dpp, ctx,
- uid.to_str(),
- devices,
- mtime,
- objv_tracker,
- y);
-}
-
-int RGWSI_OTP::remove_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const string& key,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y)
-{
- RGWSI_MBOTP_RemoveParams params;
-
- int ret = svc.meta_be->remove_entry(dpp, ctx.get(), key, params, objv_tracker, y);
- if (ret < 0) {
- return ret;
- }
-
- return 0;
-}
-
-int RGWSI_OTP::remove_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const rgw_user& uid,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y)
-{
- return remove_all(dpp,ctx,
- uid.to_str(),
- objv_tracker,
- y);
-}
+++ /dev/null
-
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab ft=cpp
-
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation. See file COPYING.
- *
- */
-
-
-#pragma once
-
-#include "cls/otp/cls_otp_types.h"
-
-#include "rgw_service.h"
-
-#include "svc_otp_types.h"
-#include "svc_meta_be_otp.h"
-
-class RGWSI_Zone;
-
-class RGWSI_OTP : public RGWServiceInstance
-{
- RGWSI_OTP_BE_Handler be_handler;
- std::unique_ptr<RGWSI_MetaBackend::Module> be_module;
-
- int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
-
-public:
- struct Svc {
- RGWSI_OTP *otp{nullptr};
- RGWSI_Zone *zone{nullptr};
- RGWSI_Meta *meta{nullptr};
- RGWSI_MetaBackend *meta_be{nullptr};
- } svc;
-
- RGWSI_OTP(CephContext *cct);
- ~RGWSI_OTP();
-
- RGWSI_OTP_BE_Handler& get_be_handler() {
- return be_handler;
- }
-
- void init(RGWSI_Zone *_zone_svc,
- RGWSI_Meta *_meta_svc,
- RGWSI_MetaBackend *_meta_be_svc);
-
- int read_all(RGWSI_OTP_BE_Ctx& ctx,
- const std::string& key,
- otp_devices_list_t *devices,
- real_time *pmtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y,
- const DoutPrefixProvider *dpp);
- int read_all(RGWSI_OTP_BE_Ctx& ctx,
- const rgw_user& uid,
- otp_devices_list_t *devices,
- real_time *pmtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y,
- const DoutPrefixProvider *dpp);
- int store_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const std::string& key,
- const otp_devices_list_t& devices,
- real_time mtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y);
- int store_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const rgw_user& uid,
- const otp_devices_list_t& devices,
- real_time mtime,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y);
- int remove_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const std::string& key,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y);
- int remove_all(const DoutPrefixProvider *dpp,
- RGWSI_OTP_BE_Ctx& ctx,
- const rgw_user& uid,
- RGWObjVersionTracker *objv_tracker,
- optional_yield y);
-};
-
-
+++ /dev/null
-
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab ft=cpp
-
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation. See file COPYING.
- *
- */
-
-
-#pragma once
-
-#include "common/ptr_wrapper.h"
-
-#include "svc_meta_be.h"
-#include "svc_meta_be_types.h"
-
-class RGWSI_MetaBackend_Handler;
-
-using RGWSI_OTP_BE_Handler = ptr_wrapper<RGWSI_MetaBackend_Handler, RGWSI_META_BE_TYPES::OTP>;
-using RGWSI_OTP_BE_Ctx = ptr_wrapper<RGWSI_MetaBackend::Context, RGWSI_META_BE_TYPES::OTP>;
-