]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | ||
3 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | |
4 | // vim: ts=8 sw=2 smarttab ft=cpp | |
5 | ||
6 | /* | |
7 | * Ceph - scalable distributed file system | |
8 | * | |
9 | * Copyright (C) 2019 Red Hat, Inc. | |
10 | * | |
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. | |
15 | * | |
16 | */ | |
17 | ||
18 | ||
19 | #pragma once | |
20 | ||
21 | #include "rgw/rgw_service.h" | |
22 | ||
23 | #include "svc_cls.h" | |
24 | #include "svc_meta_be.h" | |
25 | #include "svc_meta_be_sobj.h" | |
26 | #include "svc_sys_obj.h" | |
27 | ||
28 | ||
29 | using RGWSI_MBOTP_Handler_Module = RGWSI_MBSObj_Handler_Module; | |
30 | using RGWSI_MetaBackend_Handler_OTP = RGWSI_MetaBackend_Handler_SObj; | |
31 | ||
32 | using otp_devices_list_t = list<rados::cls::otp::otp_info_t>; | |
33 | ||
34 | struct RGWSI_MBOTP_GetParams : public RGWSI_MetaBackend::GetParams { | |
35 | otp_devices_list_t *pdevices{nullptr}; | |
36 | }; | |
37 | ||
38 | struct RGWSI_MBOTP_PutParams : public RGWSI_MetaBackend::PutParams { | |
39 | otp_devices_list_t devices; | |
40 | }; | |
41 | ||
42 | using RGWSI_MBOTP_RemoveParams = RGWSI_MBSObj_RemoveParams; | |
43 | ||
44 | class RGWSI_MetaBackend_OTP : public RGWSI_MetaBackend_SObj | |
45 | { | |
46 | RGWSI_Cls *cls_svc{nullptr}; | |
47 | ||
48 | public: | |
49 | struct Context_OTP : public RGWSI_MetaBackend_SObj::Context_SObj { | |
50 | otp_devices_list_t devices; | |
51 | ||
52 | Context_OTP(RGWSI_SysObj*_sysobj_svc) : RGWSI_MetaBackend_SObj::Context_SObj(_sysobj_svc, nullptr) {} | |
53 | }; | |
54 | ||
55 | RGWSI_MetaBackend_OTP(CephContext *cct); | |
56 | virtual ~RGWSI_MetaBackend_OTP(); | |
57 | ||
58 | RGWSI_MetaBackend::Type get_type() { | |
59 | return MDBE_OTP; | |
60 | } | |
61 | ||
62 | static string get_meta_key(const rgw_user& user); | |
63 | ||
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); | |
68 | cls_svc = _cls_svc; | |
69 | } | |
70 | ||
71 | RGWSI_MetaBackend_Handler *alloc_be_handler() override; | |
72 | RGWSI_MetaBackend::Context *alloc_ctx() override; | |
73 | ||
74 | int call_with_get_params(ceph::real_time *pmtime, std::function<int(RGWSI_MetaBackend::GetParams&)> cb) override; | |
75 | ||
76 | int get_entry(RGWSI_MetaBackend::Context *ctx, | |
77 | const string& key, | |
78 | RGWSI_MetaBackend::GetParams& _params, | |
79 | RGWObjVersionTracker *objv_tracker, | |
80 | optional_yield y); | |
81 | int put_entry(RGWSI_MetaBackend::Context *ctx, | |
82 | const string& key, | |
83 | RGWSI_MetaBackend::PutParams& _params, | |
84 | RGWObjVersionTracker *objv_tracker, | |
85 | optional_yield y); | |
86 | }; | |
87 | ||
88 |