3 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
4 // vim: ts=8 sw=2 smarttab ft=cpp
7 * Ceph - scalable distributed file system
9 * Copyright (C) 2019 Red Hat, Inc.
11 * This is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License version 2.1, as published by the Free Software
14 * Foundation. See file COPYING.
21 #include "rgw/rgw_service.h"
24 #include "svc_meta_be.h"
25 #include "svc_meta_be_sobj.h"
26 #include "svc_sys_obj.h"
29 using RGWSI_MBOTP_Handler_Module
= RGWSI_MBSObj_Handler_Module
;
30 using RGWSI_MetaBackend_Handler_OTP
= RGWSI_MetaBackend_Handler_SObj
;
32 using otp_devices_list_t
= list
<rados::cls::otp::otp_info_t
>;
34 struct RGWSI_MBOTP_GetParams
: public RGWSI_MetaBackend::GetParams
{
35 otp_devices_list_t
*pdevices
{nullptr};
38 struct RGWSI_MBOTP_PutParams
: public RGWSI_MetaBackend::PutParams
{
39 otp_devices_list_t devices
;
42 using RGWSI_MBOTP_RemoveParams
= RGWSI_MBSObj_RemoveParams
;
44 class RGWSI_MetaBackend_OTP
: public RGWSI_MetaBackend_SObj
46 RGWSI_Cls
*cls_svc
{nullptr};
49 struct Context_OTP
: public RGWSI_MetaBackend_SObj::Context_SObj
{
50 otp_devices_list_t devices
;
52 Context_OTP(RGWSI_SysObj
*_sysobj_svc
) : RGWSI_MetaBackend_SObj::Context_SObj(_sysobj_svc
, nullptr) {}
55 RGWSI_MetaBackend_OTP(CephContext
*cct
);
56 virtual ~RGWSI_MetaBackend_OTP();
58 RGWSI_MetaBackend::Type
get_type() {
62 static string
get_meta_key(const rgw_user
& user
);
64 void init(RGWSI_SysObj
*_sysobj_svc
,
65 RGWSI_MDLog
*_mdlog_svc
,
66 RGWSI_Cls
*_cls_svc
) {
67 RGWSI_MetaBackend_SObj::init(_sysobj_svc
, _mdlog_svc
);
71 RGWSI_MetaBackend_Handler
*alloc_be_handler() override
;
72 RGWSI_MetaBackend::Context
*alloc_ctx() override
;
74 int call_with_get_params(ceph::real_time
*pmtime
, std::function
<int(RGWSI_MetaBackend::GetParams
&)> cb
) override
;
76 int get_entry(RGWSI_MetaBackend::Context
*ctx
,
78 RGWSI_MetaBackend::GetParams
& _params
,
79 RGWObjVersionTracker
*objv_tracker
,
81 int put_entry(RGWSI_MetaBackend::Context
*ctx
,
83 RGWSI_MetaBackend::PutParams
& _params
,
84 RGWObjVersionTracker
*objv_tracker
,