]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_role: define RGWRoleCtl
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 30 Sep 2020 13:50:39 +0000 (15:50 +0200)
committerPritha Srivastava <prsrivas@redhat.com>
Thu, 1 Sep 2022 07:47:22 +0000 (13:17 +0530)
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 150f78b2d6cd8fae224af1bc0c75b2d581393148)

src/rgw/rgw_role.cc
src/rgw/rgw_role.h

index af7f7f6f8fd0deac7296a634dd4f620cafd64691..dd0114d5a84f754b97394972f724c4c345780e39 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "services/svc_zone.h"
 #include "services/svc_sys_obj.h"
+#include "services/svc_role.h"
 
 #define dout_subsys ceph_subsys_rgw
 
@@ -230,5 +231,143 @@ const string& RGWRole::get_path_oid_prefix()
 {
   return role_path_oid_prefix;
 }
-
 } } // namespace rgw::sal
+
+int RGWRoleCtl::store_info(const rgw::sal::RGWRole* role,
+                          optional_yield y,
+         const DoutPrefixProvider *dpp,
+                          const PutParams& params)
+{
+  return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->store_info(op->ctx(),
+                               *role,
+                               params.objv_tracker,
+                               params.mtime,
+                               params.exclusive,
+                               params.attrs,
+                               y, dpp);
+  });
+}
+
+int RGWRoleCtl::store_name(const std::string& role_id,
+                          const std::string& name,
+                          const std::string& tenant,
+                          optional_yield y,
+         const DoutPrefixProvider *dpp,
+                          const PutParams& params)
+{
+  return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->store_name(op->ctx(),
+                               role_id,
+                               name,
+                               tenant,
+                               params.objv_tracker,
+                               params.mtime,
+                               params.exclusive,
+                               y, dpp);
+  });
+}
+
+int RGWRoleCtl::store_path(const std::string& role_id,
+                          const std::string& path,
+                          const std::string& tenant,
+                          optional_yield y,
+         const DoutPrefixProvider *dpp,
+                          const PutParams& params)
+{
+  return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->store_path(op->ctx(),
+                               role_id,
+                               path,
+                               tenant,
+                               params.objv_tracker,
+                               params.mtime,
+                               params.exclusive,
+                               y, dpp);
+  });
+}
+
+int
+RGWRoleCtl::read_info(const std::string& role_id,
+                     optional_yield y,
+          const DoutPrefixProvider *dpp,
+          rgw::sal::RGWRole* info,
+                     const GetParams& params)
+{
+  int ret = be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->read_info(op->ctx(),
+                              role_id,
+                              info,
+                              params.objv_tracker,
+                              params.mtime,
+                              params.attrs,
+                              y, dpp);
+  });
+  return ret;
+}
+
+std::pair<int, std::string>
+RGWRoleCtl::read_name(const std::string& name,
+                     const std::string& tenant,
+                     optional_yield y,
+          const DoutPrefixProvider *dpp,
+                     const GetParams& params)
+{
+  std::string role_id;
+  int ret = be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->read_name(op->ctx(),
+                              name,
+                              tenant,
+                              role_id,
+                              params.objv_tracker,
+                              params.mtime,
+                              y, dpp);
+  });
+  return make_pair(ret, role_id);
+}
+
+int RGWRoleCtl::delete_info(const std::string& role_id,
+                           optional_yield y,
+          const DoutPrefixProvider *dpp,
+                           const RemoveParams& params)
+{
+  return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->delete_info(op->ctx(),
+                                role_id,
+                                params.objv_tracker,
+                                y, dpp);
+  });
+}
+
+int RGWRoleCtl::delete_name(const std::string& name,
+                           const std::string& tenant,
+                           optional_yield y,
+          const DoutPrefixProvider *dpp,
+                           const RemoveParams& params)
+{
+  return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->delete_name(op->ctx(),
+                                name,
+                                tenant,
+                                params.objv_tracker,
+                                y, dpp);
+  });
+}
+
+int RGWRoleCtl::delete_path(const std::string& role_id,
+                           const std::string& path,
+                           const std::string& tenant,
+                           optional_yield y,
+          const DoutPrefixProvider *dpp,
+                           const RemoveParams& params)
+{
+  return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
+    return svc.role->delete_path(op->ctx(),
+                                role_id,
+                                path,
+                                tenant,
+                                params.objv_tracker,
+                                y, dpp);
+  });
+}
+
index 5669e0c06a7a4ab4fb0388286d36d5b710afa8e3..c1ac9a8756c64bf0da2034a58d7c7fb0465ec7b1 100644 (file)
 
 #include "common/ceph_json.h"
 #include "common/ceph_context.h"
-
 #include "rgw/rgw_rados.h"
+//#include "svc_meta_be.h"
 
 class RGWRados;
+class RGWRoleMetadataHandler;
+class RGWSI_Role;
+class RGWSI_MetaBackend_Handler;
 
 namespace rgw { namespace sal {
 class RGWRole
@@ -138,10 +141,7 @@ public:
   static const std::string& get_path_oid_prefix();
 };
 WRITE_CLASS_ENCODER(RGWRole)
-
-class RGWRoleMetadataHandler;
-class RGWSI_Role;
-class RGWSI_MetaBackend_Handler;
+} } // namespace rgw::sal
 
 class RGWRoleCtl {
   struct Svc {
@@ -159,12 +159,110 @@ public:
     RGWObjVersionTracker *objv_tracker {nullptr};
     std::map<std::string, bufferlist> *attrs {nullptr};
 
-    PutParams() {};
+    PutParams() {}
+
+    PutParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) {
+      objv_tracker = _objv_tracker;
+      return *this;
+    }
+
+    PutParams& set_mtime(const ceph::real_time& _mtime) {
+      mtime = _mtime;
+      return *this;
+    }
+
+    PutParams& set_exclusive(bool _exclusive) {
+      exclusive = _exclusive;
+      return *this;
+    }
+
+    PutParams& set_attrs(std::map<std::string, bufferlist> *_attrs) {
+      attrs = _attrs;
+      return *this;
+    }
+  };
+
+  struct GetParams {
+    ceph::real_time *mtime{nullptr};
+    std::map<std::string, bufferlist> *attrs{nullptr};
+    RGWObjVersionTracker *objv_tracker {nullptr};
+
+    GetParams() {}
+
+    GetParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) {
+      objv_tracker = _objv_tracker;
+      return *this;
+    }
+
+    GetParams& set_mtime(ceph::real_time *_mtime) {
+      mtime = _mtime;
+      return *this;
+    }
+
+    GetParams& set_attrs(std::map<std::string, bufferlist> *_attrs) {
+      attrs = _attrs;
+      return *this;
+    }
   };
 
-  int store_info(const RGWRole& role,
+  struct RemoveParams {
+    RGWObjVersionTracker *objv_tracker{nullptr};
+
+    RemoveParams() {}
+
+    RemoveParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) {
+      objv_tracker = _objv_tracker;
+      return *this;
+    }
+  };
+
+  int store_info(const rgw::sal::RGWRole* role,
+                optional_yield y,
+     const DoutPrefixProvider *dpp,
+                const PutParams& params = {});
+
+  int store_name(const std::string& role_id,
+                const std::string& name,
+                const std::string& tenant,
+                optional_yield y,
+     const DoutPrefixProvider *dpp,
+                const PutParams& params = {});
+
+  int store_path(const std::string& role_id,
+                const std::string& path,
+                const std::string& tenant,
                 optional_yield y,
+     const DoutPrefixProvider *dpp,
                 const PutParams& params = {});
+
+  int read_info(const std::string& role_id,
+                                       optional_yield y,
+          const DoutPrefixProvider *dpp,
+          rgw::sal::RGWRole* role,
+                                       const GetParams& params = {});
+
+  std::pair<int, std::string> read_name(const std::string& name,
+                                  const std::string& tenant,
+                                  optional_yield y,
+           const DoutPrefixProvider *dpp,
+                                  const GetParams& params = {});
+
+  int delete_info(const std::string& role_id,
+                 optional_yield y,
+      const DoutPrefixProvider *dpp,
+                 const RemoveParams& params = {});
+
+  int delete_name(const std::string& name,
+                 const std::string& tenant,
+                 optional_yield y,
+      const DoutPrefixProvider *dpp,
+                 const RemoveParams& params = {});
+
+  int delete_path(const std::string& role_id,
+                 const std::string& path,
+                 const std::string& tenant,
+                 optional_yield y,
+      const DoutPrefixProvider *dpp,
+                 const RemoveParams& params = {});
 };
-} } // namespace rgw::sal
 #endif /* CEPH_RGW_ROLE_H */