]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_role: remove unrelated functions
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 21 Oct 2020 11:46:00 +0000 (13:46 +0200)
committerPritha Srivastava <prsrivas@redhat.com>
Mon, 6 Jun 2022 10:49:42 +0000 (16:19 +0530)
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_role.cc
src/rgw/rgw_role.h

index db85adb78d74b50aa2fe52848c189802cac5a649..3dd64a4812de8fbc2bf6385611b099912d243ff7 100644 (file)
@@ -37,34 +37,7 @@ const string RGWRole::role_arn_prefix = "arn:aws:iam::";
 int RGWRole::store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
 {
   RGWObjVersionTracker objv_tracker;
-  return role_ctl->store_info(this,
-                             y,
-            dpp,
-                             RGWRoleCtl::PutParams().
-                             set_exclusive(exclusive).
-                             set_objv_tracker(&objv_tracker));
-}
-
-int RGWRole::store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
-{
-  RGWObjVersionTracker objv_tracker;
-  return role_ctl->store_name(id,
-                             name,
-                             tenant,
-                             y,
-            dpp,
-                             RGWRoleCtl::PutParams().
-                             set_exclusive(exclusive).
-                             set_objv_tracker(&objv_tracker)
-                             );
-}
-
-int RGWRole::store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
-{
-  RGWObjVersionTracker objv_tracker;
-  return role_ctl->store_path(id,
-                             path,
-                             tenant,
+  return role_ctl->store_info(*this,
                              y,
             dpp,
                              RGWRoleCtl::PutParams().
@@ -416,14 +389,14 @@ int RGWRoleCtl::create(rgw::sal::RGWRole& role,
   });
 }
 
-int RGWRoleCtl::store_info(const rgw::sal::RGWRole* role,
+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,
+                               role,
                                params.objv_tracker,
                                params.mtime,
                                params.exclusive,
@@ -509,14 +482,14 @@ RGWRoleCtl::read_name(const std::string& name,
   return make_pair(ret, role_id);
 }
 
-int RGWRoleCtl::delete_info(const rgw::sal::RGWRole& info,
+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(),
-                                info.get_id(),
+                                role_id,
                                 params.objv_tracker,
                                 y, dpp);
   });
@@ -627,7 +600,14 @@ int RGWRoleMetadataHandler::do_remove(RGWSI_MetaBackend_Handler::Op *op,
                                       optional_yield y,
                                       const DoutPrefixProvider *dpp)
 {
-  return svc.role->delete_info(op->ctx(), entry, &objv_tracker, y, dpp);
+  rgw::sal::RGWRole info;
+  real_time _mtime;
+  int ret = svc.role->read_info(op->ctx(), entry, &info, &objv_tracker,
+                               &_mtime, nullptr, y, dpp);
+  if (ret < 0) {
+    return ret == -ENOENT ? 0 : ret;
+  }
+  return svc.role->delete_role(op->ctx(), info, &objv_tracker, y, dpp);
 }
 
 class RGWMetadataHandlerPut_Role : public RGWMetadataHandlerPut_SObj
index 7d55c21280749ac85ddac08e42e277f4d48c3e09..1b33089b30e855dfc45f1d006496f014a362634a 100644 (file)
@@ -49,8 +49,8 @@ protected:
 
 public:
   virtual int store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
-  virtual int store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
-  virtual int store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
+  virtual int store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { return 0; }
+  virtual int store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { return 0; }
   virtual int read_id(const DoutPrefixProvider *dpp, const std::string& role_name, const std::string& tenant, std::string& role_id, optional_yield y);
   virtual int read_name(const DoutPrefixProvider *dpp, optional_yield y);
   virtual int read_info(const DoutPrefixProvider *dpp, optional_yield y);
@@ -293,16 +293,20 @@ public:
     }
   };
 
-  int store_info(const rgw::sal::RGWRole* role,
-                optional_yield y,
-     const DoutPrefixProvider *dpp,
-                const PutParams& params = {});
 
   int create(rgw::sal::RGWRole& role,
             optional_yield y,
        const DoutPrefixProvider *dpp,
             const PutParams& params = {});
 
+  int store_info(const rgw::sal::RGWRole& role,
+                optional_yield y,
+     const DoutPrefixProvider *dpp,
+                const PutParams& params = {});
+
+  // The methods for store name & store path are currently unused and only
+  // useful for a potential rename name/path functionality in the future as
+  // create role would automatically create these for most uses
   int store_name(const std::string& role_id,
                 const std::string& name,
                 const std::string& tenant,
@@ -329,7 +333,7 @@ public:
            const DoutPrefixProvider *dpp,
                                   const GetParams& params = {});
 
-  int delete_info(const rgw::sal::RGWRole& info,
+  int delete_info(const std::string& role_id,
                  optional_yield y,
       const DoutPrefixProvider *dpp,
                  const RemoveParams& params = {});