]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW - Zipper 10: Pull The Thread
authorDaniel Gryniewicz <dang@redhat.com>
Mon, 18 Jan 2021 17:25:39 +0000 (12:25 -0500)
committerDaniel Gryniewicz <dang@redhat.com>
Tue, 2 Mar 2021 12:35:05 +0000 (07:35 -0500)
This commit changes the RGWStoreManager to return a RGWStore* rather
than a RGWRadosStore*.  This is the thread that unravels the rest of the
Zipper work, removing hard-coded uses of the RGWRados* classes.

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
119 files changed:
src/rgw/librgw.cc
src/rgw/rgw_acl_s3.cc
src/rgw/rgw_acl_s3.h
src/rgw/rgw_acl_swift.cc
src/rgw/rgw_acl_swift.h
src/rgw/rgw_admin.cc
src/rgw/rgw_admin_user.h
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_asio_frontend.h
src/rgw/rgw_basic_types.h
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket.h
src/rgw/rgw_civetweb_frontend.cc
src/rgw/rgw_cr_tools.cc
src/rgw/rgw_cr_tools.h
src/rgw/rgw_data_sync.h
src/rgw/rgw_file.cc
src/rgw/rgw_file.h
src/rgw/rgw_frontend.h
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_lib.h
src/rgw/rgw_loadgen_process.cc
src/rgw/rgw_log.cc
src/rgw/rgw_log.h
src/rgw/rgw_lua.cc
src/rgw/rgw_lua.h
src/rgw/rgw_lua_request.cc
src/rgw/rgw_lua_request.h
src/rgw/rgw_main.cc
src/rgw/rgw_metadata.h
src/rgw/rgw_multi.cc
src/rgw/rgw_multi.h
src/rgw/rgw_notify.cc
src/rgw/rgw_notify.h
src/rgw/rgw_object_expirer.cc
src/rgw/rgw_object_expirer_core.cc
src/rgw/rgw_object_expirer_core.h
src/rgw/rgw_oidc_provider.cc
src/rgw/rgw_oidc_provider.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_orphan.cc
src/rgw/rgw_orphan.h
src/rgw/rgw_os_lib.cc
src/rgw/rgw_otp.h
src/rgw/rgw_period_pusher.cc
src/rgw/rgw_period_pusher.h
src/rgw/rgw_process.cc
src/rgw/rgw_process.h
src/rgw/rgw_pubsub.h
src/rgw/rgw_putobj.h
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_putobj_processor.h
src/rgw/rgw_quota.cc
src/rgw/rgw_quota.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_realm_reloader.cc
src/rgw/rgw_realm_reloader.h
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_bucket.cc
src/rgw/rgw_rest_bucket.h
src/rgw/rgw_rest_config.cc
src/rgw/rgw_rest_config.h
src/rgw/rgw_rest_conn.cc
src/rgw/rgw_rest_conn.h
src/rgw/rgw_rest_iam.cc
src/rgw/rgw_rest_iam.h
src/rgw/rgw_rest_log.cc
src/rgw/rgw_rest_log.h
src/rgw/rgw_rest_metadata.cc
src/rgw/rgw_rest_metadata.h
src/rgw/rgw_rest_oidc_provider.cc
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_rest_pubsub_common.cc
src/rgw/rgw_rest_realm.cc
src/rgw/rgw_rest_realm.h
src/rgw/rgw_rest_role.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h
src/rgw/rgw_rest_s3website.h
src/rgw/rgw_rest_sts.cc
src/rgw/rgw_rest_sts.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h
src/rgw/rgw_rest_usage.cc
src/rgw/rgw_rest_usage.h
src/rgw/rgw_rest_user.cc
src/rgw/rgw_rest_user.h
src/rgw/rgw_rest_user_policy.cc
src/rgw/rgw_role.cc
src/rgw/rgw_role.h
src/rgw/rgw_sal.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h
src/rgw/rgw_sts.cc
src/rgw/rgw_sts.h
src/rgw/rgw_swift_auth.cc
src/rgw/rgw_swift_auth.h
src/rgw/rgw_sync_module_es.cc
src/rgw/rgw_sync_module_es_rest.cc
src/rgw/rgw_sync_module_es_rest.h
src/rgw/rgw_sync_module_pubsub.cc
src/rgw/rgw_sync_module_pubsub_rest.cc
src/rgw/rgw_sync_module_pubsub_rest.h
src/rgw/rgw_tools.cc
src/rgw/rgw_tools.h
src/rgw/rgw_torrent.cc
src/rgw/rgw_torrent.h
src/rgw/rgw_trim_bilog.cc
src/rgw/rgw_usage.cc
src/rgw/rgw_usage.h
src/rgw/rgw_user.cc
src/rgw/rgw_user.h
src/rgw/rgw_zone.cc
src/rgw/rgw_zone.h

index 82f985712c563b6d7bc7317571e8dbd4c7e2623a..a32a083a56af51f0e265becfedfb8253d801040f 100644 (file)
@@ -236,7 +236,7 @@ namespace rgw {
 
     RGWObjectCtx rados_ctx(store, s); // XXX holds std::map
 
-    auto sysobj_ctx = store->svc()->sysobj->init_obj_ctx();
+    auto sysobj_ctx = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj->init_obj_ctx();
     s->sysobj_ctx = &sysobj_ctx;
 
     /* XXX and -then- stash req_state pointers everywhere they are needed */
@@ -336,7 +336,7 @@ namespace rgw {
               << e.what() << dendl;
     }
     if (should_log) {
-      rgw_log_op(store->getRados(), nullptr /* !rest */, s,
+      rgw_log_op(store, nullptr /* !rest */, s,
                 (op ? op->name() : "unknown"), olog);
     }
 
@@ -540,6 +540,7 @@ namespace rgw {
 
     const DoutPrefix dp(cct.get(), dout_subsys, "librgw: ");
     store = RGWStoreManager::get_storage(&dp, g_ceph_context,
+                                        "rados",
                                         run_gc,
                                         run_lc,
                                         run_quota,
@@ -558,7 +559,7 @@ namespace rgw {
 
     r = rgw_perf_start(g_ceph_context);
 
-    rgw_rest_init(g_ceph_context, store->svc()->zone->get_zonegroup());
+    rgw_rest_init(g_ceph_context, store->get_zonegroup());
 
     mutex.lock();
     init_timer.cancel_all_events();
@@ -581,7 +582,7 @@ namespace rgw {
     ldh->init();
     ldh->bind();
 
-    rgw_log_usage_init(g_ceph_context, store->getRados());
+    rgw_log_usage_init(g_ceph_context, store);
 
     // XXX ex-RGWRESTMgr_lib, mgr->set_logging(true)
 
@@ -613,7 +614,7 @@ namespace rgw {
 
     fe->run();
 
-    r = store->getRados()->register_to_service_map("rgw-nfs", service_map_meta);
+    r = store->register_to_service_map("rgw-nfs", service_map_meta);
     if (r < 0) {
       derr << "ERROR: failed to register to service map: " << cpp_strerror(-r) << dendl;
       /* ignore error */
@@ -656,14 +657,17 @@ namespace rgw {
     return 0;
   } /* RGWLib::stop() */
 
-  int RGWLibIO::set_uid(rgw::sal::RGWRadosStore *store, const rgw_user& uid)
+  int RGWLibIO::set_uid(rgw::sal::RGWStore *store, const rgw_user& uid)
   {
     const DoutPrefix dp(store->ctx(), dout_subsys, "librgw: ");
-    int ret = store->ctl()->user->get_info_by_uid(&dp, uid, &user_info, null_yield);
+    std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(uid);
+    /* object exists, but policy is broken */
+    int ret = user->load_by_id(&dp, null_yield);
     if (ret < 0) {
       derr << "ERROR: failed reading user info: uid=" << uid << " ret="
           << ret << dendl;
     }
+    user_info = user->get_info();
     return ret;
   }
 
index ed91f812509b19964d966cab39bbc6cbd4ce10ff..077c71734cb290cd2ea410487ba8f850d1fb1f67 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "rgw_acl_s3.h"
 #include "rgw_user.h"
+#include "rgw_sal.h"
 
 #define dout_subsys ceph_subsys_rgw
 
@@ -290,15 +291,13 @@ static const char *get_acl_header(const RGWEnv *env,
   return env->get(header, NULL);
 }
 
-static int parse_grantee_str(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, string& grantee_str,
+static int parse_grantee_str(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store, string& grantee_str,
         const struct s3_acl_header *perm, ACLGrant& grant)
 {
   string id_type, id_val_quoted;
   int rgw_perm = perm->rgw_perm;
   int ret;
 
-  RGWUserInfo info;
-
   ret = parse_key_value(grantee_str, id_type, id_val_quoted);
   if (ret < 0)
     return ret;
@@ -306,18 +305,19 @@ static int parse_grantee_str(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl
   string id_val = rgw_trim_quotes(id_val_quoted);
 
   if (strcasecmp(id_type.c_str(), "emailAddress") == 0) {
-    ret = user_ctl->get_info_by_email(dpp, id_val, &info, null_yield);
+    std::unique_ptr<rgw::sal::RGWUser> user;
+    ret = store->get_user_by_email(dpp, id_val, null_yield, &user);
     if (ret < 0)
       return ret;
 
-    grant.set_canon(info.user_id, info.display_name, rgw_perm);
+    grant.set_canon(user->get_id(), user->get_display_name(), rgw_perm);
   } else if (strcasecmp(id_type.c_str(), "id") == 0) {
-    rgw_user user(id_val);
-    ret = user_ctl->get_info_by_uid(dpp, user, &info, null_yield);
+    std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(id_val));
+    ret = user->load_by_id(dpp, null_yield);
     if (ret < 0)
       return ret;
 
-    grant.set_canon(info.user_id, info.display_name, rgw_perm);
+    grant.set_canon(user->get_id(), user->get_display_name(), rgw_perm);
   } else if (strcasecmp(id_type.c_str(), "uri") == 0) {
     ACLGroupTypeEnum gid = grant.uri_to_group(id_val);
     if (gid == ACL_GROUP_NONE)
@@ -331,8 +331,9 @@ static int parse_grantee_str(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl
   return 0;
 }
 
-static int parse_acl_header(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const RGWEnv *env,
-         const struct s3_acl_header *perm, std::list<ACLGrant>& _grants)
+static int parse_acl_header(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                           const RGWEnv *env, const struct s3_acl_header *perm,
+                           std::list<ACLGrant>& _grants)
 {
   std::list<string> grantees;
   std::string hacl_str;
@@ -346,7 +347,7 @@ static int parse_acl_header(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl,
 
   for (list<string>::iterator it = grantees.begin(); it != grantees.end(); ++it) {
     ACLGrant grant;
-    int ret = parse_grantee_str(dpp, user_ctl, *it, perm, grant);
+    int ret = parse_grantee_str(dpp, store, *it, perm, grant);
     if (ret < 0)
       return ret;
 
@@ -451,13 +452,15 @@ static const s3_acl_header acl_header_perms[] = {
   {0, NULL}
 };
 
-int RGWAccessControlPolicy_S3::create_from_headers(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const RGWEnv *env, ACLOwner& _owner)
+int RGWAccessControlPolicy_S3::create_from_headers(const DoutPrefixProvider *dpp,
+                                                  rgw::sal::RGWStore* store,
+                                                  const RGWEnv *env, ACLOwner& _owner)
 {
   std::list<ACLGrant> grants;
   int r = 0;
 
   for (const struct s3_acl_header *p = acl_header_perms; p->rgw_perm; p++) {
-    r = parse_acl_header(dpp, user_ctl, env, p, grants);
+    r = parse_acl_header(dpp, store, env, p, grants);
     if (r < 0) {
       return r;
     }
@@ -474,8 +477,9 @@ int RGWAccessControlPolicy_S3::create_from_headers(const DoutPrefixProvider *dpp
 /*
   can only be called on object that was parsed
  */
-int RGWAccessControlPolicy_S3::rebuild(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, ACLOwner *owner, RGWAccessControlPolicy& dest,
-                                       std::string &err_msg)
+int RGWAccessControlPolicy_S3::rebuild(const DoutPrefixProvider *dpp,
+                                      rgw::sal::RGWStore* store, ACLOwner *owner,
+                                      RGWAccessControlPolicy& dest, std::string &err_msg)
 {
   if (!owner)
     return -EINVAL;
@@ -487,15 +491,15 @@ int RGWAccessControlPolicy_S3::rebuild(const DoutPrefixProvider *dpp, RGWUserCtl
       return -EPERM;
   }
 
-  RGWUserInfo owner_info;
-  if (user_ctl->get_info_by_uid(dpp, owner->get_id(), &owner_info, null_yield) < 0) {
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(owner->get_id());
+  if (user->load_by_id(dpp, null_yield) < 0) {
     ldout(cct, 10) << "owner info does not exist" << dendl;
     err_msg = "Invalid id";
     return -EINVAL;
   }
   ACLOwner& dest_owner = dest.get_owner();
   dest_owner.set_id(owner->get_id());
-  dest_owner.set_name(owner_info.display_name);
+  dest_owner.set_name(user->get_display_name());
 
   ldpp_dout(dpp, 20) << "owner id=" << owner->get_id() << dendl;
   ldpp_dout(dpp, 20) << "dest owner id=" << dest.get_owner().get_id() << dendl;
@@ -522,11 +526,12 @@ int RGWAccessControlPolicy_S3::rebuild(const DoutPrefixProvider *dpp, RGWUserCtl
         }
         email = u.id;
         ldout(cct, 10) << "grant user email=" << email << dendl;
-        if (user_ctl->get_info_by_email(dpp, email, &grant_user, null_yield) < 0) {
+       if (store->get_user_by_email(dpp, email, null_yield, &user) < 0) {
           ldout(cct, 10) << "grant user email not found or other error" << dendl;
           err_msg = "The e-mail address you provided does not match any account on record.";
           return -ERR_UNRESOLVABLE_EMAIL;
         }
+       grant_user = user->get_info();
         uid = grant_user.user_id;
       }
     case ACL_TYPE_CANON_USER:
@@ -539,18 +544,22 @@ int RGWAccessControlPolicy_S3::rebuild(const DoutPrefixProvider *dpp, RGWUserCtl
           }
         }
     
-        if (grant_user.user_id.empty() && user_ctl->get_info_by_uid(dpp, uid, &grant_user, null_yield) < 0) {
-          ldout(cct, 10) << "grant user does not exist:" << uid << dendl;
-          err_msg = "Invalid id";
-          return -EINVAL;
-        } else {
-          ACLPermission& perm = src_grant.get_permission();
-          new_grant.set_canon(uid, grant_user.display_name, perm.get_permissions());
-          grant_ok = true;
-          rgw_user new_id;
-          new_grant.get_id(new_id);
-          ldpp_dout(dpp, 10) << "new grant: " << new_id << ":" << grant_user.display_name << dendl;
+        if (grant_user.user_id.empty()) {
+         user = store->get_user(uid);
+         if (user->load_by_id(dpp, null_yield) < 0) {
+           ldout(cct, 10) << "grant user does not exist:" << uid << dendl;
+           err_msg = "Invalid id";
+           return -EINVAL;
+         } else {
+           grant_user = user->get_info();
+         }
         }
+       ACLPermission& perm = src_grant.get_permission();
+       new_grant.set_canon(uid, grant_user.display_name, perm.get_permissions());
+       grant_ok = true;
+       rgw_user new_id;
+       new_grant.get_id(new_id);
+       ldout(cct, 10) << "new grant: " << new_id << ":" << grant_user.display_name << dendl;
       }
       break;
     case ACL_TYPE_GROUP:
index 60613a8a1c14bda3a48d362cfe2160af27aecdcb..80e79f6d8490ec1d2c1d3b030bfe9b92918cf456 100644 (file)
@@ -14,6 +14,7 @@
 #include "rgw_acl.h"
 
 class RGWUserCtl;
+namespace rgw { namespace sal { class RGWStore; } }
 
 class ACLPermission_S3 : public ACLPermission, public XMLObj
 {
@@ -83,8 +84,8 @@ public:
   bool xml_end(const char *el) override;
 
   void to_xml(ostream& out);
-  int rebuild(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, ACLOwner *owner, RGWAccessControlPolicy& dest,
-              std::string &err_msg);
+  int rebuild(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store, ACLOwner *owner,
+             RGWAccessControlPolicy& dest, std::string &err_msg);
   bool compare_group_name(string& id, ACLGroupTypeEnum group) override;
 
   virtual int create_canned(ACLOwner& _owner, ACLOwner& bucket_owner, const string& canned_acl) {
@@ -97,7 +98,8 @@ public:
     int ret = _acl.create_canned(owner, bucket_owner, canned_acl);
     return ret;
   }
-  int create_from_headers(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const RGWEnv *env, ACLOwner& _owner);
+  int create_from_headers(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                         const RGWEnv *env, ACLOwner& _owner);
 };
 
 /**
index 896a38bf9fbfbac3dbff7448275914a80ca7ec71..4baf7d87b2a871b0e7394178fed0da40b06b587a 100644 (file)
@@ -11,6 +11,7 @@
 #include "rgw_common.h"
 #include "rgw_user.h"
 #include "rgw_acl_swift.h"
+#include "rgw_sal.h"
 
 #define dout_subsys ceph_subsys_rgw
 
@@ -111,29 +112,30 @@ static boost::optional<ACLGrant> referrer_to_grant(std::string url_spec,
   }
 }
 
-static ACLGrant user_to_grant(const DoutPrefixProvider *dpp, 
-                              CephContext* const cct,
-                              RGWUserCtl* const user_ctl,
+static ACLGrant user_to_grant(const DoutPrefixProvider *dpp,
+                             CephContext* const cct,
+                              rgw::sal::RGWStore* store,
                               const std::string& uid,
                               const uint32_t perm)
 {
-  rgw_user user(uid);
   RGWUserInfo grant_user;
   ACLGrant grant;
+  std::unique_ptr<rgw::sal::RGWUser> user;
 
-  if (user_ctl->get_info_by_uid(dpp, user, &grant_user, null_yield) < 0) {
+  user = store->get_user(rgw_user(uid));
+  if (user->load_by_id(dpp, null_yield) < 0) {
     ldout(cct, 10) << "grant user does not exist: " << uid << dendl;
     /* skipping silently */
-    grant.set_canon(user, std::string(), perm);
+    grant.set_canon(user->get_id(), std::string(), perm);
   } else {
-    grant.set_canon(user, grant_user.display_name, perm);
+    grant.set_canon(user->get_id(), user->get_display_name(), perm);
   }
 
   return grant;
 }
 
-int RGWAccessControlPolicy_SWIFT::add_grants(const DoutPrefixProvider *dpp, 
-                                             RGWUserCtl* const user_ctl,
+int RGWAccessControlPolicy_SWIFT::add_grants(const DoutPrefixProvider *dpp,
+                                            rgw::sal::RGWStore* store,
                                              const std::vector<std::string>& uids,
                                              const uint32_t perm)
 {
@@ -146,7 +148,7 @@ int RGWAccessControlPolicy_SWIFT::add_grants(const DoutPrefixProvider *dpp,
     const size_t pos = uid.find(':');
     if (std::string::npos == pos) {
       /* No, it don't have -- we've got just a regular user identifier. */
-      grant = user_to_grant(dpp, cct, user_ctl, uid, perm);
+      grant = user_to_grant(dpp, cct, store, uid, perm);
     } else {
       /* Yes, *potentially* an HTTP referral. */
       auto designator = uid.substr(0, pos);
@@ -157,7 +159,7 @@ int RGWAccessControlPolicy_SWIFT::add_grants(const DoutPrefixProvider *dpp,
       boost::algorithm::trim(designatee);
 
       if (! boost::algorithm::starts_with(designator, ".")) {
-        grant = user_to_grant(dpp, cct, user_ctl, uid, perm);
+        grant = user_to_grant(dpp, cct, store, uid, perm);
       } else if ((perm & SWIFT_PERM_WRITE) == 0 && is_referrer(designator)) {
         /* HTTP referrer-based ACLs aren't acceptable for writes. */
         grant = referrer_to_grant(designatee, perm);
@@ -175,8 +177,8 @@ int RGWAccessControlPolicy_SWIFT::add_grants(const DoutPrefixProvider *dpp,
 }
 
 
-int RGWAccessControlPolicy_SWIFT::create(const DoutPrefixProvider *dpp, 
-                                         RGWUserCtl* const user_ctl,
+int RGWAccessControlPolicy_SWIFT::create(const DoutPrefixProvider *dpp,
+                                        rgw::sal::RGWStore* store,
                                          const rgw_user& id,
                                          const std::string& name,
                                          const char* read_list,
@@ -197,7 +199,7 @@ int RGWAccessControlPolicy_SWIFT::create(const DoutPrefixProvider *dpp,
       return r;
     }
 
-    r = add_grants(dpp, user_ctl, uids, SWIFT_PERM_READ);
+    r = add_grants(dpp, store, uids, SWIFT_PERM_READ);
     if (r < 0) {
       ldout(cct, 0) << "ERROR: add_grants for read returned r="
                     << r << dendl;
@@ -214,7 +216,7 @@ int RGWAccessControlPolicy_SWIFT::create(const DoutPrefixProvider *dpp,
       return r;
     }
 
-    r = add_grants(dpp, user_ctl, uids, SWIFT_PERM_WRITE);
+    r = add_grants(dpp, store, uids, SWIFT_PERM_WRITE);
     if (r < 0) {
       ldout(cct, 0) << "ERROR: add_grants for write returned r="
                     << r << dendl;
@@ -300,36 +302,35 @@ void RGWAccessControlPolicy_SWIFT::to_str(string& read, string& write)
   }
 }
 
-void RGWAccessControlPolicy_SWIFTAcct::add_grants(const DoutPrefixProvider *dpp, 
-                                                  RGWUserCtl * const user_ctl,
+void RGWAccessControlPolicy_SWIFTAcct::add_grants(const DoutPrefixProvider *dpp,
+                                                 rgw::sal::RGWStore* store,
                                                   const std::vector<std::string>& uids,
                                                   const uint32_t perm)
 {
   for (const auto& uid : uids) {
     ACLGrant grant;
-    RGWUserInfo grant_user;
 
     if (uid_is_public(uid)) {
       grant.set_group(ACL_GROUP_ALL_USERS, perm);
       acl.add_grant(&grant);
     } else  {
-      rgw_user user(uid);
+      std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(uid));
 
-      if (user_ctl->get_info_by_uid(dpp, user, &grant_user, null_yield) < 0) {
+      if (user->load_by_id(dpp, null_yield) < 0) {
         ldout(cct, 10) << "grant user does not exist:" << uid << dendl;
         /* skipping silently */
-        grant.set_canon(user, std::string(), perm);
+        grant.set_canon(user->get_id(), std::string(), perm);
         acl.add_grant(&grant);
       } else {
-        grant.set_canon(user, grant_user.display_name, perm);
+        grant.set_canon(user->get_id(), user->get_display_name(), perm);
         acl.add_grant(&grant);
       }
     }
   }
 }
 
-bool RGWAccessControlPolicy_SWIFTAcct::create(const DoutPrefixProvider *dpp, 
-                                              RGWUserCtl * const user_ctl,
+bool RGWAccessControlPolicy_SWIFTAcct::create(const DoutPrefixProvider *dpp,
+                                             rgw::sal::RGWStore* store,
                                               const rgw_user& id,
                                               const std::string& name,
                                               const std::string& acl_str)
@@ -351,7 +352,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(const DoutPrefixProvider *dpp,
     decode_json_obj(admin, *iter);
     ldout(cct, 0) << "admins: " << admin << dendl;
 
-    add_grants(dpp, user_ctl, admin, SWIFT_PERM_ADMIN);
+    add_grants(dpp, store, admin, SWIFT_PERM_ADMIN);
   }
 
   iter = parser.find_first("read-write");
@@ -360,7 +361,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(const DoutPrefixProvider *dpp,
     decode_json_obj(readwrite, *iter);
     ldout(cct, 0) << "read-write: " << readwrite << dendl;
 
-    add_grants(dpp, user_ctl, readwrite, SWIFT_PERM_RWRT);
+    add_grants(dpp, store, readwrite, SWIFT_PERM_RWRT);
   }
 
   iter = parser.find_first("read-only");
@@ -369,7 +370,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(const DoutPrefixProvider *dpp,
     decode_json_obj(readonly, *iter);
     ldout(cct, 0) << "read-only: " << readonly << dendl;
 
-    add_grants(dpp, user_ctl, readonly, SWIFT_PERM_READ);
+    add_grants(dpp, store, readonly, SWIFT_PERM_READ);
   }
 
   return true;
index 68104bd36fd81f941465735b01bd4e6b3c815f15..65f7100be3b537d50d1e00da8ca2b945806f5b54 100644 (file)
@@ -17,7 +17,7 @@ class RGWUserCtl;
 
 class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy
 {
-  int add_grants(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl,
+  int add_grants(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
                  const std::vector<std::string>& uids,
                  uint32_t perm);
 
@@ -27,8 +27,8 @@ public:
   }
   ~RGWAccessControlPolicy_SWIFT() override = default;
 
-  int create(const DoutPrefixProvider *dpp, 
-             RGWUserCtl *user_ctl,
+  int create(const DoutPrefixProvider *dpp,
+            rgw::sal::RGWStore* store,
              const rgw_user& id,
              const std::string& name,
              const char* read_list,
@@ -46,12 +46,12 @@ public:
   }
   ~RGWAccessControlPolicy_SWIFTAcct() override {}
 
-  void add_grants(const DoutPrefixProvider *dpp, 
-                  RGWUserCtl *user_ctl,
+  void add_grants(const DoutPrefixProvider *dpp,
+                 rgw::sal::RGWStore* store,
                   const std::vector<std::string>& uids,
                   uint32_t perm);
-  bool create(const DoutPrefixProvider *dpp, 
-              RGWUserCtl *user_ctl,
+  bool create(const DoutPrefixProvider *dpp,
+             rgw::sal::RGWStore* store,
               const rgw_user& id,
               const std::string& name,
               const std::string& acl_str);
index b27089a9e839f71149b03392606257089da99452..14cbbc63e48743703d539eedfe3963fe6c658ad4 100644 (file)
@@ -74,7 +74,7 @@ extern "C" {
 #define SECRET_KEY_LEN 40
 #define PUBLIC_ID_LEN 20
 
-static rgw::sal::RGWRadosStore *store = NULL;
+static rgw::sal::RGWStore *store = NULL;
 
 static const DoutPrefixProvider* dpp() {
   struct GlobalPrefix : public DoutPrefixProvider {
@@ -1107,7 +1107,7 @@ static void show_reshard_status(
 }
 
 class StoreDestructor {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
 public:
   explicit StoreDestructor(rgw::sal::RGWRadosStore *_s) : store(_s) {}
   ~StoreDestructor() {
@@ -1116,38 +1116,25 @@ public:
   }
 };
 
-static int init_bucket(const string& tenant_name,
-                      const string& bucket_name,
-                      const string& bucket_id,
-                       RGWBucketInfo& bucket_info,
-                      rgw_bucket& bucket,
-                      map<string, bufferlist> *pattrs = nullptr)
+static int init_bucket(rgw::sal::RGWUser* user, const rgw_bucket& b,
+                       std::unique_ptr<rgw::sal::RGWBucket>* bucket)
 {
-  if (!bucket_name.empty()) {
-    auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
-    int r;
-    if (bucket_id.empty()) {
-      r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, nullptr, null_yield, dpp(), pattrs);
-    } else {
-      string bucket_instance_id = bucket_name + ":" + bucket_id;
-      r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket_instance_id, bucket_info, NULL, pattrs, null_yield, dpp());
-    }
-    if (r < 0) {
-      cerr << "could not get bucket info for bucket=" << bucket_name << std::endl;
-      return r;
-    }
-    bucket = bucket_info.bucket;
-  }
-  return 0;
+  return store->get_bucket(dpp(), nullptr, b, bucket, null_yield);
 }
 
-static int init_bucket(const rgw_bucket& b,
-                       RGWBucketInfo& bucket_info,
-                       rgw_bucket& bucket,
-                       map<string, bufferlist> *pattrs = nullptr)
+static int init_bucket(rgw::sal::RGWUser* user,
+                      const string& tenant_name,
+                      const string& bucket_name,
+                      const string& bucket_id,
+                       std::unique_ptr<rgw::sal::RGWBucket>* bucket)
 {
-  return init_bucket(b.tenant, b.name, b.bucket_id,
-                     bucket_info, bucket, pattrs);
+  rgw_bucket b;
+  b.tenant = tenant_name;
+  b.name = bucket_name;
+  if (!bucket_id.empty()) {
+    b.bucket_id = bucket_name + ":" + bucket_id;
+  }
+  return init_bucket(user, b, bucket);
 }
 
 static int read_input(const string& infile, bufferlist& bl)
@@ -1296,22 +1283,21 @@ void set_quota_info(RGWQuotaInfo& quota, OPT opt_cmd, int64_t max_size, int64_t
   }
 }
 
-int set_bucket_quota(rgw::sal::RGWRadosStore *store, OPT opt_cmd,
+int set_bucket_quota(rgw::sal::RGWStore *store, OPT opt_cmd,
                      const string& tenant_name, const string& bucket_name,
                      int64_t max_size, int64_t max_objects,
                      bool have_max_size, bool have_max_objects)
 {
-  RGWBucketInfo bucket_info;
-  map<string, bufferlist> attrs;
-  int r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, null_yield, dpp(), &attrs);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  int r = store->get_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
   if (r < 0) {
     cerr << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(-r) << std::endl;
     return -r;
   }
 
-  set_quota_info(bucket_info.quota, opt_cmd, max_size, max_objects, have_max_size, have_max_objects);
+  set_quota_info(bucket->get_info().quota, opt_cmd, max_size, max_objects, have_max_size, have_max_objects);
 
-   r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &attrs, dpp());
+  r = bucket->put_instance_info(dpp(), false, real_time());
   if (r < 0) {
     cerr << "ERROR: failed writing bucket instance info: " << cpp_strerror(-r) << std::endl;
     return -r;
@@ -1355,7 +1341,7 @@ int set_user_quota(OPT opt_cmd, RGWUser& user, RGWUserAdminOpState& op_state, in
   return 0;
 }
 
-int check_min_obj_stripe_size(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, rgw::sal::RGWObject* obj, uint64_t min_stripe_size, bool *need_rewrite)
+int check_min_obj_stripe_size(rgw::sal::RGWStore *store, rgw::sal::RGWObject* obj, uint64_t min_stripe_size, bool *need_rewrite)
 {
   RGWObjectCtx obj_ctx(store);
   int ret = obj->get_obj_attrs(&obj_ctx, null_yield, dpp());
@@ -1398,29 +1384,26 @@ int check_min_obj_stripe_size(rgw::sal::RGWRadosStore *store, RGWBucketInfo& buc
 }
 
 
-int check_obj_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_obj_key& key, bool fix, bool remove_bad, Formatter *f) {
+int check_obj_locator_underscore(rgw::sal::RGWObject* obj, bool fix, bool remove_bad, Formatter *f) {
   f->open_object_section("object");
   f->open_object_section("key");
   f->dump_string("type", "head");
-  f->dump_string("name", key.name);
-  f->dump_string("instance", key.instance);
+  f->dump_string("name", obj->get_name());
+  f->dump_string("instance", obj->get_instance());
   f->close_section();
 
   string oid;
   string locator;
 
-  get_obj_bucket_and_oid_loc(obj, oid, locator);
+  get_obj_bucket_and_oid_loc(obj->get_obj(), oid, locator);
 
   f->dump_string("oid", oid);
   f->dump_string("locator", locator);
 
-
   RGWObjectCtx obj_ctx(store);
+  std::unique_ptr<rgw::sal::RGWObject::ReadOp> read_op = obj->get_read_op(&obj_ctx);
 
-  RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj);
-  RGWRados::Object::Read read_op(&op_target);
-
-  int ret = read_op.prepare(null_yield, dpp());
+  int ret = read_op->prepare(null_yield, dpp());
   bool needs_fixing = (ret == -ENOENT);
 
   f->dump_bool("needs_fixing", needs_fixing);
@@ -1428,7 +1411,7 @@ int check_obj_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_o
   string status = (needs_fixing ? "needs_fixing" : "ok");
 
   if ((needs_fixing || remove_bad) && fix) {
-    ret = store->getRados()->fix_head_obj_locator(bucket_info, needs_fixing, remove_bad, key);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->fix_head_obj_locator(obj->get_bucket()->get_info(), needs_fixing, remove_bad, obj->get_key());
     if (ret < 0) {
       cerr << "ERROR: fix_head_object_locator() returned ret=" << ret << std::endl;
       goto done;
@@ -1444,7 +1427,7 @@ done:
   return 0;
 }
 
-int check_obj_tail_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_obj_key& key, bool fix, Formatter *f) {
+int check_obj_tail_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, Formatter *f) {
   f->open_object_section("object");
   f->open_object_section("key");
   f->dump_string("type", "tail");
@@ -1455,7 +1438,7 @@ int check_obj_tail_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj,
   bool needs_fixing;
   string status;
 
-  int ret = store->getRados()->fix_tail_obj_locator(dpp(), bucket_info, key, fix, &needs_fixing, null_yield);
+  int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->fix_tail_obj_locator(dpp(), bucket_info, key, fix, &needs_fixing, null_yield);
   if (ret < 0) {
     cerr << "ERROR: fix_tail_object_locator_underscore() returned ret=" << ret << std::endl;
     status = "failed";
@@ -1479,59 +1462,54 @@ int do_check_object_locator(const string& tenant_name, const string& bucket_name
     return -EINVAL;
   }
 
-  RGWBucketInfo bucket_info;
-  rgw_bucket bucket;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
   string bucket_id;
 
   f->open_object_section("bucket");
   f->dump_string("bucket", bucket_name);
-  int ret = init_bucket(tenant_name, bucket_name, bucket_id, bucket_info, bucket);
+  int ret = init_bucket(nullptr, tenant_name, bucket_name, bucket_id, &bucket);
   if (ret < 0) {
     cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
     return ret;
   }
-  bool truncated;
   int count = 0;
 
   int max_entries = 1000;
 
   string prefix;
   string delim;
+  string marker;
   vector<rgw_bucket_dir_entry> result;
-  map<string, bool> common_prefixes;
   string ns;
 
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
-
-  string marker;
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
-  list_op.params.prefix = prefix;
-  list_op.params.delim = delim;
-  list_op.params.marker = rgw_obj_key(marker);
-  list_op.params.ns = ns;
-  list_op.params.enforce_ns = true;
-  list_op.params.list_versions = true;
+  params.prefix = prefix;
+  params.delim = delim;
+  params.marker = rgw_obj_key(marker);
+  params.ns = ns;
+  params.enforce_ns = true;
+  params.list_versions = true;
 
   f->open_array_section("check_objects");
   do {
-    ret = list_op.list_objects(dpp(), max_entries - count, &result, &common_prefixes, &truncated, null_yield);
+    ret = bucket->list(dpp(), params, max_entries - count, results, null_yield);
     if (ret < 0) {
       cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
-    count += result.size();
+    count += results.objs.size();
 
-    for (vector<rgw_bucket_dir_entry>::iterator iter = result.begin(); iter != result.end(); ++iter) {
-      rgw_obj_key key = iter->key;
-      rgw_obj obj(bucket, key);
+    for (vector<rgw_bucket_dir_entry>::iterator iter = results.objs.begin(); iter != results.objs.end(); ++iter) {
+      std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(iter->key);
 
-      if (key.name[0] == '_') {
-        ret = check_obj_locator_underscore(bucket_info, obj, key, fix, remove_bad, f);
+      if (obj->get_name()[0] == '_') {
+        ret = check_obj_locator_underscore(obj.get(), fix, remove_bad, f);
 
        if (ret >= 0) {
-          ret = check_obj_tail_locator_underscore(bucket_info, obj, key, fix, f);
+          ret = check_obj_tail_locator_underscore(bucket->get_info(), obj->get_key(), fix, f);
           if (ret < 0) {
               cerr << "ERROR: check_obj_tail_locator_underscore(): " << cpp_strerror(-ret) << std::endl;
               return -ret;
@@ -1540,7 +1518,7 @@ int do_check_object_locator(const string& tenant_name, const string& bucket_name
       }
     }
     f->flush(cout);
-  } while (truncated && count < max_entries);
+  } while (results.is_truncated && count < max_entries);
   f->close_section();
   f->close_section();
 
@@ -1654,11 +1632,11 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
     return -EINVAL;
   }
   // are we the period's master zone?
-  if (store->svc()->zone->zone_id() == master_zone) {
+  if (store->get_zone_id() == master_zone) {
     // read the current period
     RGWPeriod current_period;
     int ret = current_period.init(g_ceph_context,
-                                 store->svc()->sysobj, realm.get_id(),
+                                 static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm.get_id(),
                                  null_yield);
     if (ret < 0) {
       cerr << "Error initializing current period: "
@@ -1681,7 +1659,7 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
   boost::optional<RGWRESTConn> conn;
   RGWRESTConn *remote_conn = nullptr;
   if (!remote.empty()) {
-    conn = get_remote_conn(store, period.get_map(), remote);
+    conn = get_remote_conn(static_cast<rgw::sal::RGWRadosStore*>(store), period.get_map(), remote);
     if (!conn) {
       cerr << "failed to find a zone or zonegroup for remote "
           << remote << std::endl;
@@ -1757,7 +1735,7 @@ static int update_period(const string& realm_id, const string& realm_name,
                          Formatter *formatter, bool force)
 {
   RGWRealm realm(realm_id, realm_name);
-  int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+  int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
   if (ret < 0 ) {
     cerr << "Error initializing realm " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1767,7 +1745,7 @@ static int update_period(const string& realm_id, const string& realm_name,
     epoch = atoi(period_epoch.c_str());
   }
   RGWPeriod period(period_id, epoch);
-  ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id(), null_yield);
+  ret = period.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm.get_id(), null_yield);
   if (ret < 0) {
     cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1796,12 +1774,12 @@ static int update_period(const string& realm_id, const string& realm_name,
   return 0;
 }
 
-static int init_bucket_for_sync(const string& tenant, const string& bucket_name,
-                                const string& bucket_id, rgw_bucket& bucket)
+static int init_bucket_for_sync(rgw::sal::RGWUser* user,
+                               const string& tenant, const string& bucket_name,
+                                const string& bucket_id,
+                               std::unique_ptr<rgw::sal::RGWBucket>* bucket)
 {
-  RGWBucketInfo bucket_info;
-
-  int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+  int ret = init_bucket(user, tenant, bucket_name, bucket_id, bucket);
   if (ret < 0) {
     cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1839,7 +1817,7 @@ static int do_period_pull(RGWRESTConn *remote_conn, const string& url,
     cerr << "request failed: " << cpp_strerror(-ret) << std::endl;
     return ret;
   }
-  ret = period->init(g_ceph_context, store->svc()->sysobj, null_yield, false);
+  ret = period->init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield, false);
   if (ret < 0) {
     cerr << "faile to init period " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1892,7 +1870,7 @@ stringstream& push_ss(stringstream& ss, list<string>& l, int tab = 0)
 
 static void get_md_sync_status(list<string>& status)
 {
-  RGWMetaSyncStatusManager sync(store, store->svc()->rados->get_async_processor());
+  RGWMetaSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor());
 
   int ret = sync.init();
   if (ret < 0) {
@@ -1958,7 +1936,7 @@ static void get_md_sync_status(list<string>& status)
   push_ss(ss, status) << "incremental sync: " << num_inc << "/" << total_shards << " shards";
 
   map<int, RGWMetadataLogInfo> master_shards_info;
-  string master_period = store->svc()->zone->get_current_period_id();
+  string master_period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
 
   ret = sync.read_master_log_shards_info(master_period, &master_shards_info);
   if (ret < 0) {
@@ -2033,18 +2011,18 @@ static void get_data_sync_status(const rgw_zone_id& source_zone, list<string>& s
 
   RGWZone *sz;
 
-  if (!store->svc()->zone->find_zone(source_zone, &sz)) {
+  if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone(source_zone, &sz)) {
     push_ss(ss, status, tab) << string("zone not found");
     flush_ss(ss, status);
     return;
   }
 
-  if (!store->svc()->zone->zone_syncs_from(store->svc()->zone->get_zone(), *sz)) {
+  if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->zone_syncs_from(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone(), *sz)) {
     push_ss(ss, status, tab) << string("not syncing from zone");
     flush_ss(ss, status);
     return;
   }
-  RGWDataSyncStatusManager sync(store, store->svc()->rados->get_async_processor(), source_zone, nullptr);
+  RGWDataSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor(), source_zone, nullptr);
 
   int ret = sync.init();
   if (ret < 0) {
@@ -2200,9 +2178,9 @@ static void tab_dump(const string& header, int width, const list<string>& entrie
 
 static void sync_status(Formatter *formatter)
 {
-  const RGWRealm& realm = store->svc()->zone->get_realm();
-  const RGWZoneGroup& zonegroup = store->svc()->zone->get_zonegroup();
-  const RGWZone& zone = store->svc()->zone->get_zone();
+  const RGWRealm& realm = store->get_realm();
+  const RGWZoneGroup& zonegroup = store->get_zonegroup();
+  const RGWZone& zone = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone();
 
   int width = 15;
 
@@ -2212,7 +2190,7 @@ static void sync_status(Formatter *formatter)
 
   list<string> md_status;
 
-  if (store->svc()->zone->is_meta_master()) {
+  if (store->is_meta_master()) {
     md_status.push_back("no sync (zone is master)");
   } else {
     get_md_sync_status(md_status);
@@ -2222,14 +2200,14 @@ static void sync_status(Formatter *formatter)
 
   list<string> data_status;
 
-  auto& zone_conn_map = store->svc()->zone->get_zone_conn_map();
+  auto& zone_conn_map = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone_conn_map();
 
   for (auto iter : zone_conn_map) {
     const rgw_zone_id& source_id = iter.first;
     string source_str = "source: ";
     string s = source_str + source_id.id;
     RGWZone *sz;
-    if (store->svc()->zone->find_zone(source_id, &sz)) {
+    if (static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone(source_id, &sz)) {
       s += string(" (") + sz->name + ")";
     }
     data_status.push_back(s);
@@ -2267,25 +2245,24 @@ static int bucket_source_sync_status(rgw::sal::RGWRadosStore *store, const RGWZo
     return -EINVAL;
   }
 
-  RGWBucketInfo source_bucket_info;
-  rgw_bucket source_bucket;
-  int r = init_bucket(*pipe.source.bucket, source_bucket_info, source_bucket);
+  std::unique_ptr<rgw::sal::RGWBucket> source_bucket;
+  int r = init_bucket(nullptr, *pipe.source.bucket, &source_bucket);
   if (r < 0) {
     lderr(store->ctx()) << "failed to read source bucket info: " << cpp_strerror(r) << dendl;
     return r;
   }
 
-  pipe.source.bucket = source_bucket;
+  pipe.source.bucket = source_bucket->get_key();
   pipe.dest.bucket = bucket_info.bucket;
 
   std::vector<rgw_bucket_shard_sync_info> status;
-  r = rgw_bucket_sync_status(dpp(), store, pipe, bucket_info, &source_bucket_info, &status);
+  r = rgw_bucket_sync_status(dpp(), store, pipe, bucket_info, &source_bucket->get_info(), &status);
   if (r < 0) {
     lderr(store->ctx()) << "failed to read bucket sync status: " << cpp_strerror(r) << dendl;
     return r;
   }
 
-  out << indented{width, "source bucket"} << source_bucket_info.bucket.get_key() << std::endl;
+  out << indented{width, "source bucket"} << source_bucket << std::endl;
 
   int num_full = 0;
   int num_inc = 0;
@@ -2310,7 +2287,7 @@ static int bucket_source_sync_status(rgw::sal::RGWRadosStore *store, const RGWZo
   out << indented{width} << "incremental sync: " << num_inc << "/" << total_shards << " shards\n";
 
   BucketIndexShardsManager remote_markers;
-  r = rgw_read_remote_bilog_info(conn, source_bucket, remote_markers, null_yield);
+  r = rgw_read_remote_bilog_info(conn, source_bucket->get_key(), remote_markers, null_yield);
   if (r < 0) {
     lderr(store->ctx()) << "failed to read remote log: " << cpp_strerror(r) << dendl;
     return r;
@@ -2364,15 +2341,14 @@ static void get_hint_entities(const std::set<rgw_zone_id>& zones, const std::set
 {
   for (auto& zone_id : zones) {
     for (auto& b : buckets) {
-      RGWBucketInfo hint_bucket_info;
-      rgw_bucket hint_bucket;
-      int ret = init_bucket(b, hint_bucket_info, hint_bucket);
+      std::unique_ptr<rgw::sal::RGWBucket> hint_bucket;
+      int ret = init_bucket(nullptr, b, &hint_bucket);
       if (ret < 0) {
        ldpp_dout(dpp(), 20) << "could not init bucket info for hint bucket=" << b << " ... skipping" << dendl;
        continue;
       }
 
-      hint_entities->insert(rgw_sync_bucket_entity(zone_id, hint_bucket));
+      hint_entities->insert(rgw_sync_bucket_entity(zone_id, hint_bucket->get_key()));
     }
   }
 }
@@ -2382,10 +2358,10 @@ static rgw_zone_id resolve_zone_id(const string& s)
   rgw_zone_id result;
 
   RGWZone *zone;
-  if (store->svc()->zone->find_zone(s, &zone)) {
+  if (static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone(s, &zone)) {
     return rgw_zone_id(s);
   }
-  if (store->svc()->zone->find_zone_id_by_name(s, &result)) {
+  if (static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone_id_by_name(s, &result)) {
     return result;
   }
   return rgw_zone_id(s);
@@ -2398,9 +2374,9 @@ rgw_zone_id validate_zone_id(const rgw_zone_id& zone_id)
 
 static int sync_info(std::optional<rgw_zone_id> opt_target_zone, std::optional<rgw_bucket> opt_bucket, Formatter *formatter)
 {
-  rgw_zone_id zone_id = opt_target_zone.value_or(store->svc()->zone->zone_id());
+  rgw_zone_id zone_id = opt_target_zone.value_or(store->get_zone_id());
 
-  auto zone_policy_handler = store->svc()->zone->get_sync_policy_handler(zone_id);
+  auto zone_policy_handler = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_sync_policy_handler(zone_id);
 
   RGWBucketSyncPolicyHandlerRef bucket_handler;
 
@@ -2409,18 +2385,17 @@ static int sync_info(std::optional<rgw_zone_id> opt_target_zone, std::optional<r
   auto handler = zone_policy_handler;
 
   if (eff_bucket) {
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> bucket_attrs;
+    std::unique_ptr<rgw::sal::RGWBucket> bucket;
 
-    int ret = init_bucket(*eff_bucket, bucket_info, bucket, &bucket_attrs);
+    int ret = init_bucket(nullptr, *eff_bucket, &bucket);
     if (ret < 0 && ret != -ENOENT) {
       cerr << "ERROR: init_bucket failed: " << cpp_strerror(-ret) << std::endl;
       return ret;
     }
 
     if (ret >= 0) {
-      bucket_handler.reset(handler->alloc_child(bucket_info, std::move(bucket_attrs)));
+      rgw::sal::RGWAttrs attrs = bucket->get_attrs();
+      bucket_handler.reset(handler->alloc_child(bucket->get_info(), std::move(attrs)));
     } else {
       cerr << "WARNING: bucket not found, simulating result" << std::endl;
       bucket_handler.reset(handler->alloc_child(*eff_bucket, nullopt));
@@ -2472,7 +2447,7 @@ static int sync_info(std::optional<rgw_zone_id> opt_target_zone, std::optional<r
     auto& hint_bucket = *hint_entity.bucket;
 
     RGWBucketSyncPolicyHandlerRef hint_bucket_handler;
-    int r = store->ctl()->bucket->get_sync_policy_handler(zid, hint_bucket, &hint_bucket_handler, null_yield, dpp());
+    int r = store->get_sync_policy_handler(dpp(), zid, hint_bucket, &hint_bucket_handler, null_yield);
     if (r < 0) {
       ldpp_dout(dpp(), 20) << "could not get bucket sync policy handler for hint bucket=" << hint_bucket << " ... skipping" << dendl;
       continue;
@@ -2513,8 +2488,8 @@ static int sync_info(std::optional<rgw_zone_id> opt_target_zone, std::optional<r
 static int bucket_sync_info(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& info,
                               std::ostream& out)
 {
-  const RGWRealm& realm = store->svc()->zone->get_realm();
-  const RGWZoneGroup& zonegroup = store->svc()->zone->get_zonegroup();
+  const RGWRealm& realm = store->get_realm();
+  const RGWZoneGroup& zonegroup = store->get_zonegroup();
   const RGWZone& zone = store->svc()->zone->get_zone();
   constexpr int width = 15;
 
@@ -2523,14 +2498,14 @@ static int bucket_sync_info(rgw::sal::RGWRadosStore *store, const RGWBucketInfo&
   out << indented{width, "zone"} << zone.id << " (" << zone.name << ")\n";
   out << indented{width, "bucket"} << info.bucket << "\n\n";
 
-  if (!store->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) {
+  if (!static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) {
     out << "Sync is disabled for bucket " << info.bucket.name << '\n';
     return 0;
   }
 
   RGWBucketSyncPolicyHandlerRef handler;
 
-  int r = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, info.bucket, &handler, null_yield, dpp());
+  int r = store->get_sync_policy_handler(dpp(), std::nullopt, info.bucket, &handler, null_yield);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to get policy handler for bucket (" << info.bucket << "): r=" << r << ": " << cpp_strerror(-r) << dendl;
     return r;
@@ -2554,9 +2529,9 @@ static int bucket_sync_status(rgw::sal::RGWRadosStore *store, const RGWBucketInf
                              std::optional<rgw_bucket>& opt_source_bucket,
                               std::ostream& out)
 {
-  const RGWRealm& realm = store->svc()->zone->get_realm();
-  const RGWZoneGroup& zonegroup = store->svc()->zone->get_zonegroup();
-  const RGWZone& zone = store->svc()->zone->get_zone();
+  const RGWRealm& realm = store->get_realm();
+  const RGWZoneGroup& zonegroup = store->get_zonegroup();
+  const RGWZone& zone = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone();
   constexpr int width = 15;
 
   out << indented{width, "realm"} << realm.get_id() << " (" << realm.get_name() << ")\n";
@@ -2564,14 +2539,14 @@ static int bucket_sync_status(rgw::sal::RGWRadosStore *store, const RGWBucketInf
   out << indented{width, "zone"} << zone.id << " (" << zone.name << ")\n";
   out << indented{width, "bucket"} << info.bucket << "\n\n";
 
-  if (!store->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) {
+  if (!static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) {
     out << "Sync is disabled for bucket " << info.bucket.name << " or bucket has no sync sources" << std::endl;
     return 0;
   }
 
   RGWBucketSyncPolicyHandlerRef handler;
 
-  int r = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, info.bucket, &handler, null_yield, dpp());
+  int r = store->get_sync_policy_handler(dpp(), std::nullopt, info.bucket, &handler, null_yield);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to get policy handler for bucket (" << info.bucket << "): r=" << r << ": " << cpp_strerror(-r) << dendl;
     return r;
@@ -2579,7 +2554,7 @@ static int bucket_sync_status(rgw::sal::RGWRadosStore *store, const RGWBucketInf
 
   auto sources = handler->get_all_sources();
 
-  auto& zone_conn_map = store->svc()->zone->get_zone_conn_map();
+  auto& zone_conn_map = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone_conn_map();
   set<rgw_zone_id> zone_ids;
 
   if (!source_zone_id.empty()) {
@@ -2666,7 +2641,7 @@ static void parse_tier_config_param(const string& s, map<string, string, ltstr_n
 static int check_pool_support_omap(const rgw_pool& pool)
 {
   librados::IoCtx io_ctx;
-  int ret = store->getRados()->get_rados_handle()->ioctx_create(pool.to_str().c_str(), io_ctx);
+  int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_rados_handle()->ioctx_create(pool.to_str().c_str(), io_ctx);
   if (ret < 0) {
      // the pool may not exist at this moment, we have no way to check if it supports omap.
      return 0;
@@ -2688,9 +2663,7 @@ int check_reshard_bucket_params(rgw::sal::RGWRadosStore *store,
                                bool num_shards_specified,
                                int num_shards,
                                int yes_i_really_mean_it,
-                               rgw_bucket& bucket,
-                               RGWBucketInfo& bucket_info,
-                               map<string, bufferlist>& attrs)
+                               std::unique_ptr<rgw::sal::RGWBucket>* bucket)
 {
   if (bucket_name.empty()) {
     cerr << "ERROR: bucket not specified" << std::endl;
@@ -2702,8 +2675,8 @@ int check_reshard_bucket_params(rgw::sal::RGWRadosStore *store,
     return -EINVAL;
   }
 
-  if (num_shards > (int)store->getRados()->get_max_bucket_shards()) {
-    cerr << "ERROR: num_shards too high, max value: " << store->getRados()->get_max_bucket_shards() << std::endl;
+  if (num_shards > (int)static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_max_bucket_shards()) {
+    cerr << "ERROR: num_shards too high, max value: " << static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_max_bucket_shards() << std::endl;
     return -EINVAL;
   }
 
@@ -2712,20 +2685,20 @@ int check_reshard_bucket_params(rgw::sal::RGWRadosStore *store,
     return -EINVAL;
   }
 
-  int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs);
+  int ret = init_bucket(nullptr, tenant, bucket_name, bucket_id, bucket);
   if (ret < 0) {
     cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
     return ret;
   }
 
-  if (bucket_info.reshard_status != cls_rgw_reshard_status::NOT_RESHARDING) {
+  if ((*bucket)->get_info().reshard_status != cls_rgw_reshard_status::NOT_RESHARDING) {
     // if in_progress or done then we have an old BucketInfo
     cerr << "ERROR: the bucket is currently undergoing resharding and "
       "cannot be added to the reshard list at this time" << std::endl;
     return -EBUSY;
   }
 
-  int num_source_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1);
+  int num_source_shards = ((*bucket)->get_info().layout.current_index.layout.normal.num_shards > 0 ? (*bucket)->get_info().layout.current_index.layout.normal.num_shards : 1);
 
   if (num_shards <= num_source_shards && !yes_i_really_mean_it) {
     cerr << "num shards is less or equal to current shards count" << std::endl
@@ -2788,7 +2761,7 @@ static int trim_sync_error_log(int shard_id, const string& marker, int delay_ms)
                                                shard_id);
   // call cls_log_trim() until it returns -ENODATA
   for (;;) {
-    int ret = store->svc()->cls->timelog.trim(oid, {}, {}, {}, marker, nullptr,
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->timelog.trim(oid, {}, {}, {}, marker, nullptr,
                                              null_yield);
     if (ret == -ENODATA) {
       return 0;
@@ -2868,9 +2841,8 @@ class SyncPolicyContext
 {
   RGWZoneGroup zonegroup;
 
-  std::optional<rgw_bucket> bucket;
-  RGWBucketInfo bucket_info;
-  map<string, bufferlist> bucket_attrs;
+  std::optional<rgw_bucket> b;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
 
   rgw_sync_policy_info *policy{nullptr};
 
@@ -2880,40 +2852,40 @@ public:
   SyncPolicyContext(const string& zonegroup_id,
                     const string& zonegroup_name,
                     std::optional<rgw_bucket> _bucket) : zonegroup(zonegroup_id, zonegroup_name),
-                                                         bucket(_bucket) {}
+                                                         b(_bucket) {}
 
   int init() {
-    int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+    int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
     if (ret < 0) {
       cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
       return ret;
     }
 
-    if (!bucket) {
+    if (!b) {
       policy = &zonegroup.sync_policy;
       return 0;
     }
 
-    ret = init_bucket(*bucket, bucket_info, *bucket, &bucket_attrs);
+    ret = init_bucket(nullptr, *b, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return ret;
     }
 
-    owner = bucket_info.owner;
+    owner = bucket->get_info().owner;
 
-    if (!bucket_info.sync_policy) {
+    if (!bucket->get_info().sync_policy) {
       rgw_sync_policy_info new_policy;
-      bucket_info.set_sync_policy(std::move(new_policy));
+      bucket->get_info().set_sync_policy(std::move(new_policy));
     }
 
-    policy = &(*bucket_info.sync_policy);
+    policy = &(*bucket->get_info().sync_policy);
 
     return 0;
   }
 
   int write_policy() {
-    if (!bucket) {
+    if (!b) {
       int ret = zonegroup.update(null_yield);
       if (ret < 0) {
         cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
@@ -2922,7 +2894,7 @@ public:
       return 0;
     }
 
-    int ret = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &bucket_attrs, dpp());
+    int ret = bucket->put_instance_info(dpp(), false, real_time());
     if (ret < 0) {
       cerr << "failed to store bucket info: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -2946,7 +2918,7 @@ void resolve_zone_id_opt(std::optional<string>& zone_name, std::optional<rgw_zon
     return;
   }
   zone_id.emplace();
-  if (!store->svc()->zone->find_zone_id_by_name(*zone_name, &(*zone_id))) {
+  if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone_id_by_name(*zone_name, &(*zone_id))) {
     cerr << "WARNING: cannot find source zone id for name=" << *zone_name << std::endl;
     zone_id = rgw_zone_id(*zone_name);
   }
@@ -2959,7 +2931,7 @@ void resolve_zone_ids_opt(std::optional<vector<string> >& names, std::optional<v
   ids.emplace();
   for (auto& name : *names) {
     rgw_zone_id zid;
-    if (!store->svc()->zone->find_zone_id_by_name(name, &zid)) {
+    if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone_id_by_name(name, &zid)) {
       cerr << "WARNING: cannot find source zone id for name=" << name << std::endl;
       zid = rgw_zone_id(name);
     }
@@ -2984,7 +2956,7 @@ class JSONFormatter_PrettyZone : public JSONFormatter {
       auto zone_id = *(static_cast<const rgw_zone_id *>(pval));
       string zone_name;
       RGWZone *zone;
-      if (store->svc()->zone->find_zone(zone_id, &zone)) {
+      if (static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone(zone_id, &zone)) {
         zone_name = zone->name;
       } else {
         cerr << "WARNING: cannot find zone name for id=" << zone_id << std::endl;
@@ -3032,7 +3004,7 @@ int main(int argc, const char **argv)
 
   common_init_finish(g_ceph_context);
 
-  rgw_user user_id;
+  std::unique_ptr<rgw::sal::RGWUser> user;
   string tenant;
   string user_ns;
   rgw_user new_user_id;
@@ -3067,7 +3039,7 @@ int main(int argc, const char **argv)
   int commit = false;
   int staging = false;
   int key_type = KEY_TYPE_UNDEFINED;
-  rgw_bucket bucket;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
   uint32_t perm_mask = 0;
   RGWUserInfo info;
   OPT opt_cmd = OPT::NO_CMD;
@@ -3238,11 +3210,13 @@ int main(int argc, const char **argv)
     if (ceph_argparse_double_dash(args, i)) {
       break;
     } else if (ceph_argparse_witharg(args, i, &val, "-i", "--uid", (char*)NULL)) {
+      rgw_user user_id;
       user_id.from_str(val);
-      if (user_id.empty()) {
+      if (!user) {
         cerr << "no value for uid" << std::endl;
         exit(1);
       }
+      user = store->get_user(user_id);
     } else if (ceph_argparse_witharg(args, i, &val, "-i", "--new-uid", (char*)NULL)) {
       new_user_id.from_str(val);
     } else if (ceph_argparse_witharg(args, i, &val, "--tenant", (char*)NULL)) {
@@ -3721,9 +3695,9 @@ int main(int argc, const char **argv)
                          opt_dest_bucket_name, opt_dest_bucket_id);
 
     if (tenant.empty()) {
-      tenant = user_id.tenant;
+      tenant = user->get_tenant();
     } else {
-      if (user_id.empty() && opt_cmd != OPT::ROLE_CREATE
+      if (!user && opt_cmd != OPT::ROLE_CREATE
                           && opt_cmd != OPT::ROLE_DELETE
                           && opt_cmd != OPT::ROLE_GET
                           && opt_cmd != OPT::ROLE_MODIFY
@@ -3738,12 +3712,12 @@ int main(int argc, const char **argv)
         cerr << "ERROR: --tenant is set, but there's no user ID" << std::endl;
         return EINVAL;
       }
-      user_id.tenant = tenant;
+      user->set_tenant(tenant);
     }
     if (user_ns.empty()) {
-      user_ns = user_id.ns;
+      user_ns = user->get_id().ns;
     } else {
-      user_id.ns = user_ns;
+      user->set_ns(user_ns);
     }
 
     if (!new_user_id.empty() && !tenant.empty()) {
@@ -3886,9 +3860,9 @@ int main(int argc, const char **argv)
   bool need_cache = readonly_ops_list.find(opt_cmd) == readonly_ops_list.end();
 
   if (raw_storage_op) {
-    store = RGWStoreManager::get_raw_storage(dpp(), g_ceph_context);
+    store = RGWStoreManager::get_raw_storage(dpp(), g_ceph_context, "rados");
   } else {
-    store = RGWStoreManager::get_storage(dpp(), g_ceph_context, false, false, false, false, false,
+    store = RGWStoreManager::get_storage(dpp(), g_ceph_context, "rados", false, false, false, false, false,
       need_cache && g_conf()->rgw_cache_enabled);
   }
   if (!store) {
@@ -3897,7 +3871,7 @@ int main(int argc, const char **argv)
   }
 
   if (!source_zone_name.empty()) {
-    if (!store->svc()->zone->find_zone_id_by_name(source_zone_name, &source_zone)) {
+    if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone_id_by_name(source_zone_name, &source_zone)) {
       cerr << "WARNING: cannot find source zone id for name=" << source_zone_name << std::endl;
       source_zone = source_zone_name;
     }
@@ -3916,7 +3890,7 @@ int main(int argc, const char **argv)
 
   oath_init();
 
-  StoreDestructor store_destructor(store);
+  StoreDestructor store_destructor(static_cast<rgw::sal::RGWRadosStore*>(store));
 
   if (raw_storage_op) {
     switch (opt_cmd) {
@@ -3927,7 +3901,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWPeriod period(period_id);
-       int ret = period.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = period.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "period.init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -3948,7 +3922,7 @@ int main(int argc, const char **argv)
        }
         if (staging) {
           RGWRealm realm(realm_id, realm_name);
-          int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+          int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
           if (ret < 0 ) {
             cerr << "Error initializing realm " << cpp_strerror(-ret) << std::endl;
             return -ret;
@@ -3959,7 +3933,7 @@ int main(int argc, const char **argv)
           epoch = 1;
         }
        RGWPeriod period(period_id, epoch);
-       int ret = period.init(g_ceph_context, store->svc()->sysobj, realm_id,
+       int ret = period.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm_id,
                              null_yield, realm_name);
        if (ret < 0) {
          cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
@@ -3971,7 +3945,7 @@ int main(int argc, const char **argv)
       break;
     case OPT::PERIOD_GET_CURRENT:
       {
-        int ret = read_current_period_id(store, realm_id, realm_name, &period_id);
+        int ret = read_current_period_id(static_cast<rgw::sal::RGWRadosStore*>(store), realm_id, realm_name, &period_id);
        if (ret < 0) {
          return -ret;
        }
@@ -3984,7 +3958,7 @@ int main(int argc, const char **argv)
     case OPT::PERIOD_LIST:
       {
        list<string> periods;
-       int ret = store->svc()->zone->list_periods(periods);
+       int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_periods(periods);
        if (ret < 0) {
          cerr << "failed to list periods: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4012,13 +3986,13 @@ int main(int argc, const char **argv)
         if (url.empty()) {
           // load current period for endpoints
           RGWRealm realm(realm_id, realm_name);
-          int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+          int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
           if (ret < 0) {
             cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
             return -ret;
           }
           RGWPeriod current_period(realm.get_current_period());
-          ret = current_period.init(g_ceph_context, store->svc()->sysobj, null_yield);
+          ret = current_period.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
           if (ret < 0) {
             cerr << "failed to init current period: " << cpp_strerror(-ret) << std::endl;
             return -ret;
@@ -4027,7 +4001,7 @@ int main(int argc, const char **argv)
             // use realm master zone as remote
             remote = current_period.get_master_zone().id;
           }
-          conn = get_remote_conn(store, current_period.get_map(), remote);
+          conn = get_remote_conn(static_cast<rgw::sal::RGWRadosStore*>(store), current_period.get_map(), remote);
           if (!conn) {
             cerr << "failed to find a zone or zonegroup for remote "
                 << remote << std::endl;
@@ -4055,7 +4029,7 @@ int main(int argc, const char **argv)
     case OPT::GLOBAL_QUOTA_DISABLE:
       {
         if (realm_id.empty()) {
-          RGWRealm realm(g_ceph_context, store->svc()->sysobj);
+          RGWRealm realm(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
           if (!realm_name.empty()) {
             // look up realm_id for the given realm_name
             int ret = realm.read_id(realm_name, realm_id, null_yield);
@@ -4076,7 +4050,7 @@ int main(int argc, const char **argv)
         }
 
         RGWPeriodConfig period_config;
-        int ret = period_config.read(store->svc()->sysobj, realm_id, null_yield);
+        int ret = period_config.read(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm_id, null_yield);
         if (ret < 0 && ret != -ENOENT) {
           cerr << "ERROR: failed to read period config: "
               << cpp_strerror(-ret) << std::endl;
@@ -4107,7 +4081,7 @@ int main(int argc, const char **argv)
 
         if (opt_cmd != OPT::GLOBAL_QUOTA_GET) {
           // write the modified period config
-          ret = period_config.write(store->svc()->sysobj, realm_id, null_yield);
+          ret = period_config.write(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm_id, null_yield);
           if (ret < 0) {
             cerr << "ERROR: failed to write period config: "
                 << cpp_strerror(-ret) << std::endl;
@@ -4133,7 +4107,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
 
-       RGWRealm realm(realm_name, g_ceph_context, store->svc()->sysobj);
+       RGWRealm realm(realm_name, g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
        int ret = realm.create(dpp(), null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't create realm " << realm_name << ": " << cpp_strerror(-ret) << std::endl;
@@ -4158,7 +4132,7 @@ int main(int argc, const char **argv)
          cerr << "missing realm name or id" << std::endl;
          return EINVAL;
        }
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "realm.init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4174,7 +4148,7 @@ int main(int argc, const char **argv)
     case OPT::REALM_GET:
       {
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          if (ret == -ENOENT && realm_name.empty() && realm_id.empty()) {
            cerr << "missing realm name or id, or default realm not found" << std::endl;
@@ -4189,7 +4163,7 @@ int main(int argc, const char **argv)
       break;
     case OPT::REALM_GET_DEFAULT:
       {
-       RGWRealm realm(g_ceph_context, store->svc()->sysobj);
+       RGWRealm realm(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
        string default_id;
        int ret = realm.read_default_id(default_id, null_yield);
        if (ret == -ENOENT) {
@@ -4204,14 +4178,14 @@ int main(int argc, const char **argv)
       break;
     case OPT::REALM_LIST:
       {
-       RGWRealm realm(g_ceph_context, store->svc()->sysobj);
+       RGWRealm realm(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
        string default_id;
        int ret = realm.read_default_id(default_id, null_yield);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "could not determine default realm: " << cpp_strerror(-ret) << std::endl;
        }
        list<string> realms;
-       ret = store->svc()->zone->list_realms(realms);
+       ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_realms(realms);
        if (ret < 0) {
          cerr << "failed to list realms: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4225,12 +4199,12 @@ int main(int argc, const char **argv)
       break;
     case OPT::REALM_LIST_PERIODS:
       {
-        int ret = read_current_period_id(store, realm_id, realm_name, &period_id);
+        int ret = read_current_period_id(static_cast<rgw::sal::RGWRadosStore*>(store), realm_id, realm_name, &period_id);
        if (ret < 0) {
          return -ret;
        }
        list<string> periods;
-       ret = store->svc()->zone->list_periods(period_id, periods, null_yield);
+       ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_periods(period_id, periods, null_yield);
        if (ret < 0) {
          cerr << "list periods failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4254,7 +4228,7 @@ int main(int argc, const char **argv)
          cerr << "missing realm name or id" << std::endl;
          return EINVAL;
        }
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "realm.init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4277,7 +4251,7 @@ int main(int argc, const char **argv)
        }
        RGWRealm realm(realm_id, realm_name);
        bool new_realm = false;
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4324,7 +4298,7 @@ int main(int argc, const char **argv)
     case OPT::REALM_DEFAULT:
       {
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4366,7 +4340,7 @@ int main(int argc, const char **argv)
           return -ret;
         }
         RGWRealm realm;
-        realm.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
+        realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield, false);
         try {
           decode_json_obj(realm, &p);
         } catch (const JSONDecoder::err& e) {
@@ -4418,14 +4392,14 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup(zonegroup_id,zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to initialize zonegroup " << zonegroup_name << " id " << zonegroup_id << " :"
               << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
        RGWZoneParams zone(zone_id, zone_name);
-       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4458,7 +4432,7 @@ int main(int argc, const char **argv)
                                  endpoints, ptier_type,
                                  psync_from_all, sync_from, sync_from_rm,
                                  predirect_zone, bucket_index_max_shards,
-                                store->svc()->sync_modules->get_manager(),
+                                static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sync_modules->get_manager(),
                                 null_yield);
        if (ret < 0) {
          cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name() << ": "
@@ -4477,13 +4451,13 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
-       RGWZoneGroup zonegroup(zonegroup_name, is_master, g_ceph_context, store->svc()->sysobj, realm.get_id(), endpoints);
+       RGWZoneGroup zonegroup(zonegroup_name, is_master, g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm.get_id(), endpoints);
         zonegroup.api_name = (api_name.empty() ? zonegroup_name : api_name);
        ret = zonegroup.create(dpp(), null_yield);
        if (ret < 0) {
@@ -4510,7 +4484,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4530,7 +4504,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj,
                                 null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
@@ -4546,7 +4520,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_GET:
       {
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4559,7 +4533,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_LIST:
       {
        RGWZoneGroup zonegroup;
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj,
                                 null_yield, false);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
@@ -4567,7 +4541,7 @@ int main(int argc, const char **argv)
        }
 
        list<string> zonegroups;
-       ret = store->svc()->zone->list_zonegroups(zonegroups);
+       ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_zonegroups(zonegroups);
        if (ret < 0) {
          cerr << "failed to list zonegroups: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4587,7 +4561,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_MODIFY:
       {
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4620,7 +4594,7 @@ int main(int argc, const char **argv)
           need_update = true;
         } else if (!realm_name.empty()) {
           // get realm id from name
-          RGWRealm realm{g_ceph_context, store->svc()->sysobj};
+          RGWRealm realm{g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj};
           ret = realm.read_id(realm_name, zonegroup.realm_id, null_yield);
           if (ret < 0) {
             cerr << "failed to find realm by name " << realm_name << std::endl;
@@ -4658,7 +4632,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_SET:
       {
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty());
 
        if (ret < 0 && !default_realm_not_exist ) {
@@ -4667,7 +4641,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup;
-       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+       ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj,
                             null_yield, false);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
@@ -4706,7 +4680,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_REMOVE:
       {
         RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-        int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+        int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
         if (ret < 0) {
           cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -4752,7 +4726,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4767,7 +4741,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_PLACEMENT_LIST:
       {
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj,
                                 null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
@@ -4786,7 +4760,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4823,7 +4797,7 @@ int main(int argc, const char **argv)
         }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4887,7 +4861,7 @@ int main(int argc, const char **argv)
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
        /* if the user didn't provide zonegroup info , create stand alone zone */
        if (!zonegroup_id.empty() || !zonegroup_name.empty()) {
-         ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+         ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
          if (ret < 0) {
            cerr << "unable to initialize zonegroup " << zonegroup_name << ": " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -4898,7 +4872,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneParams zone(zone_id, zone_name);
-       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
+       ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield, false);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4933,7 +4907,7 @@ int main(int argc, const char **argv)
                                    psync_from_all,
                                    sync_from, sync_from_rm,
                                    predirect_zone, bucket_index_max_shards,
-                                  store->svc()->sync_modules->get_manager(),
+                                  static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sync_modules->get_manager(),
                                   null_yield);
          if (ret < 0) {
            cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name()
@@ -4956,7 +4930,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_DEFAULT:
       {
        RGWZoneGroup zonegroup(zonegroup_id,zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
        }
@@ -4965,7 +4939,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneParams zone(zone_id, zone_name);
-       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4984,14 +4958,14 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
         list<string> zonegroups;
-       ret = store->svc()->zone->list_zonegroups(zonegroups);
+       ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_zonegroups(zonegroups);
        if (ret < 0) {
          cerr << "failed to list zonegroups: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4999,7 +4973,7 @@ int main(int argc, const char **argv)
 
         for (list<string>::iterator iter = zonegroups.begin(); iter != zonegroups.end(); ++iter) {
           RGWZoneGroup zonegroup(string(), *iter);
-          int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+          int ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
           if (ret < 0) {
             cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
             continue;
@@ -5021,7 +4995,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_GET:
       {
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5033,7 +5007,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_SET:
       {
        RGWZoneParams zone(zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield,
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield,
                            false);
        if (ret < 0) {
          return -ret;
@@ -5054,7 +5028,7 @@ int main(int argc, const char **argv)
 
        if(zone.realm_id.empty()) {
          RGWRealm realm(realm_id, realm_name);
-         int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+         int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
          if (ret < 0 && ret != -ENOENT) {
            cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -5117,14 +5091,14 @@ int main(int argc, const char **argv)
     case OPT::ZONE_LIST:
       {
        list<string> zones;
-       int ret = store->svc()->zone->list_zones(zones);
+       int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_zones(zones);
        if (ret < 0) {
          cerr << "failed to list zones: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
        RGWZoneParams zone;
-       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
+       ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield, false);
        if (ret < 0) {
          cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5144,7 +5118,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_MODIFY:
       {
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
         if (ret < 0) {
          cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5166,7 +5140,7 @@ int main(int argc, const char **argv)
           need_zone_update = true;
         } else if (!realm_name.empty()) {
           // get realm id from name
-          RGWRealm realm{g_ceph_context, store->svc()->sysobj};
+          RGWRealm realm{g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj};
           ret = realm.read_id(realm_name, zone.realm_id, null_yield);
           if (ret < 0) {
             cerr << "failed to find realm by name " << realm_name << std::endl;
@@ -5202,7 +5176,7 @@ int main(int argc, const char **argv)
         }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5218,7 +5192,7 @@ int main(int argc, const char **argv)
                                  endpoints, ptier_type,
                                  psync_from_all, sync_from, sync_from_rm,
                                  predirect_zone, bucket_index_max_shards,
-                                store->svc()->sync_modules->get_manager(),
+                                static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sync_modules->get_manager(),
                                 null_yield);
        if (ret < 0) {
          cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
@@ -5253,7 +5227,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneParams zone(zone_id,zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5265,7 +5239,7 @@ int main(int argc, const char **argv)
          return -ret;
        }
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
        } else {
@@ -5293,7 +5267,7 @@ int main(int argc, const char **argv)
         }
 
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
         if (ret < 0) {
          cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5302,7 +5276,7 @@ int main(int argc, const char **argv)
         if (opt_cmd == OPT::ZONE_PLACEMENT_ADD ||
            opt_cmd == OPT::ZONE_PLACEMENT_MODIFY) {
          RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-         ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
+         ret = zonegroup.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
          if (ret < 0) {
            cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -5389,7 +5363,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_PLACEMENT_LIST:
       {
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5406,7 +5380,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       int ret = zone.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5432,7 +5406,7 @@ int main(int argc, const char **argv)
   resolve_zone_ids_opt(opt_source_zone_names, opt_source_zone_ids);
   resolve_zone_ids_opt(opt_dest_zone_names, opt_dest_zone_ids);
 
-  bool non_master_cmd = (!store->svc()->zone->is_meta_master() && !yes_i_really_mean_it);
+  bool non_master_cmd = (!store->is_meta_master() && !yes_i_really_mean_it);
   std::set<OPT> non_master_ops_list = {OPT::USER_CREATE, OPT::USER_RM, 
                                         OPT::USER_MODIFY, OPT::USER_ENABLE,
                                         OPT::USER_SUSPEND, OPT::SUBUSER_CREATE,
@@ -5454,9 +5428,9 @@ int main(int argc, const char **argv)
       return EINVAL;
   }
 
-  if (!user_id.empty()) {
-    user_op.set_user_id(user_id);
-    bucket_op.set_user_id(user_id);
+  if (user) {
+    user_op.set_user_id(user->get_id());
+    bucket_op.set_user_id(user->get_id());
   }
 
   if (!display_name.empty())
@@ -5465,7 +5439,7 @@ int main(int argc, const char **argv)
   if (!user_email.empty())
     user_op.set_user_email(user_email);
 
-  if (!user_id.empty()) {
+  if (!new_user_id.empty()) {
     user_op.set_new_user_id(new_user_id);
   }
 
@@ -5536,7 +5510,7 @@ int main(int argc, const char **argv)
     rgw_placement_rule target_rule;
     target_rule.name = placement_id;
     target_rule.storage_class = *opt_storage_class;
-    if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) {
+    if (!store->get_zone_params().valid_placement(target_rule)) {
       cerr << "NOTICE: invalid dest placement: " << target_rule.to_str() << std::endl;
       return EINVAL;
     }
@@ -5548,10 +5522,10 @@ int main(int argc, const char **argv)
   }
 
   // RGWUser to use for user operations
-  RGWUser user;
+  RGWUser ruser;
   int ret = 0;
-  if (!(user_id.empty() && access_key.empty()) || !subuser.empty()) {
-    ret = user.init(dpp(), store, user_op, null_yield);
+  if (!(!user && access_key.empty()) || !subuser.empty()) {
+    ret = ruser.init(dpp(), store, user_op, null_yield);
     if (ret < 0) {
       cerr << "user.init failed: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -5573,7 +5547,7 @@ int main(int argc, const char **argv)
 
   switch (opt_cmd) {
   case OPT::USER_INFO:
-    if (user_id.empty() && access_key.empty()) {
+    if (!user && access_key.empty()) {
       cerr << "ERROR: --uid or --access-key required" << std::endl;
       return EINVAL;
     }
@@ -5582,7 +5556,7 @@ int main(int argc, const char **argv)
     if (!user_op.has_existing_user()) {
       user_op.set_generate_key(); // generate a new key by default
     }
-    ret = user.add(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.add(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not create user: " << err_msg << std::endl;
       if (ret == -ERR_INVALID_TENANT_NAME)
@@ -5591,7 +5565,7 @@ int main(int argc, const char **argv)
       return -ret;
     }
     if (!subuser.empty()) {
-      ret = user.subusers.add(dpp(), user_op, null_yield, &err_msg);
+      ret = ruser.subusers.add(dpp(),user_op, null_yield, &err_msg);
       if (ret < 0) {
         cerr << "could not create subuser: " << err_msg << std::endl;
         return -ret;
@@ -5599,7 +5573,7 @@ int main(int argc, const char **argv)
     }
     break;
   case OPT::USER_RM:
-    ret = user.remove(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.remove(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not remove user: " << err_msg << std::endl;
       return -ret;
@@ -5611,7 +5585,7 @@ int main(int argc, const char **argv)
     if (yes_i_really_mean_it) {
       user_op.set_overwrite_new_user(true);
     }
-    ret = user.rename(user_op, null_yield, dpp(), &err_msg);
+    ret = ruser.rename(user_op, null_yield, dpp(), &err_msg);
     if (ret < 0) {
       if (ret == -EEXIST) {
         err_msg += ". to overwrite this user, add --yes-i-really-mean-it";
@@ -5624,7 +5598,7 @@ int main(int argc, const char **argv)
   case OPT::USER_ENABLE:
   case OPT::USER_SUSPEND:
   case OPT::USER_MODIFY:
-    ret = user.modify(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.modify(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not modify user: " << err_msg << std::endl;
       return -ret;
@@ -5632,7 +5606,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::SUBUSER_CREATE:
-    ret = user.subusers.add(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.subusers.add(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not create subuser: " << err_msg << std::endl;
       return -ret;
@@ -5640,7 +5614,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::SUBUSER_MODIFY:
-    ret = user.subusers.modify(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.subusers.modify(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not modify subuser: " << err_msg << std::endl;
       return -ret;
@@ -5648,7 +5622,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::SUBUSER_RM:
-    ret = user.subusers.remove(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.subusers.remove(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not remove subuser: " << err_msg << std::endl;
       return -ret;
@@ -5656,7 +5630,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::CAPS_ADD:
-    ret = user.caps.add(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.caps.add(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not add caps: " << err_msg << std::endl;
       return -ret;
@@ -5664,7 +5638,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::CAPS_RM:
-    ret = user.caps.remove(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.caps.remove(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not remove caps: " << err_msg << std::endl;
       return -ret;
@@ -5672,7 +5646,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::KEY_CREATE:
-    ret = user.keys.add(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.keys.add(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not create key: " << err_msg << std::endl;
       return -ret;
@@ -5680,7 +5654,7 @@ int main(int argc, const char **argv)
 
     break;
   case OPT::KEY_RM:
-    ret = user.keys.remove(dpp(), user_op, null_yield, &err_msg);
+    ret = ruser.keys.remove(dpp(), user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not remove key: " << err_msg << std::endl;
       return -ret;
@@ -5705,7 +5679,7 @@ int main(int argc, const char **argv)
 
       // load the period
       RGWPeriod period(period_id);
-      int ret = period.init(g_ceph_context, store->svc()->sysobj, null_yield);
+      int ret = period.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
       if (ret < 0) {
         cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -5739,13 +5713,13 @@ int main(int argc, const char **argv)
     {
       // read realm and staging period
       RGWRealm realm(realm_id, realm_name);
-      int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+      int ret = realm.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, null_yield);
       if (ret < 0) {
         cerr << "Error initializing realm: " << cpp_strerror(-ret) << std::endl;
         return -ret;
       }
       RGWPeriod period(RGWPeriod::get_staging_id(realm.get_id()), 1);
-      ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id(), null_yield);
+      ret = period.init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm.get_id(), null_yield);
       if (ret < 0) {
         cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -5779,7 +5753,7 @@ int main(int argc, const char **argv)
         cerr << "failed to parse policy: " << e.what() << std::endl;
         return -EINVAL;
       }
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, path, assume_role_doc, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, path, assume_role_doc, tenant);
       ret = role.create(dpp(), true, null_yield);
       if (ret < 0) {
         return -ret;
@@ -5793,7 +5767,7 @@ int main(int argc, const char **argv)
         cerr << "ERROR: empty role name" << std::endl;
         return -EINVAL;
       }
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       ret = role.delete_obj(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5807,7 +5781,7 @@ int main(int argc, const char **argv)
         cerr << "ERROR: empty role name" << std::endl;
         return -EINVAL;
       }
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       ret = role.get(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5835,7 +5809,7 @@ int main(int argc, const char **argv)
         return -EINVAL;
       }
 
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       ret = role.get(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5851,7 +5825,7 @@ int main(int argc, const char **argv)
   case OPT::ROLE_LIST:
     {
       vector<RGWRole> result;
-      ret = RGWRole::get_roles_by_path_prefix(dpp(), store->getRados(), g_ceph_context, path_prefix, tenant, result, null_yield);
+      ret = RGWRole::get_roles_by_path_prefix(dpp(), store, g_ceph_context, path_prefix, tenant, result, null_yield);
       if (ret < 0) {
         return -ret;
       }
@@ -5883,7 +5857,7 @@ int main(int argc, const char **argv)
         return -EINVAL;
       }
 
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       ret = role.get(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5902,7 +5876,7 @@ int main(int argc, const char **argv)
         cerr << "ERROR: Role name is empty" << std::endl;
         return -EINVAL;
       }
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       ret = role.get(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5922,7 +5896,7 @@ int main(int argc, const char **argv)
         cerr << "ERROR: policy name is empty" << std::endl;
         return -EINVAL;
       }
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       int ret = role.get(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5946,7 +5920,7 @@ int main(int argc, const char **argv)
         cerr << "ERROR: policy name is empty" << std::endl;
         return -EINVAL;
       }
-      RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
+      RGWRole role(g_ceph_context, store->get_ctl(), role_name, tenant);
       ret = role.get(dpp(), null_yield);
       if (ret < 0) {
         return -ret;
@@ -5969,7 +5943,7 @@ int main(int argc, const char **argv)
 
   // output the result of a user operation
   if (output_user_info) {
-    ret = user.info(info, &err_msg);
+    ret = ruser.info(info, &err_msg);
     if (ret < 0) {
       cerr << "could not fetch user info: " << err_msg << std::endl;
       return -ret;
@@ -6001,15 +5975,15 @@ int main(int argc, const char **argv)
 
     bool truncated;
 
-    if (! user_id.empty()) {
-      user_ids.push_back(user_id.id);
+    if (user) {
+      user_ids.push_back(user->get_id().id);
       ret =
        RGWBucketAdminOp::limit_check(store, bucket_op, user_ids, f,
                                      null_yield, dpp(), warnings_only);
     } else {
       /* list users in groups of max-keys, then perform user-bucket
        * limit-check on each group */
-     ret = store->ctl()->meta.mgr->list_keys_init(metadata_key, &handle);
+     ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init(metadata_key, &handle);
       if (ret < 0) {
        cerr << "ERROR: buckets limit check can't get user metadata_key: "
             << cpp_strerror(-ret) << std::endl;
@@ -6017,7 +5991,7 @@ int main(int argc, const char **argv)
       }
 
       do {
-       ret = store->ctl()->meta.mgr->list_keys_next(handle, max, user_ids,
+       ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, max, user_ids,
                                              &truncated);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "ERROR: buckets limit check lists_keys_next(): "
@@ -6033,30 +6007,28 @@ int main(int argc, const char **argv)
        }
        user_ids.clear();
       } while (truncated);
-      store->ctl()->meta.mgr->list_keys_complete(handle);
+      static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
     }
     return -ret;
   } /* OPT::BUCKET_LIMIT_CHECK */
 
   if (opt_cmd == OPT::BUCKETS_LIST) {
     if (bucket_name.empty()) {
-      if (!user_id.empty()) {
+      if (user) {
         if (!user_op.has_existing_user()) {
-          cerr << "ERROR: could not find user: " << user_id << std::endl;
+          cerr << "ERROR: could not find user: " << user << std::endl;
           return -ENOENT;
         }
       }
       RGWBucketAdminOp::info(store, bucket_op, f, null_yield, dpp());
     } else {
-      RGWBucketInfo bucket_info;
-      int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+      int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
       if (ret < 0) {
         cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
         return -ret;
       }
       formatter->open_array_section("entries");
 
-      bool truncated = false;
       int count = 0;
 
       static constexpr int MAX_PAGINATE_SIZE = 10000;
@@ -6069,38 +6041,35 @@ int main(int argc, const char **argv)
 
       string prefix;
       string delim;
-      vector<rgw_bucket_dir_entry> result;
-      map<string, bool> common_prefixes;
       string ns;
 
-      RGWRados::Bucket target(store->getRados(), bucket_info);
-      RGWRados::Bucket::List list_op(&target);
+      rgw::sal::RGWBucket::ListParams params;
+      rgw::sal::RGWBucket::ListResults results;
 
-      list_op.params.prefix = prefix;
-      list_op.params.delim = delim;
-      list_op.params.marker = rgw_obj_key(marker);
-      list_op.params.ns = ns;
-      list_op.params.enforce_ns = false;
-      list_op.params.list_versions = true;
-      list_op.params.allow_unordered = bool(allow_unordered);
+      params.prefix = prefix;
+      params.delim = delim;
+      params.marker = rgw_obj_key(marker);
+      params.ns = ns;
+      params.enforce_ns = false;
+      params.list_versions = true;
+      params.allow_unordered = bool(allow_unordered);
 
       do {
         const int remaining = max_entries - count;
-        ret = list_op.list_objects(dpp(), std::min(remaining, paginate_size),
-                                  &result, &common_prefixes, &truncated,
-                                  null_yield);
+       ret = bucket->list(dpp(), params, std::min(remaining, paginate_size), results,
+                          null_yield);
         if (ret < 0) {
           cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
           return -ret;
         }
 
-        count += result.size();
+        count += results.objs.size();
 
-        for (const auto& entry : result) {
+        for (const auto& entry : results.objs) {
           encode_json("entry", entry, formatter.get());
         }
         formatter->flush(cout);
-      } while (truncated && count < max_entries);
+      } while (results.is_truncated && count < max_entries);
 
       formatter->close_section();
       formatter->flush(cout);
@@ -6137,7 +6106,7 @@ int main(int argc, const char **argv)
   if (opt_cmd == OPT::BUCKET_STATS) {
     if (bucket_name.empty() && !bucket_id.empty()) {
       rgw_bucket bucket;
-      if (!rgw_find_bucket_by_id(store->ctx(), store->ctl()->meta.mgr, marker, bucket_id, &bucket)) {
+      if (!rgw_find_bucket_by_id(store->ctx(), static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr, marker, bucket_id, &bucket)) {
         cerr << "failure: no such bucket id" << std::endl;
         return -ENOENT;
       }
@@ -6196,7 +6165,7 @@ int main(int argc, const char **argv)
     formatter->reset();
     formatter->open_array_section("logs");
     RGWAccessHandle h;
-    int r = store->getRados()->log_list_init(date, &h);
+    int r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->log_list_init(date, &h);
     if (r == -ENOENT) {
       // no logs.
     } else {
@@ -6206,7 +6175,7 @@ int main(int argc, const char **argv)
       }
       while (true) {
         string name;
-        int r = store->getRados()->log_list_next(h, &name);
+        int r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->log_list_next(h, &name);
         if (r == -ENOENT)
           break;
         if (r < 0) {
@@ -6241,7 +6210,7 @@ int main(int argc, const char **argv)
     if (opt_cmd == OPT::LOG_SHOW) {
       RGWAccessHandle h;
 
-      int r = store->getRados()->log_show_init(oid, &h);
+      int r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->log_show_init(oid, &h);
       if (r < 0) {
        cerr << "error opening log " << oid << ": " << cpp_strerror(-r) << std::endl;
        return -r;
@@ -6253,7 +6222,7 @@ int main(int argc, const char **argv)
       struct rgw_log_entry entry;
 
       // peek at first entry to get bucket metadata
-      r = store->getRados()->log_show_next(h, &entry);
+      r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->log_show_next(h, &entry);
       if (r < 0) {
        cerr << "error reading log " << oid << ": " << cpp_strerror(-r) << std::endl;
        return -r;
@@ -6289,7 +6258,7 @@ int main(int argc, const char **argv)
          formatter->flush(cout);
         }
 next:
-       r = store->getRados()->log_show_next(h, &entry);
+       r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->log_show_next(h, &entry);
       } while (r > 0);
 
       if (r < 0) {
@@ -6312,7 +6281,7 @@ next:
       cout << std::endl;
     }
     if (opt_cmd == OPT::LOG_RM) {
-      int r = store->getRados()->log_remove(oid);
+      int r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->log_remove(oid);
       if (r < 0) {
        cerr << "error removing log " << oid << ": " << cpp_strerror(-r) << std::endl;
        return -r;
@@ -6326,7 +6295,7 @@ next:
       exit(1);
     }
 
-    int ret = store->svc()->zone->add_bucket_placement(pool, null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->add_bucket_placement(pool, null_yield);
     if (ret < 0)
       cerr << "failed to add bucket placement: " << cpp_strerror(-ret) << std::endl;
   }
@@ -6337,14 +6306,14 @@ next:
       exit(1);
     }
 
-    int ret = store->svc()->zone->remove_bucket_placement(pool, null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->remove_bucket_placement(pool, null_yield);
     if (ret < 0)
       cerr << "failed to remove bucket placement: " << cpp_strerror(-ret) << std::endl;
   }
 
   if (opt_cmd == OPT::POOLS_LIST) {
     set<rgw_pool> pools;
-    int ret = store->svc()->zone->list_placement_set(pools, null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_placement_set(pools, null_yield);
     if (ret < 0) {
       cerr << "could not list placement set: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6383,8 +6352,15 @@ next:
     }
 
 
-    ret = RGWUsage::show(store->getRados(), user_id, bucket_name, start_epoch, end_epoch,
-                        show_log_entries, show_log_sum, &categories,
+    if (!bucket_name.empty()) {
+      int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
+      if (ret < 0) {
+       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
+       return -ret;
+      }
+    }
+    ret = RGWUsage::show(dpp(), store, user.get(), bucket.get(), start_epoch,
+                        end_epoch, show_log_entries, show_log_sum, &categories,
                         f);
     if (ret < 0) {
       cerr << "ERROR: failed to show usage" << std::endl;
@@ -6393,7 +6369,7 @@ next:
   }
 
   if (opt_cmd == OPT::USAGE_TRIM) {
-    if (user_id.empty() && bucket_name.empty() &&
+    if (!user && bucket_name.empty() &&
        start_date.empty() && end_date.empty() && !yes_i_really_mean_it) {
       cerr << "usage trim without user/date/bucket specified will remove *all* users data" << std::endl;
       cerr << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl;
@@ -6420,7 +6396,14 @@ next:
       }
     }
 
-    ret = RGWUsage::trim(store->getRados(), user_id, bucket_name, start_epoch, end_epoch);
+    if (!bucket_name.empty()) {
+      int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
+      if (ret < 0) {
+       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
+       return -ret;
+      }
+    }
+    ret = RGWUsage::trim(dpp(), store, user.get(), bucket.get(), start_epoch, end_epoch);
     if (ret < 0) {
       cerr << "ERROR: read_usage() returned ret=" << ret << std::endl;
       return 1;
@@ -6434,7 +6417,7 @@ next:
       return 1;
     }
 
-    ret = RGWUsage::clear(store->getRados());
+    ret = RGWUsage::clear(store);
     if (ret < 0) {
       return ret;
     }
@@ -6453,15 +6436,14 @@ next:
   }
 
   if (opt_cmd == OPT::OLH_GET) {
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
     RGWOLHInfo olh;
-    rgw_obj obj(bucket, object);
-    ret = store->getRados()->get_olh(bucket_info, obj, &olh);
+    rgw_obj obj(bucket->get_key(), object);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_olh(bucket->get_info(), obj, &olh);
     if (ret < 0) {
       cerr << "ERROR: failed reading olh: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6471,8 +6453,7 @@ next:
   }
 
   if (opt_cmd == OPT::OLH_READLOG) {
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6481,16 +6462,16 @@ next:
     bool is_truncated;
 
     RGWObjectCtx rctx(store);
-    rgw_obj obj(bucket, object);
+    std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(object);
 
     RGWObjState *state;
 
-    ret = store->getRados()->get_obj_state(dpp(), &rctx, bucket_info, obj, &state, false, null_yield); /* don't follow olh */
+    ret = obj->get_obj_state(dpp(), &rctx, &state, null_yield);
     if (ret < 0) {
       return -ret;
     }
 
-    ret = store->getRados()->bucket_index_read_olh_log(dpp(), bucket_info, *state, obj, 0, &log, &is_truncated);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->bucket_index_read_olh_log(dpp(), bucket->get_info(), *state, obj->get_obj(), 0, &log, &is_truncated);
     if (ret < 0) {
       cerr << "ERROR: failed reading olh: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6511,20 +6492,19 @@ next:
       cerr << "ERROR: object not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
-    rgw_obj obj(bucket, object);
+    rgw_obj obj(bucket->get_key(), object);
     if (!object_version.empty()) {
       obj.key.set_instance(object_version);
     }
 
     rgw_cls_bi_entry entry;
 
-    ret = store->getRados()->bi_get(bucket_info, obj, bi_index_type, &entry);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->bi_get(bucket->get_info(), obj, bi_index_type, &entry);
     if (ret < 0) {
       cerr << "ERROR: bi_get(): " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6539,8 +6519,7 @@ next:
       cerr << "ERROR: bucket name not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6553,9 +6532,9 @@ next:
       return 1;
     }
 
-    rgw_obj obj(bucket, key);
+    rgw_obj obj(bucket->get_key(), key);
 
-    ret = store->getRados()->bi_put(dpp(), bucket, obj, entry);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->bi_put(dpp(), bucket->get_key(), obj, entry);
     if (ret < 0) {
       cerr << "ERROR: bi_put(): " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6567,8 +6546,7 @@ next:
       cerr << "ERROR: bucket name not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6580,16 +6558,16 @@ next:
       max_entries = 1000;
     }
 
-    int max_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1);
+    int max_shards = (bucket->get_info().layout.current_index.layout.normal.num_shards > 0 ? bucket->get_info().layout.current_index.layout.normal.num_shards : 1);
 
     formatter->open_array_section("entries");
 
     int i = (specified_shard_id ? shard_id : 0);
     for (; i < max_shards; i++) {
-      RGWRados::BucketShard bs(store->getRados());
-      int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0  ? i : -1);
+      RGWRados::BucketShard bs(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados());
+      int shard_id = (bucket->get_info().layout.current_index.layout.normal.num_shards > 0  ? i : -1);
 
-      int ret = bs.init(bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */, dpp());
+      int ret = bs.init(bucket->get_key(), shard_id, bucket->get_info().layout.current_index, nullptr /* no RGWBucketInfo */, dpp());
       marker.clear();
 
       if (ret < 0) {
@@ -6599,7 +6577,7 @@ next:
 
       do {
         entries.clear();
-        ret = store->getRados()->bi_list(bs, object, marker, max_entries, &entries, &is_truncated);
+        ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->bi_list(bs, object, marker, max_entries, &entries, &is_truncated);
         if (ret < 0) {
           cerr << "ERROR: bi_list(): " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -6627,43 +6605,28 @@ next:
       cerr << "ERROR: bucket name not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
-    RGWBucketInfo cur_bucket_info;
-    rgw_bucket cur_bucket;
-    ret = init_bucket(tenant, bucket_name, string(), cur_bucket_info, cur_bucket);
+    std::unique_ptr<rgw::sal::RGWBucket> cur_bucket;
+    ret = init_bucket(user.get(), tenant, bucket_name, string(), &cur_bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init current bucket info for bucket_name=" << bucket_name << ": " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
-    if (cur_bucket_info.bucket.bucket_id == bucket_info.bucket.bucket_id && !yes_i_really_mean_it) {
+    if (cur_bucket->get_bucket_id() == bucket->get_bucket_id() && !yes_i_really_mean_it) {
       cerr << "specified bucket instance points to a current bucket instance" << std::endl;
       cerr << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl;
       return EINVAL;
     }
 
-    int max_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1);
-
-    for (int i = 0; i < max_shards; i++) {
-      RGWRados::BucketShard bs(store->getRados());
-      int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0  ? i : -1);
-      int ret = bs.init(bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */, dpp());
-      if (ret < 0) {
-        cerr << "ERROR: bs.init(bucket=" << bucket << ", shard=" << shard_id << "): " << cpp_strerror(-ret) << std::endl;
-        return -ret;
-      }
-
-      ret = store->getRados()->bi_remove(bs);
-      if (ret < 0) {
-        cerr << "ERROR: failed to remove bucket index object: " << cpp_strerror(-ret) << std::endl;
-        return -ret;
-      }
+    ret = bucket->purge_instance(dpp());
+    if (ret < 0) {
+      return -ret;
     }
   }
 
@@ -6709,14 +6672,13 @@ next:
   }
 
   if (opt_cmd == OPT::OBJECT_RM) {
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
     rgw_obj_key key(object, object_version);
-    ret = rgw_remove_object(dpp(), store, bucket_info, bucket, key);
+    ret = rgw_remove_object(dpp(), store, bucket.get(), key);
 
     if (ret < 0) {
       cerr << "ERROR: object remove returned: " << cpp_strerror(-ret) << std::endl;
@@ -6734,25 +6696,23 @@ next:
       return EINVAL;
     }
 
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
-    rgw::sal::RGWRadosBucket rbucket(store, bucket);
-    rgw::sal::RGWRadosObject obj(store, object, &rbucket);
-    obj.set_instance(object_version);
+    std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(object);
+    obj->set_instance(object_version);
     bool need_rewrite = true;
     if (min_rewrite_stripe_size > 0) {
-      ret = check_min_obj_stripe_size(store, bucket_info, &obj, min_rewrite_stripe_size, &need_rewrite);
+      ret = check_min_obj_stripe_size(store, obj.get(), min_rewrite_stripe_size, &need_rewrite);
       if (ret < 0) {
         ldpp_dout(dpp(), 0) << "WARNING: check_min_obj_stripe_size failed, r=" << ret << dendl;
       }
     }
     if (need_rewrite) {
-      ret = store->getRados()->rewrite_obj(bucket_info, &obj, dpp(), null_yield);
+      ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->rewrite_obj(bucket->get_info(), obj.get(), dpp(), null_yield);
       if (ret < 0) {
         cerr << "ERROR: object rewrite returned: " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -6763,7 +6723,7 @@ next:
   }
 
   if (opt_cmd == OPT::OBJECTS_EXPIRE) {
-    if (!store->getRados()->process_expire_objects(dpp())) {
+    if (!static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->process_expire_objects(dpp())) {
       cerr << "ERROR: process_expire_objects() processing returned error." << std::endl;
       return 1;
     }
@@ -6791,8 +6751,7 @@ next:
       return EINVAL;
     }
 
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -6833,8 +6792,8 @@ next:
       RGWRados::ent_map_t result;
       result.reserve(NUM_ENTRIES);
 
-      int r = store->getRados()->cls_bucket_list_ordered(
-       dpp(), bucket_info, RGW_NO_SHARD,
+      int r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->cls_bucket_list_ordered(
+       dpp(), bucket->get_info(), RGW_NO_SHARD,
        marker, empty_prefix, empty_delimiter,
        NUM_ENTRIES, true, expansion_factor,
        result, &is_truncated, &cls_filtered, &marker,
@@ -6870,12 +6829,11 @@ next:
             (end_epoch > 0 && end_epoch < (uint64_t)ut.sec())) {
           formatter->dump_string("status", "Skipped");
         } else {
-         rgw::sal::RGWRadosBucket rbucket(store, bucket);
-         rgw::sal::RGWRadosObject obj(store, key, &rbucket);
+         std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(key);
 
           bool need_rewrite = true;
           if (min_rewrite_stripe_size > 0) {
-            r = check_min_obj_stripe_size(store, bucket_info, &obj, min_rewrite_stripe_size, &need_rewrite);
+            r = check_min_obj_stripe_size(store, obj.get(), min_rewrite_stripe_size, &need_rewrite);
             if (r < 0) {
               ldpp_dout(dpp(), 0) << "WARNING: check_min_obj_stripe_size failed, r=" << r << dendl;
             }
@@ -6883,7 +6841,7 @@ next:
           if (!need_rewrite) {
             formatter->dump_string("status", "Skipped");
           } else {
-            r = store->getRados()->rewrite_obj(bucket_info, &obj, dpp(), null_yield);
+            r = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->rewrite_obj(bucket->get_info(), obj.get(), dpp(), null_yield);
             if (r == 0) {
               formatter->dump_string("status", "Success");
             } else {
@@ -6903,25 +6861,19 @@ next:
   }
 
   if (opt_cmd == OPT::BUCKET_RESHARD) {
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
-
-    int ret = check_reshard_bucket_params(store,
+    int ret = check_reshard_bucket_params(static_cast<rgw::sal::RGWRadosStore*>(store),
                                          bucket_name,
                                          tenant,
                                          bucket_id,
                                          num_shards_specified,
                                          num_shards,
                                          yes_i_really_mean_it,
-                                         bucket,
-                                         bucket_info,
-                                         attrs);
+                                         &bucket);
     if (ret < 0) {
       return ret;
     }
 
-    RGWBucketReshard br(store, bucket_info, attrs, nullptr /* no callback */);
+    RGWBucketReshard br(static_cast<rgw::sal::RGWRadosStore*>(store), bucket->get_info(), bucket->get_attrs(), nullptr /* no callback */);
 
 #define DEFAULT_RESHARD_MAX_ENTRIES 1000
     if (max_entries < 1) {
@@ -6933,32 +6885,26 @@ next:
   }
 
   if (opt_cmd == OPT::RESHARD_ADD) {
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
-
-    int ret = check_reshard_bucket_params(store,
+    int ret = check_reshard_bucket_params(static_cast<rgw::sal::RGWRadosStore*>(store),
                                          bucket_name,
                                          tenant,
                                          bucket_id,
                                          num_shards_specified,
                                          num_shards,
                                          yes_i_really_mean_it,
-                                         bucket,
-                                         bucket_info,
-                                         attrs);
+                                         &bucket);
     if (ret < 0) {
       return ret;
     }
 
-    int num_source_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1);
+    int num_source_shards = (bucket->get_info().layout.current_index.layout.normal.num_shards > 0 ? bucket->get_info().layout.current_index.layout.normal.num_shards : 1);
 
-    RGWReshard reshard(store, dpp());
+    RGWReshard reshard(static_cast<rgw::sal::RGWRadosStore*>(store), dpp());
     cls_rgw_reshard_entry entry;
     entry.time = real_clock::now();
     entry.tenant = tenant;
     entry.bucket_name = bucket_name;
-    entry.bucket_id = bucket_info.bucket.bucket_id;
+    entry.bucket_id = bucket->get_info().bucket.bucket_id;
     entry.old_num_shards = num_source_shards;
     entry.new_num_shards = num_shards;
 
@@ -6976,7 +6922,7 @@ next:
     int num_logshards =
       store->ctx()->_conf.get_val<uint64_t>("rgw_reshard_num_logs");
 
-    RGWReshard reshard(store, dpp());
+    RGWReshard reshard(static_cast<rgw::sal::RGWRadosStore*>(store), dpp());
 
     formatter->open_array_section("reshard");
     for (int i = 0; i < num_logshards; i++) {
@@ -7014,16 +6960,13 @@ next:
       return EINVAL;
     }
 
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
-    ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs);
+    ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
-    RGWBucketReshard br(store, bucket_info, attrs, nullptr /* no callback */);
+    RGWBucketReshard br(static_cast<rgw::sal::RGWRadosStore*>(store), bucket->get_info(), bucket->get_attrs(), nullptr /* no callback */);
     list<cls_rgw_bucket_instance_entry> status;
     int r = br.get_status(&status);
     if (r < 0) {
@@ -7036,7 +6979,7 @@ next:
   }
 
   if (opt_cmd == OPT::RESHARD_PROCESS) {
-    RGWReshard reshard(store, true, &cout);
+    RGWReshard reshard(static_cast<rgw::sal::RGWRadosStore*>(store), true, &cout);
 
     int ret = reshard.process_all_logshards(dpp());
     if (ret < 0) {
@@ -7051,12 +6994,8 @@ next:
       return EINVAL;
     }
 
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
     bool bucket_initable = true;
-    ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket,
-                      &attrs);
+    ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       if (yes_i_really_mean_it) {
         bucket_initable = false;
@@ -7070,7 +7009,7 @@ next:
 
     if (bucket_initable) {
       // we did not encounter an error, so let's work with the bucket
-      RGWBucketReshard br(store, bucket_info, attrs,
+      RGWBucketReshard br(static_cast<rgw::sal::RGWRadosStore*>(store), bucket->get_info(), bucket->get_attrs(),
                           nullptr /* no callback */);
       int ret = br.cancel();
       if (ret < 0) {
@@ -7087,7 +7026,7 @@ next:
       }
     }
 
-    RGWReshard reshard(store, dpp());
+    RGWReshard reshard(static_cast<rgw::sal::RGWRadosStore*>(store), dpp());
 
     cls_rgw_reshard_entry entry;
     entry.tenant = tenant;
@@ -7103,8 +7042,7 @@ next:
   } // OPT_RESHARD_CANCEL
 
   if (opt_cmd == OPT::OBJECT_UNLINK) {
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -7114,7 +7052,7 @@ next:
     rgw_obj_index_key index_key;
     key.get_index_key(&index_key);
     oid_list.push_back(index_key);
-    ret = store->getRados()->remove_objs_from_index(bucket_info, oid_list);
+    ret = bucket->remove_objs_from_index(oid_list);
     if (ret < 0) {
       cerr << "ERROR: remove_obj_from_index() returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
@@ -7122,36 +7060,28 @@ next:
   }
 
   if (opt_cmd == OPT::OBJECT_STAT) {
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
-    rgw_obj obj(bucket, object);
-    obj.key.set_instance(object_version);
+    std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(object);
+    obj->set_instance(object_version);
 
-    uint64_t obj_size;
-    map<string, bufferlist> attrs;
     RGWObjectCtx obj_ctx(store);
-    RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj);
-    RGWRados::Object::Read read_op(&op_target);
-
-    read_op.params.attrs = &attrs;
-    read_op.params.obj_size = &obj_size;
 
-    ret = read_op.prepare(null_yield, dpp());
+    ret = obj->get_obj_attrs(&obj_ctx, null_yield, dpp());
     if (ret < 0) {
       cerr << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
     }
     formatter->open_object_section("object_metadata");
     formatter->dump_string("name", object);
-    formatter->dump_unsigned("size", obj_size);
+    formatter->dump_unsigned("size", obj->get_obj_size());
 
     map<string, bufferlist>::iterator iter;
     map<string, bufferlist> other_attrs;
-    for (iter = attrs.begin(); iter != attrs.end(); ++iter) {
+    for (iter = obj->get_attrs().begin(); iter != obj->get_attrs().end(); ++iter) {
       bufferlist& bl = iter->second;
       bool handled = false;
       if (iter->first == RGW_ATTR_MANIFEST) {
@@ -7214,7 +7144,7 @@ next:
 
     do {
       list<cls_rgw_gc_obj_info> result;
-      int ret = store->getRados()->list_gc_objs(&index, marker, 1000, !include_all, result, &truncated, processing_queue);
+      int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->list_gc_objs(&index, marker, 1000, !include_all, result, &truncated, processing_queue);
       if (ret < 0) {
        cerr << "ERROR: failed to list objs: " << cpp_strerror(-ret) << std::endl;
        return 1;
@@ -7244,7 +7174,7 @@ next:
   }
 
   if (opt_cmd == OPT::GC_PROCESS) {
-    int ret = store->getRados()->process_gc(!include_all);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->process_gc(!include_all);
     if (ret < 0) {
       cerr << "ERROR: gc processing returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
@@ -7261,7 +7191,7 @@ next:
       max_entries = MAX_LC_LIST_ENTRIES;
     }
     do {
-      int ret = store->getRados()->list_lc_progress(marker, max_entries,
+      int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->list_lc_progress(marker, max_entries,
                                                    bucket_lc_map, index);
       if (ret < 0) {
         cerr << "ERROR: failed to list objs: " << cpp_strerror(-ret)
@@ -7296,18 +7226,15 @@ next:
       return EINVAL;
     }
 
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
     RGWLifecycleConfiguration config;
-    ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs);
+    ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
-    auto aiter = attrs.find(RGW_ATTR_LC);
-    if (aiter == attrs.end()) {
+    auto aiter = bucket->get_attrs().find(RGW_ATTR_LC);
+    if (aiter == bucket->get_attrs().end()) {
       return -ENOENT;
     }
 
@@ -7324,7 +7251,7 @@ next:
   }
 
   if (opt_cmd == OPT::LC_PROCESS) {
-    int ret = store->getRados()->process_lc();
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->process_lc();
     if (ret < 0) {
       cerr << "ERROR: lc processing returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
@@ -7448,15 +7375,14 @@ next:
   }
 
   if (opt_cmd == OPT::USER_CHECK) {
-    check_bad_user_bucket_mapping(store, user_id, fix, null_yield, dpp());
+    check_bad_user_bucket_mapping(store, user.get(), fix, null_yield, dpp());
   }
 
   if (opt_cmd == OPT::USER_STATS) {
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: uid not specified" << std::endl;
       return EINVAL;
     }
-
     if (reset_stats) {
       if (!bucket_name.empty()) {
        cerr << "ERROR: --reset-stats does not work on buckets and "
@@ -7468,7 +7394,7 @@ next:
          "so at most one of the two should be specified" << std::endl;
        return EINVAL;
       }
-      ret = store->ctl()->user->reset_stats(user_id, null_yield);
+      ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->user->reset_stats(user->get_id(), null_yield);
       if (ret < 0) {
        cerr << "ERROR: could not reset user stats: " << cpp_strerror(-ret) <<
          std::endl;
@@ -7478,20 +7404,19 @@ next:
 
     if (sync_stats) {
       if (!bucket_name.empty()) {
-        RGWBucketInfo bucket_info;
-        int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+        int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
         if (ret < 0) {
           cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
           return -ret;
         }
-        ret = store->ctl()->bucket->sync_user_stats(user_id, bucket_info, null_yield);
+        ret = bucket->sync_user_stats(null_yield);
         if (ret < 0) {
           cerr << "ERROR: could not sync bucket stats: " <<
            cpp_strerror(-ret) << std::endl;
           return -ret;
         }
       } else {
-        int ret = rgw_user_sync_all_stats(dpp(), store, user_id, null_yield);
+        int ret = rgw_user_sync_all_stats(dpp(), store, user.get(), null_yield);
         if (ret < 0) {
           cerr << "ERROR: could not sync user stats: " <<
            cpp_strerror(-ret) << std::endl;
@@ -7503,7 +7428,7 @@ next:
     RGWStorageStats stats;
     ceph::real_time last_stats_sync;
     ceph::real_time last_stats_update;
-    int ret = store->ctl()->user->read_stats(user_id, &stats, null_yield,
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->user->read_stats(user->get_id(), &stats, null_yield,
                                             &last_stats_sync,
                                             &last_stats_update);
     if (ret < 0) {
@@ -7528,7 +7453,7 @@ next:
   }
 
   if (opt_cmd == OPT::METADATA_GET) {
-    int ret = store->ctl()->meta.mgr->get(metadata_key, formatter.get(), null_yield, dpp());
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->get(metadata_key, formatter.get(), null_yield, dpp());
     if (ret < 0) {
       cerr << "ERROR: can't get key: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -7544,7 +7469,7 @@ next:
       cerr << "ERROR: failed to read input: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
-    ret = store->ctl()->meta.mgr->put(metadata_key, bl, null_yield, dpp(), RGWMDLogSyncType::APPLY_ALWAYS, false);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->put(metadata_key, bl, null_yield, dpp(), RGWMDLogSyncType::APPLY_ALWAYS, false);
     if (ret < 0) {
       cerr << "ERROR: can't put key: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -7552,7 +7477,7 @@ next:
   }
 
   if (opt_cmd == OPT::METADATA_RM) {
-    int ret = store->ctl()->meta.mgr->remove(metadata_key, null_yield, dpp());
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->remove(metadata_key, null_yield, dpp());
     if (ret < 0) {
       cerr << "ERROR: can't remove key: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -7565,7 +7490,7 @@ next:
     }
     void *handle;
     int max = 1000;
-    int ret = store->ctl()->meta.mgr->list_keys_init(metadata_key, marker, &handle);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init(metadata_key, marker, &handle);
     if (ret < 0) {
       cerr << "ERROR: can't get key: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -7583,7 +7508,7 @@ next:
     do {
       list<string> keys;
       left = (max_entries_specified ? max_entries - count : max);
-      ret = store->ctl()->meta.mgr->list_keys_next(handle, left, keys, &truncated);
+      ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, left, keys, &truncated);
       if (ret < 0 && ret != -ENOENT) {
         cerr << "ERROR: lists_keys_next(): " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -7602,13 +7527,13 @@ next:
       encode_json("truncated", truncated, formatter.get());
       encode_json("count", count, formatter.get());
       if (truncated) {
-        encode_json("marker", store->ctl()->meta.mgr->get_marker(handle), formatter.get());
+        encode_json("marker", static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->get_marker(handle), formatter.get());
       }
       formatter->close_section();
     }
     formatter->flush(cout);
 
-    store->ctl()->meta.mgr->list_keys_complete(handle);
+    static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
   }
 
   if (opt_cmd == OPT::MDLOG_LIST) {
@@ -7636,14 +7561,14 @@ next:
     int i = (specified_shard_id ? shard_id : 0);
 
     if (period_id.empty()) {
-      int ret = read_current_period_id(store, realm_id, realm_name, &period_id);
+      int ret = read_current_period_id(static_cast<rgw::sal::RGWRadosStore*>(store), realm_id, realm_name, &period_id);
       if (ret < 0) {
         return -ret;
       }
       std::cerr << "No --period given, using current period="
           << period_id << std::endl;
     }
-    RGWMetadataLog *meta_log = store->svc()->mdlog->get_log(period_id);
+    RGWMetadataLog *meta_log = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->mdlog->get_log(period_id);
 
     formatter->open_array_section("entries");
     for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) {
@@ -7661,7 +7586,7 @@ next:
 
         for (list<cls_log_entry>::iterator iter = entries.begin(); iter != entries.end(); ++iter) {
           cls_log_entry& entry = *iter;
-          store->ctl()->meta.mgr->dump_log_entry(entry, formatter.get());
+          static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->dump_log_entry(entry, formatter.get());
         }
         formatter->flush(cout);
       } while (truncated);
@@ -7681,14 +7606,14 @@ next:
     int i = (specified_shard_id ? shard_id : 0);
 
     if (period_id.empty()) {
-      int ret = read_current_period_id(store, realm_id, realm_name, &period_id);
+      int ret = read_current_period_id(static_cast<rgw::sal::RGWRadosStore*>(store), realm_id, realm_name, &period_id);
       if (ret < 0) {
         return -ret;
       }
       std::cerr << "No --period given, using current period="
           << period_id << std::endl;
     }
-    RGWMetadataLog *meta_log = store->svc()->mdlog->get_log(period_id);
+    RGWMetadataLog *meta_log = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->mdlog->get_log(period_id);
 
     formatter->open_array_section("entries");
 
@@ -7709,9 +7634,9 @@ next:
 
   if (opt_cmd == OPT::MDLOG_AUTOTRIM) {
     // need a full history for purging old mdlog periods
-    store->svc()->mdlog->init_oldest_log_period(null_yield, dpp());
+    static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->mdlog->init_oldest_log_period(null_yield, dpp());
 
-    RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry());
+    RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry());
     RGWHTTPManager http(store->ctx(), crs.get_completion_mgr());
     int ret = http.start();
     if (ret < 0) {
@@ -7720,7 +7645,7 @@ next:
     }
 
     auto num_shards = g_conf()->rgw_md_log_max_shards;
-    ret = crs.run(create_admin_meta_log_trim_cr(dpp(), store, &http, num_shards));
+    ret = crs.run(create_admin_meta_log_trim_cr(dpp(), static_cast<rgw::sal::RGWRadosStore*>(store), &http, num_shards));
     if (ret < 0) {
       cerr << "automated mdlog trim failed with " << cpp_strerror(ret) << std::endl;
       return -ret;
@@ -7758,7 +7683,7 @@ next:
       std::cerr << "missing --period argument" << std::endl;
       return EINVAL;
     }
-    RGWMetadataLog *meta_log = store->svc()->mdlog->get_log(period_id);
+    RGWMetadataLog *meta_log = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->mdlog->get_log(period_id);
 
     // trim until -ENODATA
     do {
@@ -7779,7 +7704,7 @@ next:
   }
 
   if (opt_cmd == OPT::METADATA_SYNC_STATUS) {
-    RGWMetaSyncStatusManager sync(store, store->svc()->rados->get_async_processor());
+    RGWMetaSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor());
 
     int ret = sync.init();
     if (ret < 0) {
@@ -7820,7 +7745,7 @@ next:
   }
 
   if (opt_cmd == OPT::METADATA_SYNC_INIT) {
-    RGWMetaSyncStatusManager sync(store, store->svc()->rados->get_async_processor());
+    RGWMetaSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor());
 
     int ret = sync.init();
     if (ret < 0) {
@@ -7836,7 +7761,7 @@ next:
 
 
   if (opt_cmd == OPT::METADATA_SYNC_RUN) {
-    RGWMetaSyncStatusManager sync(store, store->svc()->rados->get_async_processor());
+    RGWMetaSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor());
 
     int ret = sync.init();
     if (ret < 0) {
@@ -7856,7 +7781,7 @@ next:
       cerr << "ERROR: source zone not specified" << std::endl;
       return EINVAL;
     }
-    RGWDataSyncStatusManager sync(store, store->svc()->rados->get_async_processor(), source_zone, nullptr);
+    RGWDataSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor(), source_zone, nullptr);
 
     int ret = sync.init();
     if (ret < 0) {
@@ -7920,7 +7845,7 @@ next:
       return EINVAL;
     }
 
-    RGWDataSyncStatusManager sync(store, store->svc()->rados->get_async_processor(), source_zone, nullptr);
+    RGWDataSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor(), source_zone, nullptr);
 
     int ret = sync.init();
     if (ret < 0) {
@@ -7942,14 +7867,14 @@ next:
     }
 
     RGWSyncModuleInstanceRef sync_module;
-    int ret = store->svc()->sync_modules->get_manager()->create_instance(g_ceph_context, store->svc()->zone->get_zone().tier_type,
-        store->svc()->zone->get_zone_params().tier_config, &sync_module);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sync_modules->get_manager()->create_instance(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone().tier_type,
+        store->get_zone_params().tier_config, &sync_module);
     if (ret < 0) {
       lderr(cct) << "ERROR: failed to init sync module instance, ret=" << ret << dendl;
       return ret;
     }
 
-    RGWDataSyncStatusManager sync(store, store->svc()->rados->get_async_processor(), source_zone, nullptr, sync_module);
+    RGWDataSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados->get_async_processor(), source_zone, nullptr, sync_module);
 
     ret = sync.init();
     if (ret < 0) {
@@ -7973,23 +7898,22 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    rgw_bucket bucket;
-    int ret = init_bucket_for_sync(tenant, bucket_name, bucket_id, bucket);
+    int ret = init_bucket_for_sync(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       return -ret;
     }
     auto opt_sb = opt_source_bucket;
     if (opt_sb && opt_sb->bucket_id.empty()) {
       string sbid;
-      rgw_bucket sbuck;
-      int ret = init_bucket_for_sync(opt_sb->tenant, opt_sb->name, sbid, sbuck);
+      std::unique_ptr<rgw::sal::RGWBucket> sbuck;
+      int ret = init_bucket_for_sync(user.get(), opt_sb->tenant, opt_sb->name, sbid, &sbuck);
       if (ret < 0) {
         return -ret;
       }
-      opt_sb = sbuck;
+      opt_sb = sbuck->get_key();
     }
 
-    RGWBucketPipeSyncStatusManager sync(store, source_zone, opt_sb, bucket);
+    RGWBucketPipeSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), source_zone, opt_sb, bucket->get_key());
 
     ret = sync.init();
     if (ret < 0) {
@@ -8012,28 +7936,26 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    rgw_bucket bucket;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       return -ret;
     }
 
-    if (!store->ctl()->bucket->bucket_imports_data(bucket_info.bucket, null_yield, dpp())) {
+    if (!static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->bucket->bucket_imports_data(bucket->get_key(), null_yield, dpp())) {
       std::cout << "Sync is disabled for bucket " << bucket_name << std::endl;
       return 0;
     }
 
     RGWBucketSyncPolicyHandlerRef handler;
-    ret = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, bucket, &handler, null_yield, dpp());
+    ret = store->get_sync_policy_handler(dpp(), std::nullopt, bucket->get_key(), &handler, null_yield);
     if (ret < 0) {
       std::cerr << "ERROR: failed to get policy handler for bucket ("
-          << bucket_info.bucket << "): r=" << ret << ": " << cpp_strerror(-ret) << std::endl;
+          << bucket << "): r=" << ret << ": " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
 
     auto timeout_at = ceph::coarse_mono_clock::now() + opt_timeout_sec;
-    ret = rgw_bucket_sync_checkpoint(dpp(), store, *handler, bucket_info,
+    ret = rgw_bucket_sync_checkpoint(dpp(), static_cast<rgw::sal::RGWRadosStore*>(store), *handler, bucket->get_info(),
                                      opt_source_zone, opt_source_bucket,
                                      opt_retry_delay_ms, timeout_at);
     if (ret < 0) {
@@ -8066,13 +7988,11 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    rgw_bucket bucket;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       return -ret;
     }
-    bucket_sync_info(store, bucket_info, std::cout);
+    bucket_sync_info(static_cast<rgw::sal::RGWRadosStore*>(store), bucket->get_info(), std::cout);
   }
 
   if (opt_cmd == OPT::BUCKET_SYNC_STATUS) {
@@ -8080,13 +8000,11 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    rgw_bucket bucket;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       return -ret;
     }
-    bucket_sync_status(store, bucket_info, source_zone, opt_source_bucket, std::cout);
+    bucket_sync_status(static_cast<rgw::sal::RGWRadosStore*>(store), bucket->get_info(), source_zone, opt_source_bucket, std::cout);
   }
 
   if (opt_cmd == OPT::BUCKET_SYNC_MARKERS) {
@@ -8098,12 +8016,11 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    rgw_bucket bucket;
-    int ret = init_bucket_for_sync(tenant, bucket_name, bucket_id, bucket);
+    int ret = init_bucket_for_sync(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       return -ret;
     }
-    RGWBucketPipeSyncStatusManager sync(store, source_zone, opt_source_bucket, bucket);
+    RGWBucketPipeSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), source_zone, opt_source_bucket, bucket->get_key());
 
     ret = sync.init();
     if (ret < 0) {
@@ -8131,12 +8048,11 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    rgw_bucket bucket;
-    int ret = init_bucket_for_sync(tenant, bucket_name, bucket_id, bucket);
+    int ret = init_bucket_for_sync(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       return -ret;
     }
-    RGWBucketPipeSyncStatusManager sync(store, source_zone, opt_source_bucket, bucket);
+    RGWBucketPipeSyncStatusManager sync(static_cast<rgw::sal::RGWRadosStore*>(store), source_zone, opt_source_bucket, bucket->get_key());
 
     ret = sync.init();
     if (ret < 0) {
@@ -8156,8 +8072,7 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -8170,7 +8085,7 @@ next:
 
     do {
       list<rgw_bi_log_entry> entries;
-      ret = store->svc()->bilog_rados->log_list(bucket_info, shard_id, marker, max_entries - count, entries, &truncated);
+      ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->log_list(bucket->get_info(), shard_id, marker, max_entries - count, entries, &truncated);
       if (ret < 0) {
         cerr << "ERROR: list_bi_log_entries(): " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -8234,7 +8149,7 @@ next:
 
       do {
         list<cls_log_entry> entries;
-        ret = store->svc()->cls->timelog.list(oid, {}, {}, max_entries - count, entries, marker, &marker, &truncated,
+        ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->timelog.list(oid, {}, {}, max_entries - count, entries, marker, &marker, &truncated,
                                              null_yield);
        if (ret == -ENOENT) {
          break;
@@ -8555,8 +8470,8 @@ next:
       }
     }
 
-    if (!user_id.empty()) {
-      pipe->params.user = user_id;
+    if (user) {
+      pipe->params.user = user->get_id();
     } else if (pipe->params.user.empty()) {
       auto owner = sync_policy_ctx.get_owner();
       if (owner) {
@@ -8647,13 +8562,12 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
-    ret = store->svc()->bilog_rados->log_trim(bucket_info, shard_id, start_marker, end_marker);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->log_trim(bucket->get_info(), shard_id, start_marker, end_marker);
     if (ret < 0) {
       cerr << "ERROR: trim_bi_log_entries(): " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -8665,14 +8579,13 @@ next:
       cerr << "ERROR: bucket not specified" << std::endl;
       return EINVAL;
     }
-    RGWBucketInfo bucket_info;
-    int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+    int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
     if (ret < 0) {
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
     map<int, string> markers;
-    ret = store->svc()->bilog_rados->get_log_status(bucket_info, shard_id,
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->get_log_status(bucket->get_info(), shard_id,
                                                    &markers, null_yield);
     if (ret < 0) {
       cerr << "ERROR: get_bi_log_status(): " << cpp_strerror(-ret) << std::endl;
@@ -8685,7 +8598,7 @@ next:
   }
 
   if (opt_cmd == OPT::BILOG_AUTOTRIM) {
-    RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry());
+    RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry());
     RGWHTTPManager http(store->ctx(), crs.get_completion_mgr());
     int ret = http.start();
     if (ret < 0) {
@@ -8696,7 +8609,7 @@ next:
     rgw::BucketTrimConfig config;
     configure_bucket_trim(store->ctx(), config);
 
-    rgw::BucketTrimManager trim(store, config);
+    rgw::BucketTrimManager trim(static_cast<rgw::sal::RGWRadosStore*>(store), config);
     ret = trim.init();
     if (ret < 0) {
       cerr << "trim manager init failed with " << cpp_strerror(ret) << std::endl;
@@ -8736,7 +8649,7 @@ next:
       }
     }
 
-    auto datalog_svc = store->svc()->datalog_rados;
+    auto datalog_svc = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados;
     RGWDataChangesLog::LogMarker log_marker;
 
     do {
@@ -8781,7 +8694,7 @@ next:
       list<cls_log_entry> entries;
 
       RGWDataChangesLogInfo info;
-      store->svc()->datalog_rados->get_info(i, &info);
+      static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados->get_info(i, &info);
 
       ::encode_json("info", info, formatter.get());
 
@@ -8794,7 +8707,7 @@ next:
   }
 
   if (opt_cmd == OPT::DATALOG_AUTOTRIM) {
-    RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry());
+    RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry());
     RGWHTTPManager http(store->ctx(), crs.get_completion_mgr());
     int ret = http.start();
     if (ret < 0) {
@@ -8804,7 +8717,7 @@ next:
 
     auto num_shards = g_conf()->rgw_data_log_num_shards;
     std::vector<std::string> markers(num_shards);
-    ret = crs.run(create_admin_data_log_trim_cr(store, &http, num_shards, markers));
+    ret = crs.run(create_admin_data_log_trim_cr(static_cast<rgw::sal::RGWRadosStore*>(store), &http, num_shards, markers));
     if (ret < 0) {
       cerr << "automated datalog trim failed with " << cpp_strerror(ret) << std::endl;
       return -ret;
@@ -8840,7 +8753,7 @@ next:
 
     // loop until -ENODATA
     do {
-      auto datalog = store->svc()->datalog_rados;
+      auto datalog = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados;
       ret = datalog->trim_entries(shard_id, marker);
     } while (ret == 0);
 
@@ -8853,7 +8766,7 @@ next:
   bool quota_op = (opt_cmd == OPT::QUOTA_SET || opt_cmd == OPT::QUOTA_ENABLE || opt_cmd == OPT::QUOTA_DISABLE);
 
   if (quota_op) {
-    if (bucket_name.empty() && user_id.empty()) {
+    if (bucket_name.empty() && !user) {
       cerr << "ERROR: bucket name or uid is required for quota operation" << std::endl;
       return EINVAL;
     }
@@ -8865,11 +8778,11 @@ next:
       }
       set_bucket_quota(store, opt_cmd, tenant, bucket_name,
                        max_size, max_objects, have_max_size, have_max_objects);
-    } else if (!user_id.empty()) {
+    } else if (user) {
       if (quota_scope == "bucket") {
-        return set_user_bucket_quota(opt_cmd, user, user_op, max_size, max_objects, have_max_size, have_max_objects);
+        return set_user_bucket_quota(opt_cmd, ruser, user_op, max_size, max_objects, have_max_size, have_max_objects);
       } else if (quota_scope == "user") {
-        return set_user_quota(opt_cmd, user, user_op, max_size, max_objects, have_max_size, have_max_objects);
+        return set_user_quota(opt_cmd, ruser, user_op, max_size, max_objects, have_max_size, have_max_objects);
       } else {
         cerr << "ERROR: invalid quota scope specification. Please specify either --quota-scope=bucket, or --quota-scope=user" << std::endl;
         return EINVAL;
@@ -8880,7 +8793,7 @@ next:
   if (opt_cmd == OPT::MFA_CREATE) {
     rados::cls::otp::otp_info_t config;
 
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: user id was not provided (via --uid)" << std::endl;
       return EINVAL;
     }
@@ -8919,14 +8832,14 @@ next:
     }
 
     real_time mtime = real_clock::now();
-    string oid = store->svc()->cls->mfa.get_mfa_oid(user_id);
+    string oid = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.get_mfa_oid(user->get_id());
 
-    int ret = store->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user_id),
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user->get_id()),
                                             mtime, &objv_tracker,
                                             null_yield, dpp(),
                                             MDLOG_STATUS_WRITE,
                                             [&] {
-      return store->svc()->cls->mfa.create_mfa(user_id, config, &objv_tracker, mtime, null_yield);
+      return static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.create_mfa(user->get_id(), config, &objv_tracker, mtime, null_yield);
     });
     if (ret < 0) {
       cerr << "MFA creation failed, error: " << cpp_strerror(-ret) << std::endl;
@@ -8937,7 +8850,7 @@ next:
     user_info.mfa_ids.insert(totp_serial);
     user_op.set_mfa_ids(user_info.mfa_ids);
     string err;
-    ret = user.modify(dpp(), user_op, null_yield, &err);
+    ret = ruser.modify(dpp(), user_op, null_yield, &err);
     if (ret < 0) {
       cerr << "ERROR: failed storing user info, error: " << err << std::endl;
       return -ret;
@@ -8945,7 +8858,7 @@ next:
   }
 
  if (opt_cmd == OPT::MFA_REMOVE) {
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: user id was not provided (via --uid)" << std::endl;
       return EINVAL;
     }
@@ -8957,12 +8870,12 @@ next:
 
     real_time mtime = real_clock::now();
 
-    int ret = store->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user_id),
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user->get_id()),
                                             mtime, &objv_tracker,
                                             null_yield, dpp(),
                                             MDLOG_STATUS_WRITE,
                                             [&] {
-      return store->svc()->cls->mfa.remove_mfa(user_id, totp_serial, &objv_tracker, mtime, null_yield);
+      return static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.remove_mfa(user->get_id(), totp_serial, &objv_tracker, mtime, null_yield);
     });
     if (ret < 0) {
       cerr << "MFA removal failed, error: " << cpp_strerror(-ret) << std::endl;
@@ -8973,7 +8886,7 @@ next:
     user_info.mfa_ids.erase(totp_serial);
     user_op.set_mfa_ids(user_info.mfa_ids);
     string err;
-    ret = user.modify(dpp(), user_op, null_yield, &err);
+    ret = ruser.modify(dpp(), user_op, null_yield, &err);
     if (ret < 0) {
       cerr << "ERROR: failed storing user info, error: " << err << std::endl;
       return -ret;
@@ -8981,7 +8894,7 @@ next:
   }
 
  if (opt_cmd == OPT::MFA_GET) {
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: user id was not provided (via --uid)" << std::endl;
       return EINVAL;
     }
@@ -8992,7 +8905,7 @@ next:
     }
 
     rados::cls::otp::otp_info_t result;
-    int ret = store->svc()->cls->mfa.get_mfa(user_id, totp_serial, &result, null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.get_mfa(user->get_id(), totp_serial, &result, null_yield);
     if (ret < 0) {
       if (ret == -ENOENT || ret == -ENODATA) {
         cerr << "MFA serial id not found" << std::endl;
@@ -9008,13 +8921,13 @@ next:
   }
 
  if (opt_cmd == OPT::MFA_LIST) {
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: user id was not provided (via --uid)" << std::endl;
       return EINVAL;
     }
 
     list<rados::cls::otp::otp_info_t> result;
-    int ret = store->svc()->cls->mfa.list_mfa(user_id, &result, null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.list_mfa(user->get_id(), &result, null_yield);
     if (ret < 0) {
       cerr << "MFA listing failed, error: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -9026,7 +8939,7 @@ next:
   }
 
  if (opt_cmd == OPT::MFA_CHECK) {
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: user id was not provided (via --uid)" << std::endl;
       return EINVAL;
     }
@@ -9042,7 +8955,7 @@ next:
     }
 
     list<rados::cls::otp::otp_info_t> result;
-    int ret = store->svc()->cls->mfa.check_mfa(user_id, totp_serial, totp_pin.front(), null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.check_mfa(user->get_id(), totp_serial, totp_pin.front(), null_yield);
     if (ret < 0) {
       cerr << "MFA check failed, error: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -9052,7 +8965,7 @@ next:
   }
 
  if (opt_cmd == OPT::MFA_RESYNC) {
-    if (user_id.empty()) {
+    if (!user) {
       cerr << "ERROR: user id was not provided (via --uid)" << std::endl;
       return EINVAL;
     }
@@ -9067,7 +8980,7 @@ next:
     }
 
     rados::cls::otp::otp_info_t config;
-    int ret = store->svc()->cls->mfa.get_mfa(user_id, totp_serial, &config, null_yield);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.get_mfa(user->get_id(), totp_serial, &config, null_yield);
     if (ret < 0) {
       if (ret == -ENOENT || ret == -ENODATA) {
         cerr << "MFA serial id not found" << std::endl;
@@ -9079,7 +8992,7 @@ next:
 
     ceph::real_time now;
 
-    ret = store->svc()->cls->mfa.otp_get_current_time(user_id, &now, null_yield);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.otp_get_current_time(user->get_id(), &now, null_yield);
     if (ret < 0) {
       cerr << "ERROR: failed to fetch current time from osd: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -9101,12 +9014,12 @@ next:
     /* now update the backend */
     real_time mtime = real_clock::now();
 
-    ret = store->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user_id),
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user->get_id()),
                                         mtime, &objv_tracker,
                                         null_yield, dpp(),
                                         MDLOG_STATUS_WRITE,
                                         [&] {
-      return store->svc()->cls->mfa.create_mfa(user_id, config, &objv_tracker, mtime, null_yield);
+      return static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.create_mfa(user->get_id(), config, &objv_tracker, mtime, null_yield);
     });
     if (ret < 0) {
       cerr << "MFA update failed, error: " << cpp_strerror(-ret) << std::endl;
@@ -9116,7 +9029,7 @@ next:
  }
 
  if (opt_cmd == OPT::RESHARD_STALE_INSTANCES_LIST) {
-   if (!store->svc()->zone->can_reshard() && !yes_i_really_mean_it) {
+   if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->can_reshard() && !yes_i_really_mean_it) {
      cerr << "Resharding disabled in a multisite env, stale instances unlikely from resharding" << std::endl;
      cerr << "These instances may not be safe to delete." << std::endl;
      cerr << "Use --yes-i-really-mean-it to force displaying these instances." << std::endl;
@@ -9130,7 +9043,7 @@ next:
  }
 
  if (opt_cmd == OPT::RESHARD_STALE_INSTANCES_DELETE) {
-   if (!store->svc()->zone->can_reshard()) {
+   if (!static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->can_reshard()) {
      cerr << "Resharding disabled in a multisite env. Stale instances are not safe to be deleted." << std::endl;
      return EINVAL;
    }
@@ -9143,20 +9056,17 @@ next:
 
   if (opt_cmd == OPT::PUBSUB_TOPICS_LIST) {
 
-    RGWPubSub ps(store, tenant);
-
-    rgw_bucket bucket;
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     if (!bucket_name.empty()) {
       rgw_pubsub_bucket_topics result;
-      RGWBucketInfo bucket_info;
-      int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
+      int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket);
       if (ret < 0) {
         cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
         return -ret;
       }
 
-      auto b = ps.get_bucket(bucket_info.bucket);
+      auto b = ps.get_bucket(bucket->get_key());
       ret = b->get_topics(&result);
       if (ret < 0) {
         cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;
@@ -9181,7 +9091,7 @@ next:
       return EINVAL;
     }
 
-    RGWPubSub ps(store, tenant);
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     rgw_pubsub_topic_subs topic;
     ret = ps.get_topic(topic_name, &topic);
@@ -9199,7 +9109,7 @@ next:
       return EINVAL;
     }
 
-    RGWPubSub ps(store, tenant);
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     ret = ps.remove_topic(topic_name, null_yield);
     if (ret < 0) {
@@ -9209,7 +9119,7 @@ next:
   }
 
   if (opt_cmd == OPT::PUBSUB_SUB_GET) {
-    if (get_tier_type(store) != "pubsub") {
+    if (get_tier_type(static_cast<rgw::sal::RGWRadosStore*>(store)) != "pubsub") {
       cerr << "ERROR: only pubsub tier type supports this command" << std::endl;
       return EINVAL;
     }
@@ -9218,7 +9128,7 @@ next:
       return EINVAL;
     }
 
-    RGWPubSub ps(store, tenant);
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     rgw_pubsub_sub_config sub_conf;
 
@@ -9233,7 +9143,7 @@ next:
   }
 
  if (opt_cmd == OPT::PUBSUB_SUB_RM) {
-    if (get_tier_type(store) != "pubsub") {
+    if (get_tier_type(static_cast<rgw::sal::RGWRadosStore*>(store)) != "pubsub") {
       cerr << "ERROR: only pubsub tier type supports this command" << std::endl;
       return EINVAL;
     }
@@ -9242,7 +9152,7 @@ next:
       return EINVAL;
     }
 
-    RGWPubSub ps(store, tenant);
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     auto sub = ps.get_sub(sub_name);
     ret = sub->unsubscribe(topic_name, null_yield);
@@ -9253,7 +9163,7 @@ next:
   }
 
  if (opt_cmd == OPT::PUBSUB_SUB_PULL) {
-    if (get_tier_type(store) != "pubsub") {
+    if (get_tier_type(static_cast<rgw::sal::RGWRadosStore*>(store)) != "pubsub") {
       cerr << "ERROR: only pubsub tier type supports this command" << std::endl;
       return EINVAL;
     }
@@ -9262,7 +9172,7 @@ next:
       return EINVAL;
     }
 
-    RGWPubSub ps(store, tenant);
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     if (!max_entries_specified) {
       max_entries = RGWPubSub::Sub::DEFAULT_MAX_EVENTS;
@@ -9278,7 +9188,7 @@ next:
  }
 
  if (opt_cmd == OPT::PUBSUB_EVENT_RM) {
-    if (get_tier_type(store) != "pubsub") {
+    if (get_tier_type(static_cast<rgw::sal::RGWRadosStore*>(store)) != "pubsub") {
       cerr << "ERROR: only pubsub tier type supports this command" << std::endl;
       return EINVAL;
     }
@@ -9291,7 +9201,7 @@ next:
       return EINVAL;
     }
 
-    RGWPubSub ps(store, tenant);
+    RGWPubSub ps(static_cast<rgw::sal::RGWRadosStore*>(store), tenant);
 
     auto sub = ps.get_sub_with_events(sub_name);
     ret = sub->remove_event(dpp(), event_id);
index eee5a5fc8b7011c5f94380eb66f8e92ed6e7e1ba..bee4b72b9ec30cfe9eb56120142ecb62101349e2 100644 (file)
@@ -26,11 +26,11 @@ namespace rgw {
 
   class RGWLibAdmin
   {
-    rgw::sal::RGWRadosStore *store;
+    rgw::sal::RGWStore *store;
     boost::intrusive_ptr<CephContext> cct;
 
   public:
-    rgw::sal::RGWRadosStore* get_store()
+    rgw::sal::RGWStore* get_store()
     {
       return store;
     }
index 7bafaf9e87552c2f286832997494d3e7ec4c6e7c..e140c40b2deb9da00754fa510297685da4633e3d 100644 (file)
@@ -231,7 +231,7 @@ void handle_connection(boost::asio::io_context& context,
       }
 
       // process the request
-      RGWRequest req{env.store->getRados()->get_new_req_id()};
+      RGWRequest req{env.store->get_new_req_id()};
 
       auto& socket = get_lowest_layer(stream).socket();
       const auto& remote_endpoint = socket.remote_endpoint(ec);
@@ -415,7 +415,7 @@ class AsioFrontend {
   void stop();
   void join();
   void pause();
-  void unpause(rgw::sal::RGWRadosStore* store, rgw_auth_registry_ptr_t);
+  void unpause(rgw::sal::RGWStore* store, rgw_auth_registry_ptr_t);
 };
 
 unsigned short parse_port(const char *input, boost::system::error_code& ec)
@@ -709,8 +709,7 @@ int AsioFrontend::get_config_key_val(string name,
     return -EINVAL;
   }
 
-  auto svc = env.store->svc()->config_key;
-  int r = svc->get(name, true, pbl);
+  int r = env.store->get_config_key_val(name, pbl);
   if (r < 0) {
     lderr(ctx()) << type << " was not found: " << name << dendl;
     return r;
@@ -816,7 +815,7 @@ int AsioFrontend::init_ssl()
       key_is_cert = true;
     }
 
-    ExpandMetaVar emv(env.store->svc()->zone);
+    ExpandMetaVar emv(static_cast<rgw::sal::RGWRadosStore*>(env.store)->svc()->zone);
 
     cert = emv.process_str(*cert);
     key = emv.process_str(*key);
@@ -1014,7 +1013,7 @@ void AsioFrontend::pause()
   }
 }
 
-void AsioFrontend::unpause(rgw::sal::RGWRadosStore* const store,
+void AsioFrontend::unpause(rgw::sal::RGWStore* const store,
                            rgw_auth_registry_ptr_t auth_registry)
 {
   env.store = store;
@@ -1078,7 +1077,7 @@ void RGWAsioFrontend::pause_for_new_config()
 }
 
 void RGWAsioFrontend::unpause_with_new_config(
-  rgw::sal::RGWRadosStore* const store,
+  rgw::sal::RGWStore* const store,
   rgw_auth_registry_ptr_t auth_registry
 ) {
   impl->unpause(store, std::move(auth_registry));
index d5aaee5bcea31d6ac6b970b50498260ed16f74d4..e6317e43622eb5e4a4ea7c7d18215ab2bc326cc9 100644 (file)
@@ -22,7 +22,7 @@ public:
   void join() override;
 
   void pause_for_new_config() override;
-  void unpause_with_new_config(rgw::sal::RGWRadosStore *store,
+  void unpause_with_new_config(rgw::sal::RGWStore *store,
                                rgw_auth_registry_ptr_t auth_registry) override;
 };
 
index 81094fe569dcf894c6dc344b1427631b3a209103..fee9fa4b99f9b671e08c893e82ed2820d3bc1a30 100644 (file)
@@ -297,6 +297,11 @@ struct rgw_bucket {
   // cppcheck-suppress noExplicitConstructor
   explicit rgw_bucket(const rgw_user& u, const cls_user_bucket& b);
 
+  rgw_bucket(const std::string& _tenant,
+            const std::string& _name,
+            const std::string& _bucket_id) : tenant(_tenant),
+                                              name(_name),
+                                              bucket_id(_bucket_id) {}
   rgw_bucket(const rgw_bucket_key& bk) : tenant(bk.tenant),
                                          name(bk.name),
                                          bucket_id(bk.bucket_id) {}
index 1ebda084be11ee46cdbed243037d91c53ff16c7d..bde80d5f70e2139fd1ea646dabae4e2fce808db1 100644 (file)
@@ -50,7 +50,6 @@
 
 #include "cls/user/cls_user_types.h"
 
-#include "rgw_sal.h"
 #include "rgw_sal_rados.h"
 
 #define dout_context g_ceph_context
@@ -148,24 +147,6 @@ void rgw_parse_url_bucket(const string &bucket, const string& auth_tenant,
   }
 }
 
-/**
- * Get all the buckets owned by a user and fill up an RGWUserBuckets with them.
- * Returns: 0 on success, -ERR# on failure.
- */
-int rgw_read_user_buckets(const DoutPrefixProvider *dpp, 
-                          rgw::sal::RGWRadosStore * store,
-                          const rgw_user& user_id,
-                          rgw::sal::RGWBucketList& buckets,
-                          const string& marker,
-                          const string& end_marker,
-                          uint64_t max,
-                          bool need_stats,
-                         optional_yield y)
-{
-  rgw::sal::RGWRadosUser user(store, user_id);
-  return user.list_buckets(dpp, marker, end_marker, max, need_stats, buckets, y);
-}
-
 int rgw_bucket_parse_bucket_instance(const string& bucket_instance, string *bucket_name, string *bucket_id, int *shard_id)
 {
   auto pos = bucket_instance.rfind(':');
@@ -260,13 +241,12 @@ static void dump_mulipart_index_results(list<rgw_obj_index_key>& objs_to_unlink,
   }
 }
 
-void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_user& user_id,
+void check_bad_user_bucket_mapping(rgw::sal::RGWStore *store, rgw::sal::RGWUser* user,
                                   bool fix,
                                   optional_yield y,
                                    const DoutPrefixProvider *dpp)
 {
   rgw::sal::RGWBucketList user_buckets;
-  rgw::sal::RGWRadosUser user(store, user_id);
   string marker;
 
   CephContext *cct = store->ctx();
@@ -274,7 +254,7 @@ void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_use
   size_t max_entries = cct->_conf->rgw_list_buckets_max_chunk;
 
   do {
-    int ret = user.list_buckets(dpp, marker, string(), max_entries, false, user_buckets, y);
+    int ret = user->list_buckets(dpp, marker, string(), max_entries, false, user_buckets, y);
     if (ret < 0) {
       ldout(store->ctx(), 0) << "failed to read user buckets: "
                             << cpp_strerror(-ret) << dendl;
@@ -289,26 +269,21 @@ void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_use
 
       auto& bucket = i->second;
 
-      RGWBucketInfo bucket_info;
-      real_time mtime;
-      int r = store->getRados()->get_bucket_info(store->svc(), user_id.tenant, bucket->get_name(), bucket_info, &mtime, null_yield, dpp);
+      std::unique_ptr<rgw::sal::RGWBucket> actual_bucket;
+      int r = store->get_bucket(dpp, user, user->get_tenant(), bucket->get_name(), &actual_bucket, null_yield);
       if (r < 0) {
         ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << dendl;
         continue;
       }
 
-      rgw_bucket& actual_bucket = bucket_info.bucket;
-
-      if (actual_bucket.name.compare(bucket->get_name()) != 0 ||
-          actual_bucket.tenant.compare(bucket->get_tenant()) != 0 ||
-          actual_bucket.marker.compare(bucket->get_marker()) != 0 ||
-          actual_bucket.bucket_id.compare(bucket->get_bucket_id()) != 0) {
+      if (actual_bucket->get_name().compare(bucket->get_name()) != 0 ||
+          actual_bucket->get_tenant().compare(bucket->get_tenant()) != 0 ||
+          actual_bucket->get_marker().compare(bucket->get_marker()) != 0 ||
+          actual_bucket->get_bucket_id().compare(bucket->get_bucket_id()) != 0) {
         cout << "bucket info mismatch: expected " << actual_bucket << " got " << bucket << std::endl;
         if (fix) {
           cout << "fixing" << std::endl;
-          r = store->ctl()->bucket->link_bucket(user_id, actual_bucket,
-                                             bucket_info.creation_time,
-                                            null_yield, dpp);
+         r = actual_bucket->link(dpp, user, null_yield);
           if (r < 0) {
             cerr << "failed to fix bucket: " << cpp_strerror(-r) << std::endl;
           }
@@ -326,7 +301,7 @@ bool rgw_bucket_object_check_filter(const string& oid)
   return rgw_obj_key::oid_to_key_in_ns(oid, &key, ns);
 }
 
-int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key)
+int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store, rgw::sal::RGWBucket* bucket, rgw_obj_key& key)
 {
   RGWObjectCtx rctx(store);
 
@@ -334,90 +309,63 @@ int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *st
     key.instance = "null";
   }
 
-  rgw_obj obj(bucket, key);
-
-  return store->getRados()->delete_obj(dpp, rctx, bucket_info, obj, bucket_info.versioning_status());
-}
-
-static int aio_wait(librados::AioCompletion *handle)
-{
-  librados::AioCompletion *c = (librados::AioCompletion *)handle;
-  c->wait_for_complete();
-  int ret = c->get_return_value();
-  c->release();
-  return ret;
-}
+  std::unique_ptr<rgw::sal::RGWObject> object = bucket->get_object(key);
 
-static int drain_handles(list<librados::AioCompletion *>& pending)
-{
-  int ret = 0;
-  while (!pending.empty()) {
-    librados::AioCompletion *handle = pending.front();
-    pending.pop_front();
-    int r = aio_wait(handle);
-    if (r < 0) {
-      ret = r;
-    }
-  }
-  return ret;
+  return object->delete_object(dpp, &rctx, null_yield);
 }
 
-int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& bucket,
+int rgw_remove_bucket_bypass_gc(rgw::sal::RGWStore *store, rgw::sal::RGWBucket* bucket,
                                 int concurrent_max, bool keep_index_consistent,
                                 optional_yield y,
                                 const DoutPrefixProvider *dpp)
 {
   int ret;
   map<RGWObjCategory, RGWStorageStats> stats;
-  std::vector<rgw_bucket_dir_entry> objs;
   map<string, bool> common_prefixes;
-  RGWBucketInfo info;
   RGWObjectCtx obj_ctx(store);
   CephContext *cct = store->ctx();
 
   string bucket_ver, master_ver;
 
-  ret = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, info, NULL, null_yield, dpp);
+  ret = bucket->get_bucket_info(dpp, null_yield);
   if (ret < 0)
     return ret;
 
-  ret = store->getRados()->get_bucket_stats(info, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, NULL);
+  ret = bucket->get_bucket_stats(RGW_NO_SHARD, &bucket_ver, &master_ver, stats, NULL);
   if (ret < 0)
     return ret;
 
   string prefix, delimiter;
 
-  ret = abort_bucket_multiparts(dpp, store, cct, info, prefix, delimiter);
+  ret = abort_bucket_multiparts(dpp, store, cct, bucket, prefix, delimiter);
   if (ret < 0) {
     return ret;
   }
 
-  RGWRados::Bucket target(store->getRados(), info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
-  list_op.params.list_versions = true;
-  list_op.params.allow_unordered = true;
+  params.list_versions = true;
+  params.allow_unordered = true;
 
-  std::list<librados::AioCompletion*> handles;
+  std::unique_ptr<rgw::sal::Completions> handles = store->get_completions();
 
   int max_aio = concurrent_max;
-  bool is_truncated = true;
+  results.is_truncated = true;
 
-  while (is_truncated) {
-    objs.clear();
-    ret = list_op.list_objects(dpp, listing_max_entries, &objs, &common_prefixes,
-                              &is_truncated, null_yield);
+  while (results.is_truncated) {
+    ret = bucket->list(dpp, params, listing_max_entries, results, null_yield);
     if (ret < 0)
       return ret;
 
-    std::vector<rgw_bucket_dir_entry>::iterator it = objs.begin();
-    for (; it != objs.end(); ++it) {
+    std::vector<rgw_bucket_dir_entry>::iterator it = results.objs.begin();
+    for (; it != results.objs.end(); ++it) {
       RGWObjState *astate = NULL;
-      rgw_obj obj(bucket, (*it).key);
+      std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object((*it).key);
 
-      ret = store->getRados()->get_obj_state(dpp, &obj_ctx, info, obj, &astate, false, y);
+      ret = obj->get_obj_state(dpp, &obj_ctx, &astate, y, false);
       if (ret == -ENOENT) {
-        dout(1) << "WARNING: cannot find obj state for obj " << obj.get_oid() << dendl;
+        dout(1) << "WARNING: cannot find obj state for obj " << obj << dendl;
         continue;
       }
       if (ret < 0) {
@@ -428,14 +376,13 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck
       if (astate->manifest) {
         RGWObjManifest& manifest = *astate->manifest;
         RGWObjManifest::obj_iterator miter = manifest.obj_begin();
-        rgw_obj head_obj = manifest.get_obj();
+       std::unique_ptr<rgw::sal::RGWObject> head_obj = bucket->get_object(manifest.get_obj().key);
         rgw_raw_obj raw_head_obj;
-        store->getRados()->obj_to_raw(info.placement_rule, head_obj, &raw_head_obj);
-
+       head_obj->get_raw_obj(&raw_head_obj);
 
         for (; miter != manifest.obj_end() && max_aio--; ++miter) {
           if (!max_aio) {
-            ret = drain_handles(handles);
+            ret = handles->drain();
             if (ret < 0) {
               lderr(store->ctx()) << "ERROR: could not drain handles as aio completion returned with " << ret << dendl;
               return ret;
@@ -449,14 +396,14 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck
             continue;
           }
 
-          ret = store->getRados()->delete_raw_obj_aio(last_obj, handles);
+          ret = store->delete_raw_obj_aio(last_obj, handles.get());
           if (ret < 0) {
             lderr(store->ctx()) << "ERROR: delete obj aio failed with " << ret << dendl;
             return ret;
           }
         } // for all shadow objs
 
-        ret = store->getRados()->delete_obj_aio(dpp, head_obj, info, astate, handles, keep_index_consistent, null_yield);
+       ret = head_obj->delete_obj_aio(dpp, astate, handles.get(), keep_index_consistent, null_yield);
         if (ret < 0) {
           lderr(store->ctx()) << "ERROR: delete obj aio failed with " << ret << dendl;
           return ret;
@@ -464,24 +411,24 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck
       }
 
       if (!max_aio) {
-        ret = drain_handles(handles);
+        ret = handles->drain();
         if (ret < 0) {
           lderr(store->ctx()) << "ERROR: could not drain handles as aio completion returned with " << ret << dendl;
           return ret;
         }
         max_aio = concurrent_max;
       }
-      obj_ctx.invalidate(obj);
+      obj_ctx.invalidate(obj->get_obj());
     } // for all RGW objects
   }
 
-  ret = drain_handles(handles);
+  ret = handles->drain();
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: could not drain handles as aio completion returned with " << ret << dendl;
     return ret;
   }
 
-  ret = store->ctl()->bucket->sync_user_stats(info.owner, info, y);
+  bucket->sync_user_stats(y);
   if (ret < 0) {
      dout(1) << "WARNING: failed sync user stats before bucket delete. ret=" <<  ret << dendl;
   }
@@ -491,17 +438,12 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck
   // this function can only be run if caller wanted children to be
   // deleted, so we can ignore the check for children as any that
   // remain are detritus from a prior bug
-  ret = store->getRados()->delete_bucket(info, objv_tracker, y, dpp, false);
+  ret = bucket->remove_bucket(dpp, true, std::string(), std::string(), false, nullptr, y);
   if (ret < 0) {
-    lderr(store->ctx()) << "ERROR: could not remove bucket " << bucket.name << dendl;
+    lderr(store->ctx()) << "ERROR: could not remove bucket " << bucket << dendl;
     return ret;
   }
 
-  ret = store->ctl()->bucket->unlink_bucket(info.owner, bucket, null_yield, dpp, false);
-  if (ret < 0) {
-    lderr(store->ctx()) << "ERROR: unable to remove user bucket information" << dendl;
-  }
-
   return ret;
 }
 
@@ -511,54 +453,49 @@ static void set_err_msg(std::string *sink, std::string msg)
     *sink = msg;
 }
 
-int RGWBucket::init(rgw::sal::RGWRadosStore *storage, RGWBucketAdminOpState& op_state,
-                    optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg,
-                    map<string, bufferlist> *pattrs)
+int RGWBucket::init(rgw::sal::RGWStore *_store, RGWBucketAdminOpState& op_state,
+                    optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg)
 {
-  if (!storage) {
+  if (!_store) {
     set_err_msg(err_msg, "no storage!");
     return -EINVAL;
   }
 
-  store = storage;
+  store = _store;
 
-  rgw_user user_id = op_state.get_user_id();
-  bucket.tenant = user_id.tenant;
-  bucket.name = op_state.get_bucket_name();
+  std::string bucket_name = op_state.get_bucket_name();
 
-  if (bucket.name.empty() && user_id.empty())
+  if (bucket_name.empty() && op_state.get_user_id().empty())
     return -EINVAL;
-  
+
+  user = store->get_user(op_state.get_user_id());
+  std::string tenant = user->get_tenant();
+
   // split possible tenant/name
-  auto pos = bucket.name.find('/');
+  auto pos = bucket_name.find('/');
   if (pos != string::npos) {
-    bucket.tenant = bucket.name.substr(0, pos);
-    bucket.name = bucket.name.substr(pos + 1);
+    tenant = bucket_name.substr(0, pos);
+    bucket_name = bucket_name.substr(pos + 1);
   }
 
-  if (!bucket.name.empty()) {
-    int r = store->ctl()->bucket->read_bucket_info(
-        bucket, &bucket_info, y, dpp,
-        RGWBucketCtl::BucketInstance::GetParams().set_attrs(pattrs),
-        &ep_objv);
-    if (r < 0) {
-      set_err_msg(err_msg, "failed to fetch bucket info for bucket=" + bucket.name);
+  int r = store->get_bucket(dpp, user.get(), tenant, bucket_name, &bucket, y);
+  if (r < 0) {
+      set_err_msg(err_msg, "failed to fetch bucket info for bucket=" + bucket_name);
       return r;
-    }
-
-    op_state.set_bucket(bucket_info.bucket);
   }
 
-  if (!user_id.empty()) {
-    int r = store->ctl()->user->get_info_by_uid(dpp, user_id, &user_info, y);
+  op_state.set_bucket(bucket->clone());
+
+  if (!rgw::sal::RGWUser::empty(user.get())) {
+    r = user->load_by_id(dpp, y);
     if (r < 0) {
       set_err_msg(err_msg, "failed to fetch user info");
       return r;
     }
-
-    op_state.display_name = user_info.display_name;
   }
 
+  op_state.display_name = user->get_display_name();
+
   clear_failure();
   return 0;
 }
@@ -601,7 +538,7 @@ bool rgw_find_bucket_by_id(CephContext *cct, RGWMetadataManager *mgr,
 }
 
 int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp,
-                    map<string, bufferlist>& attrs, std::string *err_msg)
+                    std::string *err_msg)
 {
   if (!op_state.is_user_op()) {
     set_err_msg(err_msg, "empty user id");
@@ -609,37 +546,42 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, const Dou
   }
 
   string bucket_id = op_state.get_bucket_id();
-
   std::string display_name = op_state.get_user_display_name();
-  rgw_bucket& bucket = op_state.get_bucket();
-  if (!bucket_id.empty() && bucket_id != bucket.bucket_id) {
+  std::unique_ptr<rgw::sal::RGWBucket> loc_bucket;
+  std::unique_ptr<rgw::sal::RGWBucket> old_bucket;
+
+  loc_bucket = op_state.get_bucket()->clone();
+
+  if (!bucket_id.empty() && bucket_id != loc_bucket->get_bucket_id()) {
     set_err_msg(err_msg,
-       "specified bucket id does not match " + bucket.bucket_id);
+       "specified bucket id does not match " + loc_bucket->get_bucket_id());
     return -EINVAL;
   }
-  rgw_bucket old_bucket = bucket;
-  rgw_user user_id = op_state.get_user_id();
-  bucket.tenant = user_id.tenant;
+
+  old_bucket = loc_bucket->clone();
+
+  loc_bucket->get_key().tenant = op_state.get_user_id().tenant;
+
   if (!op_state.new_bucket_name.empty()) {
     auto pos = op_state.new_bucket_name.find('/');
     if (pos != string::npos) {
-      bucket.tenant = op_state.new_bucket_name.substr(0, pos);
-      bucket.name = op_state.new_bucket_name.substr(pos + 1);
+      loc_bucket->get_key().tenant = op_state.new_bucket_name.substr(0, pos);
+      loc_bucket->get_key().name = op_state.new_bucket_name.substr(pos + 1);
     } else {
-      bucket.name = op_state.new_bucket_name;
+      loc_bucket->get_key().name = op_state.new_bucket_name;
     }
   }
 
   RGWObjVersionTracker objv_tracker;
-  RGWObjVersionTracker old_version = bucket_info.objv_tracker;
+  RGWObjVersionTracker old_version = loc_bucket->get_info().objv_tracker;
 
-  map<string, bufferlist>::iterator aiter = attrs.find(RGW_ATTR_ACL);
-  if (aiter == attrs.end()) {
+  map<string, bufferlist>::iterator aiter = loc_bucket->get_attrs().find(RGW_ATTR_ACL);
+  if (aiter == loc_bucket->get_attrs().end()) {
        // should never happen; only pre-argonaut buckets lacked this.
-    ldpp_dout(dpp, 0) << "WARNING: can't bucket link because no acl on bucket=" << old_bucket.name << dendl;
+    ldpp_dout(dpp, 0) << "WARNING: can't bucket link because no acl on bucket=" << old_bucket << dendl;
     set_err_msg(err_msg,
        "While crossing the Anavros you have displeased the goddess Hera."
-       "  You must sacrifice your ancient bucket " + bucket.bucket_id);
+       "  You must sacrifice your ancient bucket " + loc_bucket->get_bucket_id());
     return -EINVAL;
   }
   bufferlist& aclbl = aiter->second;
@@ -654,71 +596,63 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, const Dou
     return -EIO;
   }
 
-  auto bucket_ctl = store->ctl()->bucket;
-  int r = bucket_ctl->unlink_bucket(owner.get_id(), old_bucket, y, dpp, false);
+  std::unique_ptr<rgw::sal::RGWUser> owner_user = store->get_user(owner.get_id());
+
+  int r = old_bucket->unlink(dpp, owner_user.get(), y, false);
   if (r < 0) {
-    set_err_msg(err_msg, "could not unlink policy from user " + owner.get_id().to_str());
+    set_err_msg(err_msg, "could not unlink policy from user " + owner_user->get_id().to_str());
     return r;
   }
 
   // now update the user for the bucket...
   if (display_name.empty()) {
-    ldpp_dout(dpp, 0) << "WARNING: user " << user_info.user_id << " has no display name set" << dendl;
+    ldpp_dout(dpp, 0) << "WARNING: user " << user << " has no display name set" << dendl;
   }
 
   RGWAccessControlPolicy policy_instance;
-  policy_instance.create_default(user_info.user_id, display_name);
+  policy_instance.create_default(user->get_id(), display_name);
   owner = policy_instance.get_owner();
 
   aclbl.clear();
   policy_instance.encode(aclbl);
 
-  auto instance_params = RGWBucketCtl::BucketInstance::PutParams().set_attrs(&attrs);
-
-  bucket_info.owner = user_info.user_id;
-  if (bucket != old_bucket) {
-    bucket_info.bucket = bucket;
-    bucket_info.objv_tracker.version_for_read()->ver = 0;
-    instance_params.set_exclusive(true);
+  bool exclusive = false;
+  loc_bucket->get_info().owner = user->get_id();
+  if (*loc_bucket != *old_bucket) {
+  ldpp_dout(dpp, 20) << "Lando 10" << dendl;
+    loc_bucket->get_info().bucket = loc_bucket->get_key();
+    loc_bucket->get_info().objv_tracker.version_for_read()->ver = 0;
+    exclusive = true;
   }
 
-  r = bucket_ctl->store_bucket_instance_info(bucket, bucket_info, y, dpp, instance_params);
+  ldpp_dout(dpp, 20) << "Lando 11" << dendl;
+  r = loc_bucket->put_instance_info(dpp, exclusive, ceph::real_time());
+  ldpp_dout(dpp, 20) << "Lando 12 r=" << r << dendl;
   if (r < 0) {
     set_err_msg(err_msg, "ERROR: failed writing bucket instance info: " + cpp_strerror(-r));
     return r;
   }
 
-  RGWBucketEntryPoint ep;
-  ep.bucket = bucket_info.bucket;
-  ep.owner = user_info.user_id;
-  ep.creation_time = bucket_info.creation_time;
-  ep.linked = true;
-  map<string, bufferlist> ep_attrs;
-  rgw_ep_info ep_data{ep, ep_attrs};
+  RGWObjVersionTracker objv;
 
   /* link to user */
-  r = store->ctl()->bucket->link_bucket(user_info.user_id,
-                                     bucket_info.bucket,
-                                     ep.creation_time,
-                                     y, dpp, true, &ep_data);
+  ldpp_dout(dpp, 20) << "Lando 13" << dendl;
+  r = loc_bucket->link(dpp, user.get(), y, true, &objv);
+  ldpp_dout(dpp, 20) << "Lando 14 r=" << r << dendl;
   if (r < 0) {
     set_err_msg(err_msg, "failed to relink bucket");
     return r;
   }
 
-  if (bucket != old_bucket) {
+  if (*loc_bucket != *old_bucket) {
     // like RGWRados::delete_bucket -- excepting no bucket_index work.
-    r = bucket_ctl->remove_bucket_entrypoint_info(old_bucket, y, dpp,
-                                                  RGWBucketCtl::Bucket::RemoveParams()
-                                                  .set_objv_tracker(&ep_data.ep_objv));
+    r = old_bucket->remove_entrypoint(dpp, &objv, y);
     if (r < 0) {
-      set_err_msg(err_msg, "failed to unlink old bucket endpoint " + old_bucket.tenant + "/" + old_bucket.name);
+      set_err_msg(err_msg, "failed to unlink old bucket endpoint " + old_bucket->get_tenant() + "/" + old_bucket->get_name());
       return r;
     }
 
-    r = bucket_ctl->remove_bucket_instance_info(old_bucket, bucket_info, y, dpp,
-                                                RGWBucketCtl::BucketInstance::RemoveParams()
-                                                .set_objv_tracker(&old_version));
+    r = old_bucket->remove_instance_info(dpp, &old_version, y);
     if (r < 0) {
       set_err_msg(err_msg, "failed to unlink old bucket info");
       return r;
@@ -731,8 +665,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, const Dou
 int RGWBucket::chown(RGWBucketAdminOpState& op_state, const string& marker,
                      optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg)
 {
-  int ret = store->ctl()->bucket->chown(store, bucket_info, user_info.user_id,
-                                     user_info.display_name, marker, y, dpp);
+  int ret = bucket->chown(dpp, user.get(), user.get(), y, &marker);
   if (ret < 0) {
     set_err_msg(err_msg, "Failed to change object ownership: " + cpp_strerror(-ret));
   }
@@ -742,14 +675,13 @@ int RGWBucket::chown(RGWBucketAdminOpState& op_state, const string& marker,
 
 int RGWBucket::unlink(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg)
 {
-  rgw_bucket bucket = op_state.get_bucket();
-
+  bucket = op_state.get_bucket()->clone();
   if (!op_state.is_user_op()) {
     set_err_msg(err_msg, "could not fetch user or user bucket info");
     return -EINVAL;
   }
 
-  int r = store->ctl()->bucket->unlink_bucket(user_info.user_id, bucket, y, dpp);
+  int r = bucket->unlink(dpp, user.get(), y);
   if (r < 0) {
     set_err_msg(err_msg, "error unlinking bucket" + cpp_strerror(-r));
   }
@@ -759,17 +691,10 @@ int RGWBucket::unlink(RGWBucketAdminOpState& op_state, optional_yield y, const D
 
 int RGWBucket::set_quota(RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, std::string *err_msg)
 {
-  rgw_bucket bucket = op_state.get_bucket();
-  RGWBucketInfo bucket_info;
-  map<string, bufferlist> attrs;
-  int r = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, bucket_info, NULL, null_yield, dpp, &attrs);
-  if (r < 0) {
-    set_err_msg(err_msg, "could not get bucket info for bucket=" + bucket.name + ": " + cpp_strerror(-r));
-    return r;
-  }
+  bucket = op_state.get_bucket()->clone();
 
-  bucket_info.quota = op_state.quota;
-  r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &attrs, dpp);
+  bucket->get_info().quota = op_state.quota;
+  int r = bucket->put_instance_info(dpp, false, real_time());
   if (r < 0) {
     set_err_msg(err_msg, "ERROR: failed writing bucket instance info: " + cpp_strerror(-r));
     return r;
@@ -779,12 +704,13 @@ int RGWBucket::set_quota(RGWBucketAdminOpState& op_state, const DoutPrefixProvid
 
 int RGWBucket::remove_object(const DoutPrefixProvider *dpp, RGWBucketAdminOpState& op_state, std::string *err_msg)
 {
-  rgw_bucket bucket = op_state.get_bucket();
   std::string object_name = op_state.get_object_name();
 
   rgw_obj_key key(object_name);
 
-  int ret = rgw_remove_object(dpp, store, bucket_info, bucket, key);
+  bucket = op_state.get_bucket()->clone();
+
+  int ret = rgw_remove_object(dpp, store, bucket.get(), key);
   if (ret < 0) {
     set_err_msg(err_msg, "unable to remove object" + cpp_strerror(-ret));
     return ret;
@@ -793,10 +719,10 @@ int RGWBucket::remove_object(const DoutPrefixProvider *dpp, RGWBucketAdminOpStat
   return 0;
 }
 
-static void dump_bucket_index(const RGWRados::ent_map_t& result,  Formatter *f)
+static void dump_bucket_index(const vector<rgw_bucket_dir_entry>& objs,  Formatter *f)
 {
-  for (auto iter = result.begin(); iter != result.end(); ++iter) {
-    f->dump_string("object", iter->first);
+  for (auto iter = objs.begin(); iter != objs.end(); ++iter) {
+    f->dump_string("object", iter->key.name);
   }
 }
 
@@ -834,43 +760,33 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
                const DoutPrefixProvider *dpp, std::string *err_msg)
 {
   bool fix_index = op_state.will_fix_index();
-  rgw_bucket bucket = op_state.get_bucket();
-
-  map<string, bool> common_prefixes;
 
   bool is_truncated;
   map<string, bool> meta_objs;
   map<rgw_obj_index_key, string> all_objs;
 
-  RGWBucketInfo bucket_info;
-  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
-  int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, nullptr, null_yield, dpp);
-  if (r < 0) {
-    ldout(store->ctx(), 0) << "ERROR: " << __func__ << "(): get_bucket_instance_info(bucket=" << bucket << ") returned r=" << r << dendl;
-    return r;
-  }
+  bucket = op_state.get_bucket()->clone();
 
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
 
-  list_op.params.list_versions = true;
-  list_op.params.ns = RGW_OBJ_NS_MULTIPART;
+  params.list_versions = true;
+  params.ns = RGW_OBJ_NS_MULTIPART;
 
   do {
-    vector<rgw_bucket_dir_entry> result;
-    int r = list_op.list_objects(dpp, listing_max_entries, &result,
-                                &common_prefixes, &is_truncated, null_yield);
+    rgw::sal::RGWBucket::ListResults results;
+    int r = bucket->list(dpp, params, listing_max_entries, results, null_yield);
     if (r < 0) {
-      set_err_msg(err_msg, "failed to list objects in bucket=" + bucket.name +
+      set_err_msg(err_msg, "failed to list objects in bucket=" + bucket->get_name() +
               " err=" +  cpp_strerror(-r));
 
       return r;
     }
+    is_truncated = results.is_truncated;
 
     vector<rgw_bucket_dir_entry>::iterator iter;
-    for (iter = result.begin(); iter != result.end(); ++iter) {
+    for (iter = results.objs.begin(); iter != results.objs.end(); ++iter) {
       rgw_obj_index_key key = iter->key;
-      rgw_obj obj(bucket, key);
+      rgw_obj obj(bucket->get_key(), key);
       string oid = obj.get_oid();
 
       int pos = oid.find_last_of('.');
@@ -905,7 +821,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
 
     if (objs_to_unlink.size() > listing_max_entries) {
       if (fix_index) {
-       int r = store->getRados()->remove_objs_from_index(bucket_info, objs_to_unlink);
+       int r = bucket->remove_objs_from_index(objs_to_unlink);
        if (r < 0) {
          set_err_msg(err_msg, "ERROR: remove_obj_from_index() returned error: " +
                      cpp_strerror(-r));
@@ -920,7 +836,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
   }
 
   if (fix_index) {
-    int r = store->getRados()->remove_objs_from_index(bucket_info, objs_to_unlink);
+    int r = bucket->remove_objs_from_index(objs_to_unlink);
     if (r < 0) {
       set_err_msg(err_msg, "ERROR: remove_obj_from_index() returned error: " +
               cpp_strerror(-r));
@@ -950,46 +866,36 @@ int RGWBucket::check_object_index(const DoutPrefixProvider *dpp,
     return -EINVAL;
   }
 
-  store->getRados()->cls_obj_set_bucket_tag_timeout(bucket_info, BUCKET_TAG_TIMEOUT);
+  bucket->set_tag_timeout(BUCKET_TAG_TIMEOUT);
 
   string prefix;
   string empty_delimiter;
-  rgw_obj_index_key marker;
-  bool is_truncated = true;
-  bool cls_filtered = true;
+  rgw::sal::RGWBucket::ListResults results;
+  results.is_truncated = true;
 
   Formatter *formatter = flusher.get_formatter();
   formatter->open_object_section("objects");
-  uint16_t expansion_factor = 1;
-  while (is_truncated) {
-    RGWRados::ent_map_t result;
-    result.reserve(listing_max_entries);
-
-    int r = store->getRados()->cls_bucket_list_ordered(
-      dpp, bucket_info, RGW_NO_SHARD, marker, prefix, empty_delimiter,
-      listing_max_entries, true, expansion_factor,
-      result, &is_truncated, &cls_filtered, &marker,
-      y, rgw_bucket_object_check_filter);
+  while (results.is_truncated) {
+    rgw::sal::RGWBucket::ListParams params;
+
+    params.marker = results.next_marker;
+    params.prefix = prefix;
+
+    int r = bucket->list(dpp, params, listing_max_entries, results, y);
+
     if (r == -ENOENT) {
       break;
     } else if (r < 0 && r != -ENOENT) {
       set_err_msg(err_msg, "ERROR: failed operation r=" + cpp_strerror(-r));
     }
 
-    if (result.size() < listing_max_entries / 8) {
-      ++expansion_factor;
-    } else if (result.size() > listing_max_entries * 7 / 8 &&
-              expansion_factor > 1) {
-      --expansion_factor;
-    }
-
-    dump_bucket_index(result, formatter);
+    dump_bucket_index(results.objs, formatter);
     flusher.flush();
   }
 
   formatter->close_section();
 
-  store->getRados()->cls_obj_set_bucket_tag_timeout(bucket_info, 0);
+  bucket->set_tag_timeout(0);
 
   return 0;
 }
@@ -1002,14 +908,14 @@ int RGWBucket::check_index(RGWBucketAdminOpState& op_state,
 {
   bool fix_index = op_state.will_fix_index();
 
-  int r = store->getRados()->bucket_check_index(bucket_info, &existing_stats, &calculated_stats);
+  int r = bucket->check_index(existing_stats, calculated_stats);
   if (r < 0) {
     set_err_msg(err_msg, "failed to check index error=" + cpp_strerror(-r));
     return r;
   }
 
   if (fix_index) {
-    r = store->getRados()->bucket_rebuild_index(bucket_info);
+    r = bucket->rebuild_index();
     if (r < 0) {
       set_err_msg(err_msg, "failed to rebuild index err=" + cpp_strerror(-r));
       return r;
@@ -1019,36 +925,36 @@ int RGWBucket::check_index(RGWBucketAdminOpState& op_state,
   return 0;
 }
 
-int RGWBucket::sync(RGWBucketAdminOpState& op_state, map<string, bufferlist> *attrs, const DoutPrefixProvider *dpp, std::string *err_msg)
+int RGWBucket::sync(RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, std::string *err_msg)
 {
-  if (!store->svc()->zone->is_meta_master()) {
+  if (!store->is_meta_master()) {
     set_err_msg(err_msg, "ERROR: failed to update bucket sync: only allowed on meta master zone");
     return EINVAL;
   }
   bool sync = op_state.will_sync_bucket();
   if (sync) {
-    bucket_info.flags &= ~BUCKET_DATASYNC_DISABLED;
+    bucket->get_info().flags &= ~BUCKET_DATASYNC_DISABLED;
   } else {
-    bucket_info.flags |= BUCKET_DATASYNC_DISABLED;
+    bucket->get_info().flags |= BUCKET_DATASYNC_DISABLED;
   }
 
-  int r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), attrs, dpp);
+  int r = bucket->put_instance_info(dpp, false, real_time());
   if (r < 0) {
     set_err_msg(err_msg, "ERROR: failed writing bucket instance info:" + cpp_strerror(-r));
     return r;
   }
 
-  int shards_num = bucket_info.layout.current_index.layout.normal.num_shards? bucket_info.layout.current_index.layout.normal.num_shards : 1;
-  int shard_id = bucket_info.layout.current_index.layout.normal.num_shards? 0 : -1;
+  int shards_num = bucket->get_info().layout.current_index.layout.normal.num_shards? bucket->get_info().layout.current_index.layout.normal.num_shards : 1;
+  int shard_id = bucket->get_info().layout.current_index.layout.normal.num_shards? 0 : -1;
 
   if (!sync) {
-    r = store->svc()->bilog_rados->log_stop(bucket_info, -1);
+    r = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->log_stop(bucket->get_info(), -1);
     if (r < 0) {
       set_err_msg(err_msg, "ERROR: failed writing stop bilog:" + cpp_strerror(-r));
       return r;
     }
   } else {
-    r = store->svc()->bilog_rados->log_start(bucket_info, -1);
+    r = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->log_start(bucket->get_info(), -1);
     if (r < 0) {
       set_err_msg(err_msg, "ERROR: failed writing resync bilog:" + cpp_strerror(-r));
       return r;
@@ -1056,7 +962,7 @@ int RGWBucket::sync(RGWBucketAdminOpState& op_state, map<string, bufferlist> *at
   }
 
   for (int i = 0; i < shards_num; ++i, ++shard_id) {
-    r = store->svc()->datalog_rados->add_entry(dpp, bucket_info, shard_id);
+    r = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados->add_entry(dpp, bucket->get_info(), shard_id);
     if (r < 0) {
       set_err_msg(err_msg, "ERROR: failed writing data log:" + cpp_strerror(-r));
       return r;
@@ -1078,35 +984,28 @@ int RGWBucket::policy_bl_to_stream(bufferlist& bl, ostream& o)
   return 0;
 }
 
-int rgw_object_get_attr(const DoutPrefixProvider *dpp, 
-                        rgw::sal::RGWRadosStore* store, const RGWBucketInfo& bucket_info,
-                       const rgw_obj& obj, const char* attr_name,
-                       bufferlist& out_bl, optional_yield y)
+int rgw_object_get_attr(const DoutPrefixProvider *dpp,
+                       rgw::sal::RGWStore* store, rgw::sal::RGWObject* obj,
+                       const char* attr_name, bufferlist& out_bl, optional_yield y)
 {
   RGWObjectCtx obj_ctx(store);
-  RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj);
-  RGWRados::Object::Read rop(&op_target);
+  std::unique_ptr<rgw::sal::RGWObject::ReadOp> rop = obj->get_read_op(&obj_ctx);
 
-  return rop.get_attr(dpp, attr_name, out_bl, y);
+  return rop->get_attr(dpp, attr_name, out_bl, y);
 }
 
 int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y, const DoutPrefixProvider *dpp)
 {
+  int ret;
   std::string object_name = op_state.get_object_name();
-  rgw_bucket bucket = op_state.get_bucket();
 
-  RGWBucketInfo bucket_info;
-  map<string, bufferlist> attrs;
-  int ret = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, bucket_info, NULL, null_yield, dpp, &attrs);
-  if (ret < 0) {
-    return ret;
-  }
+  bucket = op_state.get_bucket()->clone();
 
   if (!object_name.empty()) {
     bufferlist bl;
-    rgw_obj obj(bucket, object_name);
+    std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(rgw_obj_key(object_name));
 
-    ret = rgw_object_get_attr(dpp, store, bucket_info, obj, RGW_ATTR_ACL, bl, y);
+    ret = rgw_object_get_attr(dpp, store, obj.get(), RGW_ATTR_ACL, bl, y);
     if (ret < 0){
       return ret;
     }
@@ -1118,8 +1017,8 @@ int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolic
     return ret;
   }
 
-  map<string, bufferlist>::iterator aiter = attrs.find(RGW_ATTR_ACL);
-  if (aiter == attrs.end()) {
+  map<string, bufferlist>::iterator aiter = bucket->get_attrs().find(RGW_ATTR_ACL);
+  if (aiter == bucket->get_attrs().end()) {
     return -ENOENT;
   }
 
@@ -1132,7 +1031,7 @@ int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolic
 }
 
 
-int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+int RGWBucketAdminOp::get_policy(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   RGWAccessControlPolicy& policy, const DoutPrefixProvider *dpp)
 {
   RGWBucket bucket;
@@ -1151,7 +1050,7 @@ int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminO
 /* Wrappers to facilitate RESTful interface */
 
 
-int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+int RGWBucketAdminOp::get_policy(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp)
 {
   RGWAccessControlPolicy policy(store->ctx());
@@ -1173,7 +1072,7 @@ int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminO
   return 0;
 }
 
-int RGWBucketAdminOp::dump_s3_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+int RGWBucketAdminOp::dump_s3_policy(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   ostream& os, const DoutPrefixProvider *dpp)
 {
   RGWAccessControlPolicy_S3 policy(store->ctx());
@@ -1187,7 +1086,7 @@ int RGWBucketAdminOp::dump_s3_policy(rgw::sal::RGWRadosStore *store, RGWBucketAd
   return 0;
 }
 
-int RGWBucketAdminOp::unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp)
+int RGWBucketAdminOp::unlink(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp)
 {
   RGWBucket bucket;
 
@@ -1198,29 +1097,26 @@ int RGWBucketAdminOp::unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpSta
   return bucket.unlink(op_state, null_yield, dpp);
 }
 
-int RGWBucketAdminOp::link(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err)
+int RGWBucketAdminOp::link(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err)
 {
   RGWBucket bucket;
-  map<string, bufferlist> attrs;
-
-  int ret = bucket.init(store, op_state, null_yield, dpp, err, &attrs);
+  int ret = bucket.init(store, op_state, null_yield, dpp, err);
   if (ret < 0)
     return ret;
 
-  return bucket.link(op_state, null_yield, dpp, attrs, err);
+  return bucket.link(op_state, null_yield, dpp, err);
 
 }
 
-int RGWBucketAdminOp::chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const string& marker, const DoutPrefixProvider *dpp, string *err)
+int RGWBucketAdminOp::chown(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const string& marker, const DoutPrefixProvider *dpp, string *err)
 {
   RGWBucket bucket;
-  map<string, bufferlist> attrs;
 
-  int ret = bucket.init(store, op_state, null_yield, dpp, err, &attrs);
+  int ret = bucket.init(store, op_state, null_yield, dpp, err);
   if (ret < 0)
     return ret;
 
-  ret = bucket.link(op_state, null_yield, dpp, attrs, err);
+  ret = bucket.link(op_state, null_yield, dpp, err);
   if (ret < 0)
     return ret;
 
@@ -1228,7 +1124,7 @@ int RGWBucketAdminOp::chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpStat
 
 }
 
-int RGWBucketAdminOp::check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+int RGWBucketAdminOp::check_index(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp)
 {
   int ret;
@@ -1263,7 +1159,7 @@ int RGWBucketAdminOp::check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdmin
   return 0;
 }
 
-int RGWBucketAdminOp::remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+int RGWBucketAdminOp::remove_bucket(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                                    optional_yield y, const DoutPrefixProvider *dpp, 
                                     bool bypass_gc, bool keep_index_consistent)
 {
@@ -1276,7 +1172,7 @@ int RGWBucketAdminOp::remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdm
     return ret;
 
   if (bypass_gc)
-    ret = rgw_remove_bucket_bypass_gc(store, bucket->get_key(), op_state.get_max_aio(), keep_index_consistent, y, dpp);
+    ret = rgw_remove_bucket_bypass_gc(store, bucket.get(), op_state.get_max_aio(), keep_index_consistent, y, dpp);
   else
     ret = bucket->remove_bucket(dpp, op_state.will_delete_children(), string(), string(),
                                false, nullptr, y);
@@ -1284,7 +1180,7 @@ int RGWBucketAdminOp::remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdm
   return ret;
 }
 
-int RGWBucketAdminOp::remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp)
+int RGWBucketAdminOp::remove_object(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp)
 {
   RGWBucket bucket;
 
@@ -1295,74 +1191,66 @@ int RGWBucketAdminOp::remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdm
   return bucket.remove_object(dpp, op_state);
 }
 
-int RGWBucketAdminOp::sync_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg)
+int RGWBucketAdminOp::sync_bucket(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg)
 {
   RGWBucket bucket;
-  map<string, bufferlist> attrs;
-  int ret = bucket.init(store, op_state, null_yield, dpp, err_msg, &attrs);
+  int ret = bucket.init(store, op_state, null_yield, dpp, err_msg);
   if (ret < 0)
   {
     return ret;
   }
-  return bucket.sync(op_state, &attrs, dpp, err_msg);
+  return bucket.sync(op_state, dpp, err_msg);
 }
 
-static int bucket_stats(rgw::sal::RGWRadosStore *store,
+static int bucket_stats(rgw::sal::RGWStore *store,
                        const std::string& tenant_name,
                        const std::string& bucket_name,
                        Formatter *formatter,
                         const DoutPrefixProvider *dpp)
 {
-  RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
   map<RGWObjCategory, RGWStorageStats> stats;
-  map<string, bufferlist> attrs;
 
   real_time mtime;
-  int r = store->getRados()->get_bucket_info(store->svc(),
-                                            tenant_name, bucket_name, bucket_info,
-                                            &mtime, null_yield, dpp, &attrs);
-  if (r < 0) {
-    return r;
+  int ret = store->get_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, null_yield);
+  if (ret < 0) {
+    return ret;
   }
 
-  rgw_bucket& bucket = bucket_info.bucket;
-
   string bucket_ver, master_ver;
   string max_marker;
-  int ret = store->getRados()->get_bucket_stats(bucket_info, RGW_NO_SHARD,
-                                               &bucket_ver, &master_ver, stats,
-                                               &max_marker);
+  ret = bucket->get_bucket_stats(RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);
   if (ret < 0) {
-    cerr << "error getting bucket stats bucket=" << bucket.name << " ret=" << ret << std::endl;
+    cerr << "error getting bucket stats bucket=" << bucket->get_name() << " ret=" << ret << std::endl;
     return ret;
   }
 
   utime_t ut(mtime);
-  utime_t ctime_ut(bucket_info.creation_time);
+  utime_t ctime_ut(bucket->get_creation_time());
 
   formatter->open_object_section("stats");
-  formatter->dump_string("bucket", bucket.name);
+  formatter->dump_string("bucket", bucket->get_name());
   formatter->dump_int("num_shards",
-                     bucket_info.layout.current_index.layout.normal.num_shards);
-  formatter->dump_string("tenant", bucket.tenant);
-  formatter->dump_string("zonegroup", bucket_info.zonegroup);
-  formatter->dump_string("placement_rule", bucket_info.placement_rule.to_str());
-  ::encode_json("explicit_placement", bucket.explicit_placement, formatter);
-  formatter->dump_string("id", bucket.bucket_id);
-  formatter->dump_string("marker", bucket.marker);
-  formatter->dump_stream("index_type") << bucket_info.layout.current_index.layout.type;
-  ::encode_json("owner", bucket_info.owner, formatter);
+                     bucket->get_info().layout.current_index.layout.normal.num_shards);
+  formatter->dump_string("tenant", bucket->get_tenant());
+  formatter->dump_string("zonegroup", bucket->get_info().zonegroup);
+  formatter->dump_string("placement_rule", bucket->get_info().placement_rule.to_str());
+  ::encode_json("explicit_placement", bucket->get_key().explicit_placement, formatter);
+  formatter->dump_string("id", bucket->get_bucket_id());
+  formatter->dump_string("marker", bucket->get_marker());
+  formatter->dump_stream("index_type") << bucket->get_info().layout.current_index.layout.type;
+  ::encode_json("owner", bucket->get_info().owner, formatter);
   formatter->dump_string("ver", bucket_ver);
   formatter->dump_string("master_ver", master_ver);
   ut.gmtime(formatter->dump_stream("mtime"));
   ctime_ut.gmtime(formatter->dump_stream("creation_time"));
   formatter->dump_string("max_marker", max_marker);
   dump_bucket_usage(stats, formatter);
-  encode_json("bucket_quota", bucket_info.quota, formatter);
+  encode_json("bucket_quota", bucket->get_info().quota, formatter);
 
   // bucket tags
-  auto iter = attrs.find(RGW_ATTR_TAGS);
-  if (iter != attrs.end()) {
+  auto iter = bucket->get_attrs().find(RGW_ATTR_TAGS);
+  if (iter != bucket->get_attrs().end()) {
     RGWObjTagSet_S3 tagset;
     bufferlist::const_iterator piter{&iter->second};
     try {
@@ -1380,7 +1268,7 @@ static int bucket_stats(rgw::sal::RGWRadosStore *store,
   return 0;
 }
 
-int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
+int RGWBucketAdminOp::limit_check(rgw::sal::RGWStore *store,
                                  RGWBucketAdminOpState& op_state,
                                  const std::list<std::string>& user_ids,
                                  RGWFormatterFlusher& flusher, optional_yield y,
@@ -1413,9 +1301,9 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
     string marker;
     rgw::sal::RGWBucketList buckets;
     do {
-      rgw::sal::RGWRadosUser user(store, rgw_user(user_id));
+      std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(user_id));
 
-      ret = user.list_buckets(dpp, marker, string(), max_entries, false, buckets, y);
+      ret = user->list_buckets(dpp, marker, string(), max_entries, false, buckets, y);
 
       if (ret < 0)
         return ret;
@@ -1427,24 +1315,18 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
        uint32_t num_shards = 1;
        uint64_t num_objects = 0;
 
-       /* need info for num_shards */
-       RGWBucketInfo info;
-
        marker = bucket->get_name(); /* Casey's location for marker update,
                                     * as we may now not reach the end of
                                     * the loop body */
 
-       ret = store->getRados()->get_bucket_info(store->svc(), bucket->get_tenant(),
-                                                bucket->get_name(), info, nullptr,
-                                                null_yield, dpp);
+       ret = bucket->get_bucket_info(dpp, null_yield);
        if (ret < 0)
          continue;
 
        /* need stats for num_entries */
        string bucket_ver, master_ver;
        std::map<RGWObjCategory, RGWStorageStats> stats;
-       ret = store->getRados()->get_bucket_stats(info, RGW_NO_SHARD, &bucket_ver,
-                                     &master_ver, stats, nullptr);
+       ret = bucket->get_bucket_stats(RGW_NO_SHARD, &bucket_ver, &master_ver, stats, nullptr);
 
        if (ret < 0)
          continue;
@@ -1453,7 +1335,7 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
          num_objects += s.second.num_objects;
        }
 
-       num_shards = info.layout.current_index.layout.normal.num_shards;
+       num_shards = bucket->get_info().layout.current_index.layout.normal.num_shards;
        uint64_t objs_per_shard =
          (num_shards) ? num_objects/num_shards : num_objects;
        {
@@ -1498,7 +1380,7 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
   return ret;
 } /* RGWBucketAdminOp::limit_check */
 
-int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
+int RGWBucketAdminOp::info(rgw::sal::RGWStore *store,
                           RGWBucketAdminOpState& op_state,
                           RGWFormatterFlusher& flusher,
                           optional_yield y,
@@ -1528,13 +1410,13 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
     formatter->open_array_section("buckets");
 
     rgw::sal::RGWBucketList buckets;
-    rgw::sal::RGWRadosUser user(store, op_state.get_user_id());
+    std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(op_state.get_user_id());
     std::string marker;
     const std::string empty_end_marker;
     constexpr bool no_need_stats = false; // set need_stats to false
 
     do {
-      ret = user.list_buckets(dpp, marker, empty_end_marker, max_entries,
+      ret = user->list_buckets(dpp, marker, empty_end_marker, max_entries,
                              no_need_stats, buckets, y);
       if (ret < 0) {
         return ret;
@@ -1575,11 +1457,11 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
     bool truncated = true;
 
     formatter->open_array_section("buckets");
-    ret = store->ctl()->meta.mgr->list_keys_init("bucket", &handle);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init("bucket", &handle);
     while (ret == 0 && truncated) {
       std::list<std::string> buckets;
       constexpr int max_keys = 1000;
-      ret = store->ctl()->meta.mgr->list_keys_next(handle, max_keys, buckets,
+      ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, max_keys, buckets,
                                                   &truncated);
       for (auto& bucket_name : buckets) {
         if (show_stats) {
@@ -1589,7 +1471,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
        }
       }
     }
-    store->ctl()->meta.mgr->list_keys_complete(handle);
+    static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
 
     formatter->close_section();
   }
@@ -1599,7 +1481,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
   return 0;
 }
 
-int RGWBucketAdminOp::set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp)
+int RGWBucketAdminOp::set_quota(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp)
 {
   RGWBucket bucket;
 
@@ -1609,26 +1491,14 @@ int RGWBucketAdminOp::set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOp
   return bucket.set_quota(op_state, dpp);
 }
 
-static int purge_bucket_instance(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const DoutPrefixProvider *dpp)
+static int purge_bucket_instance(rgw::sal::RGWStore *store, const RGWBucketInfo& bucket_info, const DoutPrefixProvider *dpp)
 {
-  int max_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1);
-  for (int i = 0; i < max_shards; i++) {
-    RGWRados::BucketShard bs(store->getRados());
-    int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0  ? i : -1);
-    int ret = bs.init(bucket_info.bucket, shard_id, bucket_info.layout.current_index, nullptr, dpp);
-    if (ret < 0) {
-      cerr << "ERROR: bs.init(bucket=" << bucket_info.bucket << ", shard=" << shard_id
-           << "): " << cpp_strerror(-ret) << std::endl;
-      return ret;
-    }
-    ret = store->getRados()->bi_remove(bs);
-    if (ret < 0) {
-      cerr << "ERROR: failed to remove bucket index object: "
-           << cpp_strerror(-ret) << std::endl;
-      return ret;
-    }
-  }
-  return 0;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  int ret = store->get_bucket(nullptr, bucket_info, &bucket);
+  if (ret < 0)
+    return ret;
+
+  return bucket->purge_instance(dpp);
 }
 
 inline auto split_tenant(const std::string& bucket_name){
@@ -1640,27 +1510,28 @@ inline auto split_tenant(const std::string& bucket_name){
 }
 
 using bucket_instance_ls = std::vector<RGWBucketInfo>;
-void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& bucket_name,
+void get_stale_instances(rgw::sal::RGWStore *store, const std::string& bucket_name,
                          const vector<std::string>& lst,
                          bucket_instance_ls& stale_instances,
                          const DoutPrefixProvider *dpp)
 {
 
-  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
-
   bucket_instance_ls other_instances;
 // first iterate over the entries, and pick up the done buckets; these
 // are guaranteed to be stale
   for (const auto& bucket_instance : lst){
     RGWBucketInfo binfo;
-    int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket_instance,
-                                            binfo, nullptr,nullptr, null_yield, dpp);
+    std::unique_ptr<rgw::sal::RGWBucket> bucket;
+    rgw_bucket rbucket;
+    rgw_bucket_parse_bucket_key(store->ctx(), bucket_instance, &rbucket, nullptr);
+    int r = store->get_bucket(dpp, nullptr, rbucket, &bucket, null_yield);
     if (r < 0){
       // this can only happen if someone deletes us right when we're processing
       lderr(store->ctx()) << "Bucket instance is invalid: " << bucket_instance
                           << cpp_strerror(-r) << dendl;
       continue;
     }
+    binfo = bucket->get_info();
     if (binfo.reshard_status == cls_rgw_reshard_status::DONE)
       stale_instances.emplace_back(std::move(binfo));
     else {
@@ -1670,9 +1541,10 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck
 
   // Read the cur bucket info, if the bucket doesn't exist we can simply return
   // all the instances
-  auto [tenant, bucket] = split_tenant(bucket_name);
+  auto [tenant, bname] = split_tenant(bucket_name);
   RGWBucketInfo cur_bucket_info;
-  int r = store->getRados()->get_bucket_info(store->svc(), tenant, bucket, cur_bucket_info, nullptr, null_yield, dpp);
+  std::unique_ptr<rgw::sal::RGWBucket> cur_bucket;
+  int r = store->get_bucket(dpp, nullptr, tenant, bname, &cur_bucket, null_yield);
   if (r < 0) {
     if (r == -ENOENT) {
       // bucket doesn't exist, everything is stale then
@@ -1682,12 +1554,13 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck
     } else {
       // all bets are off if we can't read the bucket, just return the sureshot stale instances
       ldpp_dout(dpp, -1) << "error: reading bucket info for bucket: "
-                          << bucket << cpp_strerror(-r) << dendl;
+                          << bname << cpp_strerror(-r) << dendl;
     }
     return;
   }
 
   // Don't process further in this round if bucket is resharding
+  cur_bucket_info = cur_bucket->get_info();
   if (cur_bucket_info.reshard_status == cls_rgw_reshard_status::IN_PROGRESS)
     return;
 
@@ -1708,7 +1581,7 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck
   // bucket and walk through these instances to make sure no one else interferes
   // with these
   {
-    RGWBucketReshardLock reshard_lock(store, cur_bucket_info, true);
+    RGWBucketReshardLock reshard_lock(static_cast<rgw::sal::RGWRadosStore*>(store), cur_bucket->get_info(), true);
     r = reshard_lock.lock();
     if (r < 0) {
       // most likely bucket is under reshard, return the sureshot stale instances
@@ -1727,19 +1600,19 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck
   return;
 }
 
-static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+static int process_stale_instances(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                                    RGWFormatterFlusher& flusher,
                                    const DoutPrefixProvider *dpp,
                                    std::function<void(const bucket_instance_ls&,
                                                       Formatter *,
-                                                      rgw::sal::RGWRadosStore*)> process_f)
+                                                      rgw::sal::RGWStore*)> process_f)
 {
   std::string marker;
   void *handle;
   Formatter *formatter = flusher.get_formatter();
   static constexpr auto default_max_keys = 1000;
 
-  int ret = store->ctl()->meta.mgr->list_keys_init("bucket.instance", marker, &handle);
+  int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init("bucket.instance", marker, &handle);
   if (ret < 0) {
     cerr << "ERROR: can't get key: " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1749,7 +1622,7 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi
 
   formatter->open_array_section("keys");
   auto g = make_scope_guard([&store, &handle, &formatter]() {
-                              store->ctl()->meta.mgr->list_keys_complete(handle);
+                              static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
                               formatter->close_section(); // keys
                               formatter->flush(cout);
                             });
@@ -1757,7 +1630,7 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi
   do {
     list<std::string> keys;
 
-    ret = store->ctl()->meta.mgr->list_keys_next(handle, default_max_keys, keys, &truncated);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, default_max_keys, keys, &truncated);
     if (ret < 0 && ret != -ENOENT) {
       cerr << "ERROR: lists_keys_next(): " << cpp_strerror(-ret) << std::endl;
       return ret;
@@ -1781,14 +1654,14 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi
   return 0;
 }
 
-int RGWBucketAdminOp::list_stale_instances(rgw::sal::RGWRadosStore *store,
+int RGWBucketAdminOp::list_stale_instances(rgw::sal::RGWStore *store,
                                            RGWBucketAdminOpState& op_state,
                                            RGWFormatterFlusher& flusher,
                                            const DoutPrefixProvider *dpp)
 {
   auto process_f = [](const bucket_instance_ls& lst,
                       Formatter *formatter,
-                      rgw::sal::RGWRadosStore*){
+                      rgw::sal::RGWStore*){
                      for (const auto& binfo: lst)
                        formatter->dump_string("key", binfo.bucket.get_key());
                    };
@@ -1796,19 +1669,19 @@ int RGWBucketAdminOp::list_stale_instances(rgw::sal::RGWRadosStore *store,
 }
 
 
-int RGWBucketAdminOp::clear_stale_instances(rgw::sal::RGWRadosStore *store,
+int RGWBucketAdminOp::clear_stale_instances(rgw::sal::RGWStore *store,
                                             RGWBucketAdminOpState& op_state,
                                             RGWFormatterFlusher& flusher,
                                             const DoutPrefixProvider *dpp)
 {
   auto process_f = [dpp](const bucket_instance_ls& lst,
                       Formatter *formatter,
-                      rgw::sal::RGWRadosStore *store) {
+                      rgw::sal::RGWStore *store){
                      for (const auto &binfo: lst) {
                        int ret = purge_bucket_instance(store, binfo, dpp);
                        if (ret == 0){
                          auto md_key = "bucket.instance:" + binfo.bucket.get_key();
-                         ret = store->ctl()->meta.mgr->remove(md_key, null_yield, dpp);
+                         ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->remove(md_key, null_yield, dpp);
                        }
                        formatter->open_object_section("delete_status");
                        formatter->dump_string("bucket_instance", binfo.bucket.get_key());
@@ -1820,23 +1693,20 @@ int RGWBucketAdminOp::clear_stale_instances(rgw::sal::RGWRadosStore *store,
   return process_stale_instances(store, op_state, flusher, dpp, process_f);
 }
 
-static int fix_single_bucket_lc(rgw::sal::RGWRadosStore *store,
+static int fix_single_bucket_lc(rgw::sal::RGWStore *store,
                                 const std::string& tenant_name,
                                 const std::string& bucket_name,
                                 const DoutPrefixProvider *dpp)
 {
-  RGWBucketInfo bucket_info;
-  map <std::string, bufferlist> bucket_attrs;
-  int ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name,
-                                   bucket_info, nullptr, null_yield, dpp, &bucket_attrs);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  int ret = store->get_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, null_yield);
   if (ret < 0) {
     // TODO: Should we handle the case where the bucket could've been removed between
     // listing and fetching?
     return ret;
   }
 
-  return rgw::lc::fix_lc_shard_entry(store, store->get_rgwlc()->get_lc(), bucket_info,
-                                    bucket_attrs);
+  return rgw::lc::fix_lc_shard_entry(store, store->get_rgwlc()->get_lc(), bucket.get());
 }
 
 static void format_lc_status(Formatter* formatter,
@@ -1851,7 +1721,7 @@ static void format_lc_status(Formatter* formatter,
   formatter->close_section(); // bucket_entry
 }
 
-static void process_single_lc_entry(rgw::sal::RGWRadosStore *store,
+static void process_single_lc_entry(rgw::sal::RGWStore *store,
                                    Formatter *formatter,
                                     const std::string& tenant_name,
                                     const std::string& bucket_name,
@@ -1861,7 +1731,7 @@ static void process_single_lc_entry(rgw::sal::RGWRadosStore *store,
   format_lc_status(formatter, tenant_name, bucket_name, -ret);
 }
 
-int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store,
+int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWStore *store,
                                     RGWBucketAdminOpState& op_state,
                                     RGWFormatterFlusher& flusher,
                                     const DoutPrefixProvider *dpp)
@@ -1878,7 +1748,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store,
     process_single_lc_entry(store, formatter, user_id.tenant, bucket_name, dpp);
     formatter->flush(cout);
   } else {
-    int ret = store->ctl()->meta.mgr->list_keys_init("bucket", marker, &handle);
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init("bucket", marker, &handle);
     if (ret < 0) {
       std::cerr << "ERROR: can't get key: " << cpp_strerror(-ret) << std::endl;
       return ret;
@@ -1887,13 +1757,13 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store,
     {
       formatter->open_array_section("lc_fix_status");
       auto sg = make_scope_guard([&store, &handle, &formatter](){
-                                   store->ctl()->meta.mgr->list_keys_complete(handle);
+                                   static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
                                    formatter->close_section(); // lc_fix_status
                                    formatter->flush(cout);
                                  });
       do {
         list<std::string> keys;
-        ret = store->ctl()->meta.mgr->list_keys_next(handle, default_max_keys, keys, &truncated);
+        ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, default_max_keys, keys, &truncated);
         if (ret < 0 && ret != -ENOENT) {
           std::cerr << "ERROR: lists_keys_next(): " << cpp_strerror(-ret) << std::endl;
           return ret;
@@ -1912,15 +1782,15 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store,
 
 }
 
-static bool has_object_expired(const DoutPrefixProvider *dpp, 
-                               rgw::sal::RGWRadosStore *store,
-                              const RGWBucketInfo& bucket_info,
+static bool has_object_expired(const DoutPrefixProvider *dpp,
+                              rgw::sal::RGWStore *store,
+                              rgw::sal::RGWBucket* bucket,
                               const rgw_obj_key& key, utime_t& delete_at)
 {
-  rgw_obj obj(bucket_info.bucket, key);
+  std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(key);
   bufferlist delete_at_bl;
 
-  int ret = rgw_object_get_attr(dpp, store, bucket_info, obj, RGW_ATTR_DELETE_AT, delete_at_bl, null_yield);
+  int ret = rgw_object_get_attr(dpp, store, obj.get(), RGW_ATTR_DELETE_AT, delete_at_bl, null_yield);
   if (ret < 0) {
     return false;  // no delete at attr, proceed
   }
@@ -1937,12 +1807,12 @@ static bool has_object_expired(const DoutPrefixProvider *dpp,
   return false;
 }
 
-static int fix_bucket_obj_expiry(const DoutPrefixProvider *dpp, 
-                                 rgw::sal::RGWRadosStore *store,
-                                const RGWBucketInfo& bucket_info,
+static int fix_bucket_obj_expiry(const DoutPrefixProvider *dpp,
+                                rgw::sal::RGWStore *store,
+                                rgw::sal::RGWBucket* bucket,
                                 RGWFormatterFlusher& flusher, bool dry_run)
 {
-  if (bucket_info.bucket.bucket_id == bucket_info.bucket.marker) {
+  if (bucket->get_key().bucket_id == bucket->get_key().marker) {
     ldpp_dout(dpp, -1) << "Not a resharded bucket skipping" << dendl;
     return 0;  // not a resharded bucket, move along
   }
@@ -1954,32 +1824,28 @@ static int fix_bucket_obj_expiry(const DoutPrefixProvider *dpp,
                               formatter->flush(std::cout);
                             });
 
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
-  list_op.params.list_versions = bucket_info.versioned();
-  list_op.params.allow_unordered = true;
+  params.list_versions = bucket->versioned();
+  params.allow_unordered = true;
 
-  bool is_truncated {false};
   do {
-    std::vector<rgw_bucket_dir_entry> objs;
-
-    int ret = list_op.list_objects(dpp, listing_max_entries, &objs, nullptr,
-                                  &is_truncated, null_yield);
+    int ret = bucket->list(dpp, params, listing_max_entries, results, null_yield);
     if (ret < 0) {
       lderr(store->ctx()) << "ERROR failed to list objects in the bucket" << dendl;
       return ret;
     }
-    for (const auto& obj : objs) {
+    for (const auto& obj : results.objs) {
       rgw_obj_key key(obj.key);
       utime_t delete_at;
-      if (has_object_expired(dpp, store, bucket_info, key, delete_at)) {
+      if (has_object_expired(dpp, store, bucket, key, delete_at)) {
        formatter->open_object_section("object_status");
        formatter->dump_string("object", key.name);
        formatter->dump_stream("delete_at") << delete_at;
 
        if (!dry_run) {
-         ret = rgw_remove_object(dpp, store, bucket_info, bucket_info.bucket, key);
+         ret = rgw_remove_object(dpp, store, bucket, key);
          formatter->dump_int("status", ret);
        }
 
@@ -1987,12 +1853,12 @@ static int fix_bucket_obj_expiry(const DoutPrefixProvider *dpp,
       }
     }
     formatter->flush(cout); // regularly flush every 1k entries
-  } while (is_truncated);
+  } while (results.is_truncated);
 
   return 0;
 }
 
-int RGWBucketAdminOp::fix_obj_expiry(rgw::sal::RGWRadosStore *store,
+int RGWBucketAdminOp::fix_obj_expiry(rgw::sal::RGWStore *store,
                                     RGWBucketAdminOpState& op_state,
                                     RGWFormatterFlusher& flusher,
                                      const DoutPrefixProvider *dpp, bool dry_run)
@@ -2003,8 +1869,13 @@ int RGWBucketAdminOp::fix_obj_expiry(rgw::sal::RGWRadosStore *store,
     lderr(store->ctx()) << "failed to initialize bucket" << dendl;
     return ret;
   }
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  ret = store->get_bucket(nullptr, admin_bucket.get_bucket_info(), &bucket);
+  if (ret < 0) {
+    return ret;
+  }
 
-  return fix_bucket_obj_expiry(dpp, store, admin_bucket.get_bucket_info(), flusher, dry_run);
+  return fix_bucket_obj_expiry(dpp, store, bucket.get(), flusher, dry_run);
 }
 
 void RGWBucketCompleteInfo::dump(Formatter *f) const {
@@ -3181,53 +3052,46 @@ int RGWBucketCtl::set_acl(ACLOwner& owner, rgw_bucket& bucket,
 }
 
 // TODO: remove RGWRados dependency for bucket listing
-int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info,
+int RGWBucketCtl::chown(rgw::sal::RGWStore *store, rgw::sal::RGWBucket* bucket,
                         const rgw_user& user_id, const std::string& display_name,
                         const std::string& marker, optional_yield y, const DoutPrefixProvider *dpp)
 {
   RGWObjectCtx obj_ctx(store);
-  std::vector<rgw_bucket_dir_entry> objs;
   map<string, bool> common_prefixes;
 
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
-  list_op.params.list_versions = true;
-  list_op.params.allow_unordered = true;
-  list_op.params.marker = marker;
+  params.list_versions = true;
+  params.allow_unordered = true;
+  params.marker = marker;
 
-  bool is_truncated = false;
   int count = 0;
   int max_entries = 1000;
 
   //Loop through objects and update object acls to point to bucket owner
 
   do {
-    objs.clear();
-    int ret = list_op.list_objects(dpp, max_entries, &objs, &common_prefixes, &is_truncated, y);
+    results.objs.clear();
+    int ret = bucket->list(dpp, params, max_entries, results, y);
     if (ret < 0) {
       ldout(store->ctx(), 0) << "ERROR: list objects failed: " << cpp_strerror(-ret) << dendl;
       return ret;
     }
 
-    list_op.params.marker = list_op.get_next_marker();
-    count += objs.size();
-
-    for (const auto& obj : objs) {
+    params.marker = results.next_marker;
+    count += results.objs.size();
 
-      rgw_obj r_obj(bucket_info.bucket, obj.key);
-      RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, r_obj);
-      RGWRados::Object::Read read_op(&op_target);
+    for (const auto& obj : results.objs) {
+      std::unique_ptr<rgw::sal::RGWObject> r_obj = bucket->get_object(obj.key);
 
-      map<string, bufferlist> attrs;
-      read_op.params.attrs = &attrs;
-      ret = read_op.prepare(y, dpp);
+      ret = r_obj->get_obj_attrs(&obj_ctx, y, dpp);
       if (ret < 0){
         ldout(store->ctx(), 0) << "ERROR: failed to read object " << obj.key.name << cpp_strerror(-ret) << dendl;
         continue;
       }
-      const auto& aiter = attrs.find(RGW_ATTR_ACL);
-      if (aiter == attrs.end()) {
+      const auto& aiter = r_obj->get_attrs().find(RGW_ATTR_ACL);
+      if (aiter == r_obj->get_attrs().end()) {
         ldpp_dout(dpp, 0) << "ERROR: no acls found for object " << obj.key.name << " .Continuing with next object." << dendl;
         continue;
       } else {
@@ -3262,17 +3126,19 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in
         bl.clear();
         encode(policy, bl);
 
-        obj_ctx.set_atomic(r_obj);
-        ret = store->getRados()->set_attr(dpp, &obj_ctx, bucket_info, r_obj, RGW_ATTR_ACL, bl);
+       r_obj->set_atomic(&obj_ctx);
+       map<string, bufferlist> attrs;
+       attrs[RGW_ATTR_ACL] = bl;
+       ret = r_obj->set_obj_attrs(dpp, &obj_ctx, &attrs, nullptr, y);
         if (ret < 0) {
           ldout(store->ctx(), 0) << "ERROR: modify attr failed " << cpp_strerror(-ret) << dendl;
           return ret;
         }
       }
     }
-    cerr << count << " objects processed in " << bucket_info.bucket.name
-        << ". Next marker " << list_op.params.marker.name << std::endl;
-  } while(is_truncated);
+    cerr << count << " objects processed in " << bucket
+        << ". Next marker " << params.marker.name << std::endl;
+  } while(results.is_truncated);
   return 0;
 }
 
index 6a62c631dfb9ace924e738bcc9dfc09b1b3576ff..1d5b1872cf1e82ec4369f878b73f498b8c8447b8 100644 (file)
@@ -17,6 +17,7 @@
 #include "rgw_metadata.h"
 
 #include "rgw_string.h"
+#include "rgw_sal.h"
 
 #include "common/Formatter.h"
 #include "common/lru_map.h"
@@ -37,10 +38,6 @@ class RGWUserCtl;
 class RGWBucketCtl;
 class RGWZone;
 struct RGWZoneParams;
-namespace rgw { namespace sal {
-  class RGWRadosStore;
-  class RGWBucketList;
-} }
 
 extern int rgw_bucket_parse_bucket_instance(const string& bucket_instance, string *bucket_name, string *bucket_id, int *shard_id);
 extern int rgw_bucket_parse_bucket_key(CephContext *cct, const string& key,
@@ -222,28 +219,14 @@ public:
   static RGWBucketInstanceMetadataHandlerBase *alloc();
 };
 
-/**
- * Get all the buckets owned by a user and fill up an RGWUserBuckets with them.
- * Returns: 0 on success, -ERR# on failure.
- */
-extern int rgw_read_user_buckets(const DoutPrefixProvider *dpp, 
-                                 rgw::sal::RGWRadosStore *store,
-                                 const rgw_user& user_id,
-                                 rgw::sal::RGWBucketList& buckets,
-                                 const string& marker,
-                                 const string& end_marker,
-                                 uint64_t max,
-                                 bool need_stats,
-                                optional_yield y);
-
-extern int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key);
-extern int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& bucket, int concurrent_max, optional_yield y);
+extern int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store, rgw::sal::RGWBucket* bucket, rgw_obj_key& key);
+extern int rgw_remove_bucket_bypass_gc(rgw::sal::RGWStore *store, rgw::sal::RGWBucket* bucket, int concurrent_max, optional_yield y);
 
-extern int rgw_object_get_attr(rgw::sal::RGWRadosStore* store, const RGWBucketInfo& bucket_info,
-                               const rgw_obj& obj, const char* attr_name,
-                               bufferlist& out_bl, optional_yield y);
+extern int rgw_object_get_attr(rgw::sal::RGWStore* store, rgw::sal::RGWObject* obj,
+                              const char* attr_name, bufferlist& out_bl,
+                              optional_yield y);
 
-extern void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, bool fix, optional_yield y, const DoutPrefixProvider *dpp);
+extern void check_bad_user_bucket_mapping(rgw::sal::RGWStore *store, rgw::sal::RGWUser* user, bool fix, optional_yield y, const DoutPrefixProvider *dpp);
 
 struct RGWBucketAdminOpState {
   rgw_user uid;
@@ -262,7 +245,7 @@ struct RGWBucketAdminOpState {
   bool sync_bucket;
   int max_aio = 0;
 
-  rgw_bucket bucket;
+  std::unique_ptr<rgw::sal::RGWBucket>  bucket;
 
   RGWQuotaInfo quota;
 
@@ -302,9 +285,9 @@ struct RGWBucketAdminOpState {
   std::string& get_object_name() { return object_name; }
   std::string& get_tenant() { return uid.tenant; }
 
-  rgw_bucket& get_bucket() { return bucket; }
-  void set_bucket(rgw_bucket& _bucket) {
-    bucket = _bucket; 
+  rgw::sal::RGWBucket* get_bucket() { return bucket.get(); }
+  void set_bucket(std::unique_ptr<rgw::sal::RGWBucket> _bucket) {
+    bucket = std::move(_bucket);
     bucket_stored = true;
   }
 
@@ -335,21 +318,20 @@ struct RGWBucketAdminOpState {
 class RGWBucket
 {
   RGWUserBuckets buckets;
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   RGWAccessHandle handle;
 
-  RGWUserInfo user_info;
-  rgw_bucket bucket;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  std::unique_ptr<rgw::sal::RGWUser> user;
 
   bool failure;
 
-  RGWBucketInfo bucket_info;
   RGWObjVersionTracker ep_objv; // entrypoint object version
 
 public:
   RGWBucket() : store(NULL), handle(NULL), failure(false) {}
-  int init(rgw::sal::RGWRadosStore *storage, RGWBucketAdminOpState& op_state, optional_yield y,
-             const DoutPrefixProvider *dpp, std::string *err_msg = NULL, map<string, bufferlist> *pattrs = NULL);
+  int init(rgw::sal::RGWStore *storage, RGWBucketAdminOpState& op_state, optional_yield y,
+             const DoutPrefixProvider *dpp, std::string *err_msg = NULL);
 
   int check_bad_index_multipart(RGWBucketAdminOpState& op_state,
               RGWFormatterFlusher& flusher,
@@ -367,7 +349,7 @@ public:
           std::string *err_msg = NULL);
 
   int link(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp,
-           map<string, bufferlist>& attrs, std::string *err_msg = NULL);
+           std::string *err_msg = NULL);
   int chown(RGWBucketAdminOpState& op_state, const string& marker,
             optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg = NULL);
   int unlink(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg = NULL);
@@ -376,52 +358,52 @@ public:
   int remove_object(const DoutPrefixProvider *dpp, RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
   int policy_bl_to_stream(bufferlist& bl, ostream& o);
   int get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y, const DoutPrefixProvider *dpp);
-  int sync(RGWBucketAdminOpState& op_state, map<string, bufferlist> *attrs, const DoutPrefixProvider *dpp, std::string *err_msg = NULL);
+  int sync(RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, std::string *err_msg = NULL);
 
   void clear_failure() { failure = false; }
 
-  const RGWBucketInfo& get_bucket_info() const { return bucket_info; }
+  const RGWBucketInfo& get_bucket_info() const { return bucket->get_info(); }
 };
 
 class RGWBucketAdminOp
 {
 public:
-  static int get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int get_policy(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp);
-  static int get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int get_policy(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   RGWAccessControlPolicy& policy, const DoutPrefixProvider *dpp);
-  static int dump_s3_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int dump_s3_policy(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   ostream& os, const DoutPrefixProvider *dpp);
 
-  static int unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp);
-  static int link(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg = NULL);
-  static int chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const string& marker, const DoutPrefixProvider *dpp, string *err_msg = NULL);
+  static int unlink(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp);
+  static int link(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg = NULL);
+  static int chown(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const string& marker, const DoutPrefixProvider *dpp, string *err_msg = NULL);
 
-  static int check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int check_index(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                   RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp);
 
-  static int remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, optional_yield y,
-      const DoutPrefixProvider *dpp, bool bypass_gc = false, bool keep_index_consistent = true);
-  static int remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp);
-  static int info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp);
-  static int limit_check(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int remove_bucket(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, optional_yield y,
+                          const DoutPrefixProvider *dpp, bool bypass_gc = false, bool keep_index_consistent = true);
+  static int remove_object(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp);
+  static int info(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp);
+  static int limit_check(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                         const std::list<std::string>& user_ids,
                         RGWFormatterFlusher& flusher, optional_yield y,
                          const DoutPrefixProvider *dpp,
                         bool warnings_only = false);
-  static int set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp);
+  static int set_quota(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp);
 
-  static int list_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int list_stale_instances(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                                  RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp);
 
-  static int clear_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int clear_stale_instances(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                                   RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp);
-  static int fix_lc_shards(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int fix_lc_shards(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                            RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp);
-  static int fix_obj_expiry(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
+  static int fix_obj_expiry(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state,
                            RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, bool dry_run = false);
 
-  static int sync_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg = NULL);
+  static int sync_bucket(rgw::sal::RGWStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg = NULL);
 };
 
 struct rgw_ep_info {
@@ -708,7 +690,7 @@ public:
                     const DoutPrefixProvider *dpp,
                     bool update_entrypoint = true);
 
-  int chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info,
+  int chown(rgw::sal::RGWStore *store, rgw::sal::RGWBucket* bucket,
             const rgw_user& user_id, const std::string& display_name,
             const std::string& marker, optional_yield y, const DoutPrefixProvider *dpp);
 
index 98dd4010df9c66d9ed4d084ee6cd70095d71bca9..e6ddcad793ba8e00f72da61923046ef6a198d29f 100644 (file)
@@ -64,7 +64,7 @@ int RGWCivetWebFrontend::process(struct mg_connection*  const conn)
                                 &cw_client))));
   RGWRestfulIO client_io(dout_context, &real_client_io);
 
-  RGWRequest req(env.store->getRados()->get_new_req_id());
+  RGWRequest req(env.store->get_new_req_id());
   int http_ret = 0;
   //assert (scheduler != nullptr);
   int ret = process_request(env.store, env.rest, &req, env.uri_prefix,
index 76428a0d3908b0609fb2b8a2ce8a1e5dff85cb98..57c76ced60bbbb397ce73259de86d7dc10605765 100644 (file)
@@ -99,8 +99,7 @@ int RGWGetUserInfoCR::Request::_send_request()
 template<>
 int RGWGetBucketInfoCR::Request::_send_request()
 {
-  return store->getRados()->get_bucket_info(store->svc(), params.tenant, params.bucket_name,
-                                result->bucket_info, &result->mtime, null_yield, dpp, &result->attrs);
+  return store->get_bucket(dpp, nullptr, params.tenant, params.bucket_name, &result->bucket, null_yield);
 }
 
 template<>
@@ -264,7 +263,7 @@ int RGWBucketLifecycleConfigCR::Request::_send_request()
     return -EIO;
   }
 
-  int ret = lc->set_bucket_config(params.bucket_info,
+  int ret = lc->set_bucket_config(params.bucket,
                                   params.bucket_attrs,
                                   &params.config);
   if (ret < 0) {
index 28bee86ef4bf02db85fdb14fb78c8ac86678544f..d41a19cdc0c6d4509ee925705aa411b2fbd5ea1f 100644 (file)
@@ -41,9 +41,7 @@ struct rgw_get_bucket_info_params {
 };
 
 struct rgw_get_bucket_info_result {
-  ceph::real_time mtime;
-  RGWBucketInfo bucket_info;
-  map<string, bufferlist> attrs;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
 };
 
 using RGWGetBucketInfoCR = RGWSimpleAsyncCR<rgw_get_bucket_info_params, rgw_get_bucket_info_result>;
@@ -68,8 +66,8 @@ using RGWObjectSimplePutCR = RGWSimpleWriteOnlyAsyncCR<rgw_object_simple_put_par
 
 
 struct rgw_bucket_lifecycle_config_params {
-  RGWBucketInfo bucket_info;
-  map<string, bufferlist> bucket_attrs;
+  rgw::sal::RGWBucket* bucket;
+  rgw::sal::RGWAttrs bucket_attrs;
   RGWLifecycleConfiguration config;
 };
 
index 9bf54edc5fbda5baf4911b5b9b1930a457cbbd69..25db8da2fc8096caaa9eb243526554a4613bb844 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "rgw_coroutine.h"
 #include "rgw_http_client.h"
-#include "rgw_sal.h"
+#include "rgw_sal_rados.h"
 
 #include "rgw_datalog.h"
 #include "rgw_sync_module.h"
index 50e0b6039614c38d79400d59f191a05d97573376..e46ce8adf2dcd8b9dc10a322df8198832bd69d87 100644 (file)
@@ -102,7 +102,7 @@ namespace rgw {
   {
     LookupFHResult fhr{nullptr, 0};
     std::string bucket_name{path};
-    RGWStatBucketRequest req(cct, rgwlib.get_store()->get_user(user.user_id), bucket_name, bs);
+    RGWStatBucketRequest req(cct, user->clone(), bucket_name, bs);
 
     int rc = rgwlib.get_fe()->execute_req(&req);
     if ((rc == 0) &&
@@ -197,7 +197,7 @@ namespace rgw {
        if (type == RGW_FS_TYPE_DIRECTORY)
          continue;
 
-       RGWStatObjRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
+       RGWStatObjRequest req(cct, user->clone(),
                              parent->bucket_name(), obj_path,
                              RGWStatObjRequest::FLAG_NONE);
        int rc = rgwlib.get_fe()->execute_req(&req);
@@ -234,7 +234,7 @@ namespace rgw {
          continue;
 
        obj_path += "/";
-       RGWStatObjRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
+       RGWStatObjRequest req(cct, user->clone(),
                              parent->bucket_name(), obj_path,
                              RGWStatObjRequest::FLAG_NONE);
        int rc = rgwlib.get_fe()->execute_req(&req);
@@ -266,7 +266,7 @@ namespace rgw {
       case 2:
       {
        std::string object_name{path};
-       RGWStatLeafRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
+       RGWStatLeafRequest req(cct, user->clone(),
                               parent, object_name);
        int rc = rgwlib.get_fe()->execute_req(&req);
        if ((rc == 0) &&
@@ -319,8 +319,7 @@ namespace rgw {
     if (rgw_fh->deleted())
       return -ESTALE;
 
-    RGWReadRequest req(get_context(), rgwlib.get_store()->get_user(user.user_id),
-                      rgw_fh, offset, length, buffer);
+    RGWReadRequest req(get_context(), user->clone(), rgw_fh, offset, length, buffer);
 
     int rc = rgwlib.get_fe()->execute_req(&req);
     if ((rc == 0) &&
@@ -342,8 +341,7 @@ namespace rgw {
     if (rgw_fh->deleted())
       return -ESTALE;
 
-    RGWReadRequest req(get_context(), rgwlib.get_store()->get_user(user.user_id),
-                      rgw_fh, offset, length, buffer);
+    RGWReadRequest req(get_context(), user->clone(), rgw_fh, offset, length, buffer);
 
     int rc = rgwlib.get_fe()->execute_req(&req);
     if ((rc == 0) &&
@@ -400,15 +398,14 @@ namespace rgw {
       } else {
        /* delete object w/key "<bucket>/" (uxattrs), if any */
        string oname{"/"};
-       RGWDeleteObjRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                               bkt_fh->bucket_name(), oname);
+       RGWDeleteObjRequest req(cct, user->clone(), bkt_fh->bucket_name(), oname);
        rc = rgwlib.get_fe()->execute_req(&req);
        /* don't care if ENOENT */
        unref(bkt_fh);
       }
 
       string bname{name};
-      RGWDeleteBucketRequest req(cct, rgwlib.get_store()->get_user(user.user_id), bname);
+      RGWDeleteBucketRequest req(cct, user->clone(), bname);
       rc = rgwlib.get_fe()->execute_req(&req);
       if (! rc) {
        rc = req.get_ret();
@@ -444,8 +441,7 @@ namespace rgw {
        }
        oname += "/";
       }
-      RGWDeleteObjRequest req(cct, rgwlib.get_store()->get_user(user.user_id), parent->bucket_name(),
-                             oname);
+      RGWDeleteObjRequest req(cct, user->clone(), parent->bucket_name(), oname);
       rc = rgwlib.get_fe()->execute_req(&req);
       if (! rc) {
        rc = req.get_ret();
@@ -522,8 +518,7 @@ namespace rgw {
       switch (ix) {
       case 0:
       {
-       RGWCopyObjRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                             src_fh, dst_fh, src_name, dst_name);
+       RGWCopyObjRequest req(cct, user->clone(), src_fh, dst_fh, src_name, dst_name);
        int rc = rgwlib.get_fe()->execute_req(&req);
        if ((rc != 0) ||
            ((rc = req.get_ret()) != 0)) {
@@ -644,8 +639,7 @@ namespace rgw {
        return mkr;
       }
 
-      RGWCreateBucketRequest req(get_context(),
-                                rgwlib.get_store()->get_user(user.user_id), bname);
+      RGWCreateBucketRequest req(get_context(), user->clone(), bname);
 
       /* save attrs */
       req.emplace_attr(RGW_ATTR_UNIX_KEY1, std::move(ux_key));
@@ -671,8 +665,7 @@ namespace rgw {
        return mkr;
       }
 
-      RGWPutObjRequest req(get_context(), rgwlib.get_store()->get_user(user.user_id),
-                          parent->bucket_name(), dir_name, bl);
+      RGWPutObjRequest req(get_context(), user->clone(), parent->bucket_name(), dir_name, bl);
 
       /* save attrs */
       req.emplace_attr(RGW_ATTR_UNIX_KEY1, std::move(ux_key));
@@ -731,8 +724,7 @@ namespace rgw {
 
     /* create it */
     buffer::list bl;
-    RGWPutObjRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                        parent->bucket_name(), obj_name, bl);
+    RGWPutObjRequest req(cct, user->clone(), parent->bucket_name(), obj_name, bl);
     MkObjResult mkr{nullptr, -EINVAL};
 
     rc = rgwlib.get_fe()->execute_req(&req);
@@ -843,8 +835,7 @@ namespace rgw {
       buffer::copy(link_path, strlen(link_path)));
 #endif
 
-    RGWPutObjRequest req(get_context(), rgwlib.get_store()->get_user(user.user_id),
-                        parent->bucket_name(), obj_name, bl);
+    RGWPutObjRequest req(get_context(), user->clone(), parent->bucket_name(), obj_name, bl);
 
     /* save attrs */
     req.emplace_attr(RGW_ATTR_UNIX_KEY1, std::move(ux_key));
@@ -918,8 +909,7 @@ namespace rgw {
       obj_name += "/";
     }
 
-    RGWSetAttrsRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                          rgw_fh->bucket_name(), obj_name);
+    RGWSetAttrsRequest req(cct, user->clone(), rgw_fh->bucket_name(), obj_name);
 
     rgw_fh->create_stat(st, mask);
     rgw_fh->encode_attrs(ux_key, ux_attrs);
@@ -936,8 +926,7 @@ namespace rgw {
     if (rc == -ENOENT) {
       /* special case:  materialize placeholder dir */
       buffer::list bl;
-      RGWPutObjRequest req(get_context(), rgwlib.get_store()->get_user(user.user_id), rgw_fh->bucket_name(),
-                          obj_name, bl);
+      RGWPutObjRequest req(get_context(), user->clone(), rgw_fh->bucket_name(), obj_name, bl);
 
       rgw_fh->encode_attrs(ux_key, ux_attrs); /* because std::moved */
 
@@ -991,8 +980,7 @@ namespace rgw {
     int rc, rc2, rc3;
     string obj_name{rgw_fh->relative_object_name2()};
 
-    RGWGetAttrsRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                          rgw_fh->bucket_name(), obj_name);
+    RGWGetAttrsRequest req(cct, user->clone(), rgw_fh->bucket_name(), obj_name);
 
     for (uint32_t ix = 0; ix < attrs->xattr_cnt; ++ix) {
       auto& xattr = attrs->xattrs[ix];
@@ -1075,8 +1063,7 @@ namespace rgw {
     int rc, rc2, rc3;
     string obj_name{rgw_fh->relative_object_name2()};
 
-    RGWGetAttrsRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                          rgw_fh->bucket_name(), obj_name);
+    RGWGetAttrsRequest req(cct, user->clone(), rgw_fh->bucket_name(), obj_name);
 
     rc = rgwlib.get_fe()->execute_req(&req);
     rc2 = req.get_ret();
@@ -1125,8 +1112,7 @@ namespace rgw {
     int rc, rc2;
     string obj_name{rgw_fh->relative_object_name2()};
 
-    RGWSetAttrsRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                          rgw_fh->bucket_name(), obj_name);
+    RGWSetAttrsRequest req(cct, user->clone(), rgw_fh->bucket_name(), obj_name);
 
     for (uint32_t ix = 0; ix < attrs->xattr_cnt; ++ix) {
       auto& xattr = attrs->xattrs[ix];
@@ -1168,8 +1154,7 @@ namespace rgw {
     int rc, rc2;
     string obj_name{rgw_fh->relative_object_name2()};
 
-    RGWRMAttrsRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                         rgw_fh->bucket_name(), obj_name);
+    RGWRMAttrsRequest req(cct, user->clone(), rgw_fh->bucket_name(), obj_name);
 
     for (uint32_t ix = 0; ix < attrs->xattr_cnt; ++ix) {
       auto& xattr = attrs->xattrs[ix];
@@ -1210,8 +1195,7 @@ namespace rgw {
       << " update old versioned fh : " << obj_name
       << dendl;
 
-    RGWSetAttrsRequest req(cct, rgwlib.get_store()->get_user(user.user_id),
-                          rgw_fh->bucket_name(), obj_name);
+    RGWSetAttrsRequest req(cct, user->clone(), rgw_fh->bucket_name(), obj_name);
 
     rgw_fh->encode_attrs(ux_key, ux_attrs);
 
@@ -1802,7 +1786,7 @@ namespace rgw {
     state->object->set_bucket(state->bucket.get());
 
     auto compression_type =
-      get_store()->svc()->zone->get_zone_params().get_compression_type(
+      get_store()->get_zone_params().get_compression_type(
        state->bucket->get_placement_rule());
 
     /* not obviously supportable */
index 60845d9d896b5c984c719e4a39fae8104690890c..b43eff8f17aa7a681e6d7cb7389451a02fa73d53 100644 (file)
@@ -856,7 +856,7 @@ namespace rgw {
     
     std::string uid; // should match user.user_id, iiuc
 
-    RGWUserInfo user;
+    std::unique_ptr<rgw::sal::RGWUser> user;
     RGWAccessKey key; // XXXX acc_key
 
     static std::atomic<uint32_t> fs_inst_counter;
@@ -984,13 +984,13 @@ namespace rgw {
       (void) fh_lru.unref(fh, cohort::lru::FLAG_NONE);
     }
 
-    int authorize(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store) {
-      int ret = store->ctl()->user->get_info_by_access_key(dpp, key.id, &user, null_yield);
+    int authorize(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store) {
+      int ret = store->get_user(dpp, key, null_yield, &user);
       if (ret == 0) {
-       RGWAccessKey* k = user.get_key(key.id);
+       RGWAccessKey* k = user->get_info().get_key(key.id);
        if (!k || (k->key != key.key))
          return -EINVAL;
-       if (user.suspended)
+       if (user->get_info().suspended)
          return -ERR_USER_SUSPENDED;
       } else {
        /* try external authenticators (ldap for now) */
@@ -1004,9 +1004,8 @@ namespace rgw {
        }
        if (token.valid() && (ldh->auth(token.id, token.key) == 0)) {
          /* try to store user if it doesn't already exist */
-         if (store->ctl()->user->get_info_by_uid(dpp, rgw_user(token.id), &user, null_yield) < 0) {
-           int ret = store->ctl()->user->store_info(dpp, user, null_yield,
-                                                  RGWUserCtl::PutParams()
+         if (user->load_by_id(dpp, null_yield) < 0) {
+           int ret = user->store_info(dpp, null_yield, RGWUserCtl::PutParams()
                                                   .set_exclusive(true));
            if (ret < 0) {
              lsubdout(get_context(), rgw, 10)
@@ -1295,14 +1294,10 @@ namespace rgw {
 
     uint64_t get_fsid() { return root_fh.state.dev; }
 
-    RGWUserInfo* get_user() { return &user; }
+    RGWUserInfo* get_user() { return &user->get_info(); }
 
     void update_user(const DoutPrefixProvider *dpp) {
-      RGWUserInfo _user = user;
-      auto user_ctl = rgwlib.get_store()->ctl()->user;
-      int ret = user_ctl->get_info_by_access_key(dpp, key.id, &user, null_yield);
-      if (ret != 0)
-        user = _user;
+      (void) rgwlib.get_store()->get_user(dpp, key, null_yield, &user);
     }
 
     void close();
@@ -2506,7 +2501,7 @@ public:
   size_t bytes_written;
   bool eio;
 
-  RGWWriteRequest(rgw::sal::RGWRadosStore* store,
+  RGWWriteRequest(rgw::sal::RGWStore* store,
                  std::unique_ptr<rgw::sal::RGWUser> _user,
                  RGWFileHandle* _fh, const std::string& _bname,
                  const std::string& _oname)
index 08f6042a62ce69d3790748a830fe5f6ed739ec28..6c5a61c8f7e124a1e3611fee1f60aa2075562312 100644 (file)
@@ -83,7 +83,7 @@ public:
   virtual void join() = 0;
 
   virtual void pause_for_new_config() = 0;
-  virtual void unpause_with_new_config(rgw::sal::RGWRadosStore* store,
+  virtual void unpause_with_new_config(rgw::sal::RGWStore* store,
                                        rgw_auth_registry_ptr_t auth_registry) = 0;
 };
 
@@ -146,7 +146,7 @@ public:
     env.mutex.get_write();
   }
 
-  void unpause_with_new_config(rgw::sal::RGWRadosStore* const store,
+  void unpause_with_new_config(rgw::sal::RGWStore* const store,
                                rgw_auth_registry_ptr_t auth_registry) override {
     env.store = store;
     env.auth_registry = std::move(auth_registry);
@@ -189,7 +189,7 @@ public:
     pprocess->pause();
   }
 
-  void unpause_with_new_config(rgw::sal::RGWRadosStore* const store,
+  void unpause_with_new_config(rgw::sal::RGWStore* const store,
                                rgw_auth_registry_ptr_t auth_registry) override {
     env.store = store;
     env.auth_registry = auth_registry;
@@ -245,17 +245,17 @@ public:
     }
 
     rgw_user uid(uid_str);
+    std::unique_ptr<rgw::sal::RGWUser> user = env.store->get_user(uid);
 
-    RGWUserInfo user_info;
-    int ret = env.store->ctl()->user->get_info_by_uid(this, uid, &user_info, null_yield);
+    int ret = user->load_by_id(this, null_yield);
     if (ret < 0) {
       derr << "ERROR: failed reading user info: uid=" << uid << " ret="
           << ret << dendl;
       return ret;
     }
 
-    map<string, RGWAccessKey>::iterator aiter = user_info.access_keys.begin();
-    if (aiter == user_info.access_keys.end()) {
+    map<string, RGWAccessKey>::iterator aiter = user->get_info().access_keys.begin();
+    if (aiter == user->get_info().access_keys.end()) {
       derr << "ERROR: user has no S3 access keys set" << dendl;
       return -EINVAL;
     }
@@ -287,11 +287,11 @@ class RGWFrontendPauser : public RGWRealmReloader::Pauser {
     if (pauser)
       pauser->pause();
   }
-  void resume(rgw::sal::RGWRadosStore *store) override {
+  void resume(rgw::sal::RGWStore *store) override {
     /* Initialize the registry of auth strategies which will coordinate
      * the dynamic reconfiguration. */
     auto auth_registry = \
-      rgw::auth::StrategyRegistry::create(g_ceph_context, implicit_tenants, store->getRados()->pctl);
+      rgw::auth::StrategyRegistry::create(g_ceph_context, implicit_tenants, store->get_ctl());
 
     for (auto frontend : frontends)
       frontend->unpause_with_new_config(store, auth_registry);
index f5520e12a9823c83be01aa4c55d486a15b6fc2c2..ee9f7d8de353d40eafad1d24273bbf8184cd52b3 100644 (file)
@@ -27,7 +27,7 @@
 #include "rgw_string.h"
 #include "rgw_multi.h"
 #include "rgw_sal.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 // this seems safe to use, at least for now--arguably, we should
 // prefer header-only fmt, in general
@@ -239,7 +239,7 @@ void *RGWLC::LCWorker::entry() {
   return NULL;
 }
 
-void RGWLC::initialize(CephContext *_cct, rgw::sal::RGWRadosStore *_store) {
+void RGWLC::initialize(CephContext *_cct, rgw::sal::RGWStore *_store) {
   cct = _cct;
   store = _store;
   sal_lc = store->get_lifecycle();
@@ -508,12 +508,12 @@ struct op_env {
   using LCWorker = RGWLC::LCWorker;
 
   lc_op op;
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   LCWorker* worker;
   rgw::sal::RGWBucket* bucket;
   LCObjsLister& ol;
 
-  op_env(lc_op& _op, rgw::sal::RGWRadosStore *_store, LCWorker* _worker,
+  op_env(lc_op& _op, rgw::sal::RGWStore *_store, LCWorker* _worker,
         rgw::sal::RGWBucket* _bucket, LCObjsLister& _ol)
     : op(_op), store(_store), worker(_worker), bucket(_bucket),
       ol(_ol) {}
@@ -529,7 +529,7 @@ struct lc_op_ctx {
   boost::optional<std::string> next_key_name;
   ceph::real_time effective_mtime;
 
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   rgw::sal::RGWBucket* bucket;
   lc_op& op; // ok--refers to expanded env.op
   LCObjsLister& ol;
@@ -583,15 +583,16 @@ static int remove_expired_obj(const DoutPrefixProvider *dpp, lc_op_ctx& oc, bool
   }
 
   obj = bucket->get_object(obj_key);
+  std::unique_ptr<rgw::sal::RGWObject::DeleteOp> del_op = obj->get_delete_op(&oc.rctx);
 
-  ACLOwner obj_owner;
-  obj_owner.set_id(rgw_user {meta.owner});
-  obj_owner.set_name(meta.owner_display_name);
-  ACLOwner bucket_owner;
-  bucket_owner.set_id(bucket_info.owner);
+  del_op->params.versioning_status = obj->get_bucket()->get_info().versioning_status();
+  del_op->params.obj_owner.set_id(rgw_user {meta.owner});
+  del_op->params.obj_owner.set_name(meta.owner_display_name);
+  del_op->params.bucket_owner.set_id(bucket_info.owner);
+  del_op->params.unmod_since = meta.mtime;
+  del_op->params.marker_version_id = version_id;
 
-  return obj->delete_object(dpp, &oc.rctx, obj_owner, bucket_owner, meta.mtime, false, 0,
-                           version_id, null_yield);
+  return del_op->delete_obj(dpp, null_yield);
 } /* remove_expired_obj */
 
 class LCOpAction {
@@ -846,7 +847,7 @@ int RGWLC::handle_multipart_expiration(rgw::sal::RGWBucket* target,
        return;
       }
       RGWObjectCtx rctx(store);
-      int ret = abort_multipart_upload(this, store, cct, &rctx, target->get_info(), mp_obj);
+      int ret = abort_multipart_upload(this, store, cct, &rctx, target, mp_obj);
       if (ret == 0) {
         if (perfcounter) {
           perfcounter->inc(l_rgw_lc_abort_mpu, 1);
@@ -1255,7 +1256,7 @@ public:
     target_placement.inherit_from(oc.bucket->get_placement_rule());
     target_placement.storage_class = transition.storage_class;
 
-    if (!oc.store->svc()->zone->get_zone_params().
+    if (!oc.store->get_zone_params().
        valid_placement(target_placement)) {
       ldpp_dout(oc.dpp, 0) << "ERROR: non existent dest placement: "
                           << target_placement
@@ -1948,7 +1949,7 @@ static std::string get_lc_shard_name(const rgw_bucket& bucket){
 }
 
 template<typename F>
-static int guard_lc_modify(rgw::sal::RGWRadosStore* store,
+static int guard_lc_modify(rgw::sal::RGWStore* store,
                           rgw::sal::Lifecycle* sal_lc,
                           const rgw_bucket& bucket, const string& cookie,
                           const F& f) {
@@ -1997,26 +1998,25 @@ static int guard_lc_modify(rgw::sal::RGWRadosStore* store,
   return ret;
 }
 
-int RGWLC::set_bucket_config(RGWBucketInfo& bucket_info,
-                         const map<string, bufferlist>& bucket_attrs,
+int RGWLC::set_bucket_config(rgw::sal::RGWBucket* bucket,
+                         const rgw::sal::RGWAttrs& bucket_attrs,
                          RGWLifecycleConfiguration *config)
 {
-  map<string, bufferlist> attrs = bucket_attrs;
+  rgw::sal::RGWAttrs attrs = bucket_attrs;
   bufferlist lc_bl;
   config->encode(lc_bl);
 
   attrs[RGW_ATTR_LC] = std::move(lc_bl);
 
   int ret =
-    store->ctl()->bucket->set_bucket_instance_attrs(
-      bucket_info, attrs, &bucket_info.objv_tracker, null_yield, this);
+    bucket->set_instance_attrs(this, attrs, null_yield);
   if (ret < 0)
     return ret;
 
-  rgw_bucket& bucket = bucket_info.bucket;
+  rgw_bucket& b = bucket->get_key();
 
 
-  ret = guard_lc_modify(store, sal_lc.get(), bucket, cookie,
+  ret = guard_lc_modify(store, sal_lc.get(), b, cookie,
                        [&](rgw::sal::Lifecycle* sal_lc, const string& oid,
                            const rgw::sal::Lifecycle::LCEntry& entry) {
     return sal_lc->set_entry(oid, entry);
@@ -2025,25 +2025,23 @@ int RGWLC::set_bucket_config(RGWBucketInfo& bucket_info,
   return ret;
 }
 
-int RGWLC::remove_bucket_config(RGWBucketInfo& bucket_info,
-                                const map<string, bufferlist>& bucket_attrs)
+int RGWLC::remove_bucket_config(rgw::sal::RGWBucket* bucket,
+                                const rgw::sal::RGWAttrs& bucket_attrs)
 {
-  map<string, bufferlist> attrs = bucket_attrs;
+  rgw::sal::RGWAttrs attrs = bucket_attrs;
   attrs.erase(RGW_ATTR_LC);
-  int ret =
-    store->ctl()->bucket->set_bucket_instance_attrs(
-      bucket_info, attrs, &bucket_info.objv_tracker, null_yield, this);
+  int ret = bucket->set_instance_attrs(this, attrs, null_yield);
 
-  rgw_bucket& bucket = bucket_info.bucket;
+  rgw_bucket& b = bucket->get_key();
 
   if (ret < 0) {
     ldout(cct, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket="
-        << bucket.name << " returned err=" << ret << dendl;
+        << b.name << " returned err=" << ret << dendl;
     return ret;
   }
 
 
-  ret = guard_lc_modify(store, sal_lc.get(), bucket, cookie,
+  ret = guard_lc_modify(store, sal_lc.get(), b, cookie,
                        [&](rgw::sal::Lifecycle* sal_lc, const string& oid,
                            const rgw::sal::Lifecycle::LCEntry& entry) {
     return sal_lc->rm_entry(oid, entry);
@@ -2060,17 +2058,16 @@ RGWLC::~RGWLC()
 
 namespace rgw::lc {
 
-int fix_lc_shard_entry(rgw::sal::RGWRadosStore* store,
+int fix_lc_shard_entry(rgw::sal::RGWStore* store,
                       rgw::sal::Lifecycle* sal_lc,
-                      const RGWBucketInfo& bucket_info,
-                      const map<std::string,bufferlist>& battrs)
+                      rgw::sal::RGWBucket* bucket)
 {
-  if (auto aiter = battrs.find(RGW_ATTR_LC);
-      aiter == battrs.end()) {
+  if (auto aiter = bucket->get_attrs().find(RGW_ATTR_LC);
+      aiter == bucket->get_attrs().end()) {
     return 0;    // No entry, nothing to fix
   }
 
-  auto shard_name = get_lc_shard_name(bucket_info.bucket);
+  auto shard_name = get_lc_shard_name(bucket->get_key());
   std::string lc_oid;
   get_lc_oid(store->ctx(), shard_name, &lc_oid);
 
@@ -2087,7 +2084,7 @@ int fix_lc_shard_entry(rgw::sal::RGWRadosStore* store,
   }
   ldout(store->ctx(), 5) << "lc_get_entry errored ret code=" << ret << dendl;
   if (ret == -ENOENT) {
-    ldout(store->ctx(), 1) << "No entry for bucket=" << bucket_info.bucket.name
+    ldout(store->ctx(), 1) << "No entry for bucket=" << bucket
                           << " creating " << dendl;
     // TODO: we have too many ppl making cookies like this!
     char cookie_buf[COOKIE_LEN + 1];
@@ -2095,7 +2092,7 @@ int fix_lc_shard_entry(rgw::sal::RGWRadosStore* store,
     std::string cookie = cookie_buf;
 
     ret = guard_lc_modify(
-      store, sal_lc, bucket_info.bucket, cookie,
+      store, sal_lc, bucket->get_key(), cookie,
       [&lc_oid](rgw::sal::Lifecycle* slc,
                              const string& oid,
                              const rgw::sal::Lifecycle::LCEntry& entry) {
index 8f231af6b6148a75a75ebb1e1ff11370de90db0f..847777e1f2c5cad6a25fa1cba4e5bd802ee03706 100644 (file)
@@ -461,7 +461,7 @@ WRITE_CLASS_ENCODER(RGWLifecycleConfiguration)
 
 class RGWLC : public DoutPrefixProvider {
   CephContext *cct;
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   std::unique_ptr<rgw::sal::Lifecycle> sal_lc;
   int max_objs{0};
   string *obj_names{nullptr};
@@ -508,7 +508,7 @@ public:
   RGWLC() : cct(nullptr), store(nullptr) {}
   ~RGWLC();
 
-  void initialize(CephContext *_cct, rgw::sal::RGWRadosStore *_store);
+  void initialize(CephContext *_cct, rgw::sal::RGWStore *_store);
   void finalize();
 
   int process(LCWorker* worker, bool once);
@@ -526,11 +526,11 @@ public:
   bool going_down();
   void start_processor();
   void stop_processor();
-  int set_bucket_config(RGWBucketInfo& bucket_info,
-                        const map<string, bufferlist>& bucket_attrs,
+  int set_bucket_config(rgw::sal::RGWBucket* bucket,
+                        const rgw::sal::RGWAttrs& bucket_attrs,
                         RGWLifecycleConfiguration *config);
-  int remove_bucket_config(RGWBucketInfo& bucket_info,
-                           const map<string, bufferlist>& bucket_attrs);
+  int remove_bucket_config(rgw::sal::RGWBucket* bucket,
+                           const rgw::sal::RGWAttrs& bucket_attrs);
 
   CephContext *get_cct() const override { return cct; }
   rgw::sal::Lifecycle *get_lc() const { return sal_lc.get(); }
@@ -546,10 +546,9 @@ public:
 
 namespace rgw::lc {
 
-int fix_lc_shard_entry(rgw::sal::RGWRadosStore *store,
+int fix_lc_shard_entry(rgw::sal::RGWStore *store,
                       rgw::sal::Lifecycle* sal_lc,
-                      const RGWBucketInfo& bucket_info,
-                      const map<std::string,bufferlist>& battrs);
+                      rgw::sal::RGWBucket* bucket);
 
 std::string s3_expiration_header(
   DoutPrefixProvider* dpp,
index 63f34cf3d7942e5d94a0b593d05664345efcd3bf..11e09efe05fe08f9ae46de4f0ecc619acde4c7d1 100644 (file)
@@ -30,7 +30,7 @@ namespace rgw {
     OpsLogSocket* olog;
     rgw::LDAPHelper* ldh{nullptr};
     RGWREST rest; // XXX needed for RGWProcessEnv
-    rgw::sal::RGWRadosStore* store;
+    rgw::sal::RGWStore* store;
     boost::intrusive_ptr<CephContext> cct;
 
   public:
@@ -38,7 +38,7 @@ namespace rgw {
       {}
     ~RGWLib() {}
 
-    rgw::sal::RGWRadosStore* get_store() { return store; }
+    rgw::sal::RGWStore* get_store() { return store; }
 
     RGWLibFrontend* get_fe() { return fe; }
 
@@ -74,7 +74,7 @@ namespace rgw {
       return user_info;
     }
 
-    int set_uid(rgw::sal::RGWRadosStore* store, const rgw_user& uid);
+    int set_uid(rgw::sal::RGWStore* store, const rgw_user& uid);
 
     int write_data(const char *buf, int len);
     int read_data(char *buf, int len);
@@ -121,7 +121,7 @@ namespace rgw {
 
     RGWHandler_Lib() {}
     ~RGWHandler_Lib() override {}
-    static int init_from_header(rgw::sal::RGWRadosStore *store,
+    static int init_from_header(rgw::sal::RGWStore *store,
                                struct req_state *s);
   }; /* RGWHandler_Lib */
 
@@ -137,7 +137,7 @@ namespace rgw {
     inline struct req_state* get_state() { return this->RGWRequest::s; }
 
     RGWLibRequest(CephContext* _cct, std::unique_ptr<rgw::sal::RGWUser> _user)
-      :  RGWRequest(rgwlib.get_store()->getRados()->get_new_req_id()),
+      :  RGWRequest(rgwlib.get_store()->get_new_req_id()),
         tuser(std::move(_user)), cct(_cct)
       {}
 
@@ -161,12 +161,12 @@ namespace rgw {
       RGWRequest::init_state(_s);
       RGWHandler::init(rados_ctx->get_store(), _s, io);
 
-      sysobj_ctx.emplace(store->svc()->sysobj);
+      sysobj_ctx.emplace(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
 
       get_state()->obj_ctx = rados_ctx;
       get_state()->sysobj_ctx = &(sysobj_ctx.get());
-      get_state()->req_id = store->svc()->zone_utils->unique_id(id);
-      get_state()->trans_id = store->svc()->zone_utils->unique_trans_id(id);
+      get_state()->req_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_id(id);
+      get_state()->trans_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_trans_id(id);
       get_state()->bucket_tenant = tuser->get_tenant();
       get_state()->set_user(tuser);
 
@@ -203,19 +203,19 @@ namespace rgw {
        RGWRequest::init_state(&rstate);
        RGWHandler::init(rados_ctx.get_store(), &rstate, &io_ctx);
 
-       sysobj_ctx.emplace(store->svc()->sysobj);
+       sysobj_ctx.emplace(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
 
        get_state()->cio = &io_ctx;
        get_state()->obj_ctx = &rados_ctx;
        get_state()->sysobj_ctx = &(sysobj_ctx.get());
-       get_state()->req_id = store->svc()->zone_utils->unique_id(id);
-       get_state()->trans_id = store->svc()->zone_utils->unique_trans_id(id);
+       get_state()->req_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_id(id);
+       get_state()->trans_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_trans_id(id);
 
        ldpp_dout(get_state(), 2) << "initializing for trans_id = "
            << get_state()->trans_id.c_str() << dendl;
       }
 
-    inline rgw::sal::RGWRadosStore* get_store() { return store; }
+    inline rgw::sal::RGWStore* get_store() { return store; }
     inline RGWLibIO& get_io() { return io_ctx; }
     inline RGWObjectCtx& get_octx() { return rados_ctx; }
 
index fe0b198874705b6ea3c9dd4bec04075d2e35a6d0..c96d74d21da07f5b7daf82c3b356521bb8f2b50f 100644 (file)
@@ -106,7 +106,7 @@ void RGWLoadGenProcess::gen_request(const string& method,
                                    int content_length, std::atomic<bool>* fail_flag)
 {
   RGWLoadGenRequest* req =
-    new RGWLoadGenRequest(store->getRados()->get_new_req_id(), method, resource,
+    new RGWLoadGenRequest(store->get_new_req_id(), method, resource,
                          content_length, fail_flag);
   dout(10) << "allocated request req=" << hex << req << dec << dendl;
   req_throttle.get(1);
index 85adfd7ea9d79ae52adbc199ee887d15ebe8392f..e61f1abcf2748eba9a61346a8f240999fcc55b31 100644 (file)
@@ -88,7 +88,7 @@ string render_log_object_name(const string& format,
 /* usage logger */
 class UsageLogger {
   CephContext *cct;
-  RGWRados *store;
+  rgw::sal::RGWStore *store;
   map<rgw_user_bucket, RGWUsageBatch> usage_map;
   ceph::mutex lock = ceph::make_mutex("UsageLogger");
   int32_t num_entries;
@@ -111,7 +111,7 @@ class UsageLogger {
   }
 public:
 
-  UsageLogger(CephContext *_cct, RGWRados *_store) : cct(_cct), store(_store), num_entries(0), timer(cct, timer_lock) {
+  UsageLogger(CephContext *_cct, rgw::sal::RGWStore *_store) : cct(_cct), store(_store), num_entries(0), timer(cct, timer_lock) {
     timer.init();
     std::lock_guard l{timer_lock};
     set_timer();
@@ -171,7 +171,7 @@ public:
 
 static UsageLogger *usage_logger = NULL;
 
-void rgw_log_usage_init(CephContext *cct, RGWRados *store)
+void rgw_log_usage_init(CephContext *cct, rgw::sal::RGWStore *store)
 {
   usage_logger = new UsageLogger(cct, store);
 }
@@ -328,7 +328,7 @@ void OpsLogSocket::log(struct rgw_log_entry& entry)
   append_output(bl);
 }
 
-int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
+int rgw_log_op(rgw::sal::RGWStore *store, RGWREST* const rest, struct req_state *s,
               const string& op_name, OpsLogSocket *olog)
 {
   struct rgw_log_entry entry;
@@ -462,23 +462,12 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
   if (s->cct->_conf->rgw_ops_log_rados) {
     string oid = render_log_object_name(s->cct->_conf->rgw_log_object_name, &bdt,
                                        entry.bucket_id, entry.bucket);
-
-    rgw_raw_obj obj(store->svc.zone->get_zone_params().log_pool, oid);
-
-    ret = store->append_async(obj, bl.length(), bl);
-    if (ret == -ENOENT) {
-      ret = store->create_pool(store->svc.zone->get_zone_params().log_pool);
-      if (ret < 0)
-        goto done;
-      // retry
-      ret = store->append_async(obj, bl.length(), bl);
-    }
+    ret = store->log_op(oid, bl);
   }
 
   if (olog) {
     olog->log(entry);
   }
-done:
   if (ret < 0)
     ldout(s->cct, 0) << "ERROR: failed to log entry" << dendl;
 
index 1de5227939a114bd4de7d7f94b4b0159bce685d0..c393da78641013c842b0fd4f7844857ecf23e603 100644 (file)
@@ -8,7 +8,9 @@
 #include "rgw_common.h"
 #include "common/OutputDataSocket.h"
 
-class RGWRados;
+namespace rgw { namespace sal {
+  class RGWStore;
+} }
 
 struct rgw_log_entry {
 
@@ -143,9 +145,9 @@ public:
 
 class RGWREST;
 
-int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
-              const string& op_name, OpsLogSocket *olog);
-void rgw_log_usage_init(CephContext *cct, RGWRados *store);
+int rgw_log_op(rgw::sal::RGWStore* store, RGWREST* const rest, struct req_state* s,
+              const string& op_name, OpsLogSocketolog);
+void rgw_log_usage_init(CephContext* cct, rgw::sal::RGWStore* store);
 void rgw_log_usage_finalize();
 void rgw_format_ops_log_entry(struct rgw_log_entry& entry,
                              ceph::Formatter *formatter);
index 5be70c8dda8919aa65eef0991a15edfa3fc29e88..c86642181e4be18f8a5f9cfd5115f52fa40d2cd2 100644 (file)
@@ -63,12 +63,12 @@ std::string script_oid(context ctx, const std::string& tenant) {
 }
 
 
-int read_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optional_yield y, context ctx, std::string& script)
+int read_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_yield y, context ctx, std::string& script)
 {
-  RGWSysObjectCtx obj_ctx(store->svc()->sysobj->init_obj_ctx());
+  RGWSysObjectCtx obj_ctx(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj->init_obj_ctx());
   RGWObjVersionTracker objv_tracker;
 
-  rgw_raw_obj obj(store->svc()->zone->get_zone_params().log_pool, script_oid(ctx, tenant));
+  rgw_raw_obj obj(store->get_zone_params().log_pool, script_oid(ctx, tenant));
 
   bufferlist bl;
   
@@ -97,12 +97,12 @@ int read_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optio
   return 0;
 }
 
-int write_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script)
+int write_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script)
 {
-  RGWSysObjectCtx obj_ctx(store->svc()->sysobj->init_obj_ctx());
+  RGWSysObjectCtx obj_ctx(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj->init_obj_ctx());
   RGWObjVersionTracker objv_tracker;
 
-  rgw_raw_obj obj(store->svc()->zone->get_zone_params().log_pool, script_oid(ctx, tenant));
+  rgw_raw_obj obj(store->get_zone_params().log_pool, script_oid(ctx, tenant));
 
   bufferlist bl;
   ceph::encode(script, bl);
@@ -124,14 +124,14 @@ int write_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, opti
   return 0;
 }
 
-int delete_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optional_yield y, context ctx)
+int delete_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_yield y, context ctx)
 {
   RGWObjVersionTracker objv_tracker;
 
-  rgw_raw_obj obj(store->svc()->zone->get_zone_params().log_pool, script_oid(ctx, tenant));
+  rgw_raw_obj obj(store->get_zone_params().log_pool, script_oid(ctx, tenant));
 
   const auto rc = rgw_delete_system_obj(
-      store->svc()->sysobj, 
+      static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj,
       obj.pool,
       obj.oid,
       &objv_tracker,
@@ -150,7 +150,7 @@ const std::string PACKAGE_LIST_OBJECT_NAME = "lua_package_allowlist";
 
 namespace bp = boost::process;
 
-int add_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::string& package_name, bool allow_compilation) {
+int add_package(rgw::sal::RGWStore* store, optional_yield y, const std::string& package_name, bool allow_compilation) {
   // verify that luarocks can load this oackage
   const auto p = bp::search_path("luarocks");
   if (p.empty()) {
@@ -183,7 +183,7 @@ int add_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::str
   std::map<std::string, bufferlist> new_package{{package_name, empty_bl}};
   librados::ObjectWriteOperation op;
   op.omap_set(new_package);
-  ret = rgw_rados_operate(*(store->getRados()->get_lc_pool_ctx()), 
+  ret = rgw_rados_operate(*(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_lc_pool_ctx()),
       PACKAGE_LIST_OBJECT_NAME, &op, y);
 
   if (ret < 0) {
@@ -192,10 +192,10 @@ int add_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::str
   return 0;
 }
 
-int remove_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::string& package_name) {
+int remove_package(rgw::sal::RGWStore* store, optional_yield y, const std::string& package_name) {
   librados::ObjectWriteOperation op;
   op.omap_rm_keys(std::set<std::string>({package_name}));
-  const auto ret = rgw_rados_operate(*(store->getRados()->get_lc_pool_ctx()), 
+  const auto ret = rgw_rados_operate(*(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_lc_pool_ctx()),
     PACKAGE_LIST_OBJECT_NAME, &op, y);
 
   if (ret < 0) {
@@ -205,7 +205,7 @@ int remove_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::
   return 0;
 }
 
-int list_packages(rgw::sal::RGWRadosStore* store, optional_yield y, packages_t& packages) {
+int list_packages(rgw::sal::RGWStore* store, optional_yield y, packages_t& packages) {
   constexpr auto max_chunk = 1024U;
   std::string start_after;
   bool more = true;
@@ -214,7 +214,7 @@ int list_packages(rgw::sal::RGWRadosStore* store, optional_yield y, packages_t&
     librados::ObjectReadOperation op;
     packages_t packages_chunk;
     op.omap_get_keys2(start_after, max_chunk, &packages_chunk, &more, &rval);
-    const auto ret = rgw_rados_operate(*(store->getRados()->get_lc_pool_ctx()),
+    const auto ret = rgw_rados_operate(*(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_lc_pool_ctx()),
       PACKAGE_LIST_OBJECT_NAME, &op, nullptr, y);
   
     if (ret < 0) {
@@ -227,7 +227,7 @@ int list_packages(rgw::sal::RGWRadosStore* store, optional_yield y, packages_t&
   return 0;
 }
 
-int install_packages(rgw::sal::RGWRadosStore* store, optional_yield y, packages_t& failed_packages, std::string& output) {
+int install_packages(rgw::sal::RGWStore* store, optional_yield y, packages_t& failed_packages, std::string& output) {
   // luarocks directory cleanup
   boost::system::error_code ec;
   const auto& luarocks_path = store->get_luarocks_path();
index 8241622b246cab8ab4f0a4e7dafc5650797f2387..296b9a71d57ddaf45efe02965a4ef8c5c86beda7 100644 (file)
@@ -6,7 +6,7 @@
 class lua_State;
 class rgw_user;
 namespace rgw::sal {
-  class RGWRadosStore;
+  class RGWStore;
 }
 
 namespace rgw::lua {
@@ -26,13 +26,13 @@ context to_context(const std::string& s);
 bool verify(const std::string& script, std::string& err_msg);
 
 // store a lua script in a context
-int write_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script);
+int write_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script);
 
 // read the stored lua script from a context
-int read_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optional_yield y, context ctx, std::string& script);
+int read_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_yield y, context ctx, std::string& script);
 
 // delete the stored lua script from a context
-int delete_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, optional_yield y, context ctx);
+int delete_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_yield y, context ctx);
 
 #ifdef WITH_RADOSGW_LUA_PACKAGES
 #include <set>
@@ -40,17 +40,17 @@ int delete_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, opt
 using packages_t = std::set<std::string>;
 
 // add a lua package to the allowlist
-int add_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::string& package_name, bool allow_compilation);
+int add_package(rgw::sal::RGWStore* store, optional_yield y, const std::string& package_name, bool allow_compilation);
 
 // remove a lua package from the allowlist
-int remove_package(rgw::sal::RGWRadosStore* store, optional_yield y, const std::string& package_name);
+int remove_package(rgw::sal::RGWStore* store, optional_yield y, const std::string& package_name);
 
 // list lua packages in the allowlist
-int list_packages(rgw::sal::RGWRadosStore* store, optional_yield y, packages_t& packages);
+int list_packages(rgw::sal::RGWStore* store, optional_yield y, packages_t& packages);
 
 // install all packages from the allowlist
 // return the list of packages that failed to install and the output of the install command
-int install_packages(rgw::sal::RGWRadosStore* store, optional_yield y, packages_t& failed_packages, std::string& output);
+int install_packages(rgw::sal::RGWStore* store, optional_yield y, packages_t& failed_packages, std::string& output);
 #endif
 }
 
index b5654d6df1ea4c6aed05d6fa6ca5afd332cd16ee..8cf475e00d6dbe51e2cdfd10627f5a124e220dd8 100644 (file)
@@ -30,7 +30,7 @@ int RequestLog(lua_State* L)
   const auto s = reinterpret_cast<req_state*>(lua_touserdata(L, lua_upvalueindex(4)));
   const std::string op_name(reinterpret_cast<const char*>(lua_touserdata(L, lua_upvalueindex(5))));
   if (store && s) {
-    const auto rc = rgw_log_op(store->getRados(), rest, s, op_name, olog);
+    const auto rc = rgw_log_op(store, rest, s, op_name, olog);
     lua_pushinteger(L, rc);
   } else {
     ldout(s->cct, 1) << "Lua ERROR: missing rados store, cannot use ops log"  << dendl;
@@ -769,7 +769,7 @@ struct RequestMetaTable : public EmptyMetaTable {
 };
 
 int execute(
-    rgw::sal::RGWRadosStore* store,
+    rgw::sal::RGWStore* store,
     RGWREST* rest,
     OpsLogSocket* olog,
     req_state* s, 
index 5ace5bf157fc442c3d437cac6316c6a620c8c8a1..478e1ef8f868a4a9b8821eb0b2caf80411267bd1 100644 (file)
@@ -7,14 +7,14 @@ class req_state;
 class RGWREST;
 class OpsLogSocket;
 namespace rgw::sal {
-  class RGWRadosStore;
+  class RGWStore;
 }
 
 namespace rgw::lua::request {
 
 // execute a lua script in the Request context
 int execute(
-    rgw::sal::RGWRadosStore* store,
+    rgw::sal::RGWStore* store,
     RGWREST* rest,
     OpsLogSocket* olog,
     req_state *s, 
index ccc70294882e7271545d3923d703868e581099e7..3223d7b0e26dcfa3ee0196a33090ba1265d12608 100644 (file)
@@ -328,8 +328,9 @@ int radosgw_Main(int argc, const char **argv)
 #endif
 
   const DoutPrefix dp(cct.get(), dout_subsys, "rgw main: ");
-  rgw::sal::RGWRadosStore *store =
+  rgw::sal::RGWStore *store =
     RGWStoreManager::get_storage(&dp, g_ceph_context,
+                                "rados",
                                 g_conf()->rgw_enable_gc_threads,
                                 g_conf()->rgw_enable_lc_threads,
                                 g_conf()->rgw_enable_quota_threads,
@@ -351,14 +352,14 @@ int radosgw_Main(int argc, const char **argv)
     return -r;
   }
 
-  rgw_rest_init(g_ceph_context, store->svc()->zone->get_zonegroup());
+  rgw_rest_init(g_ceph_context, store->get_zonegroup());
 
   mutex.lock();
   init_timer.cancel_all_events();
   init_timer.shutdown();
   mutex.unlock();
 
-  rgw_log_usage_init(g_ceph_context, store->getRados());
+  rgw_log_usage_init(g_ceph_context, store);
 
   RGWREST rest;
 
@@ -386,7 +387,7 @@ int radosgw_Main(int argc, const char **argv)
   const bool swift_at_root = g_conf()->rgw_swift_url_prefix == "/";
   if (apis_map.count("s3") > 0 || s3website_enabled) {
     if (! swift_at_root) {
-      rest.register_default_mgr(set_logging(rest_filter(store->getRados(), RGW_REST_S3,
+      rest.register_default_mgr(set_logging(rest_filter(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados(), RGW_REST_S3,
                                                         new RGWRESTMgr_S3(s3website_enabled, sts_enabled, iam_enabled, pubsub_enabled))));
     } else {
       derr << "Cannot have the S3 or S3 Website enabled together with "
@@ -445,10 +446,10 @@ int radosgw_Main(int argc, const char **argv)
 
     if (! swift_at_root) {
       rest.register_resource(g_conf()->rgw_swift_url_prefix,
-                          set_logging(rest_filter(store->getRados(), RGW_REST_SWIFT,
+                          set_logging(rest_filter(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados(), RGW_REST_SWIFT,
                                                   swift_resource)));
     } else {
-      if (store->svc()->zone->get_zonegroup().zones.size() > 1) {
+      if (store->get_zonegroup().zones.size() > 1) {
         derr << "Placing Swift API in the root of URL hierarchy while running"
              << " multi-site configuration requires another instance of RadosGW"
              << " with S3 API enabled!" << dendl;
@@ -482,7 +483,7 @@ int radosgw_Main(int argc, const char **argv)
   rgw::auth::ImplicitTenants implicit_tenant_context{g_conf()};
   g_conf().add_observer(&implicit_tenant_context);
   auto auth_registry = \
-    rgw::auth::StrategyRegistry::create(g_ceph_context, implicit_tenant_context, store->getRados()->pctl);
+    rgw::auth::StrategyRegistry::create(g_ceph_context, implicit_tenant_context, store->get_ctl());
 
   /* Header custom behavior */
   rest.register_x_headers(g_conf()->rgw_log_http_headers);
@@ -616,7 +617,7 @@ int radosgw_Main(int argc, const char **argv)
     fes.push_back(fe);
   }
 
-  r = store->getRados()->register_to_service_map("rgw", service_map_meta);
+  r = store->register_to_service_map("rgw", service_map_meta);
   if (r < 0) {
     derr << "ERROR: failed to register to service map: " << cpp_strerror(-r) << dendl;
 
@@ -630,7 +631,7 @@ int radosgw_Main(int argc, const char **argv)
   auto reloader = std::make_unique<RGWRealmReloader>(store,
                                                     service_map_meta, &pauser);
 
-  RGWRealmWatcher realm_watcher(g_ceph_context, store->svc()->zone->get_realm());
+  RGWRealmWatcher realm_watcher(g_ceph_context, store->get_realm());
   realm_watcher.add_watcher(RGWRealmNotify::Reload, *reloader);
   realm_watcher.add_watcher(RGWRealmNotify::ZonesNeedPeriod, pusher);
 
index 4e265ba02a624a6d25066b24a3b0c859ea33dc8c..6f7c3db0bee86795f5b5bec869b35dd146cccc96 100644 (file)
@@ -20,7 +20,7 @@
 
 
 namespace rgw { namespace sal {
-class RGWRadosStore;
+class RGWStore;
 } }
 class RGWCoroutine;
 class JSONObj;
index ff44766bdf6c545c6c65c762254998b6dcbbfa1f..79e05f7e361bd650ff2a9251a92f53831b850f15 100644 (file)
@@ -78,7 +78,7 @@ bool is_v2_upload_id(const string& upload_id)
          (strncmp(uid, MULTIPART_UPLOAD_ID_PREFIX_LEGACY, sizeof(MULTIPART_UPLOAD_ID_PREFIX_LEGACY) - 1) == 0);
 }
 
-int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info,
+int list_multipart_parts(rgw::sal::RGWBucket* bucket,
                         CephContext *cct,
                         const string& upload_id,
                         const string& meta_oid, int num_parts,
@@ -89,19 +89,14 @@ int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_i
   map<string, bufferlist> parts_map;
   map<string, bufferlist>::iterator iter;
 
-  rgw_obj obj;
-  obj.init_ns(bucket_info.bucket, meta_oid, RGW_OBJ_NS_MULTIPART);
-  obj.set_in_extra_data(true);
-
-  rgw_raw_obj raw_obj;
-  store->getRados()->obj_to_raw(bucket_info.placement_rule, obj, &raw_obj);
+  std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(
+                     rgw_obj_key(meta_oid, std::string(), RGW_OBJ_NS_MULTIPART));
+  obj->set_in_extra_data(true);
 
   bool sorted_omap = is_v2_upload_id(upload_id) && !assume_unsorted;
 
   parts.clear();
 
-  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
-  auto sysobj = obj_ctx.get_obj(raw_obj);
   int ret;
   if (sorted_omap) {
     string p;
@@ -111,10 +106,10 @@ int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_i
     snprintf(buf, sizeof(buf), "%08d", marker);
     p.append(buf);
 
-    ret = sysobj.omap().get_vals(p, num_parts + 1, &parts_map,
+    ret = obj->omap_get_vals(p, num_parts + 1, &parts_map,
                                  nullptr, null_yield);
   } else {
-    ret = sysobj.omap().get_all(&parts_map, null_yield);
+    ret = obj->omap_get_all(&parts_map, null_yield);
   }
   if (ret < 0) {
     return ret;
@@ -146,7 +141,7 @@ int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_i
          * where one gateway doesn't support correctly sorted omap
          * keys for multipart upload just assume data is unsorted.
          */
-        return list_multipart_parts(store, bucket_info, cct, upload_id,
+        return list_multipart_parts(bucket, cct, upload_id,
                                    meta_oid, num_parts, marker, parts,
                                    next_marker, truncated, true);
       }
@@ -188,28 +183,28 @@ int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_i
   return 0;
 }
 
-int list_multipart_parts(rgw::sal::RGWRadosStore *store, struct req_state *s,
+int list_multipart_parts(struct req_state *s,
                         const string& upload_id,
                         const string& meta_oid, int num_parts,
                         int marker, map<uint32_t, RGWUploadPartInfo>& parts,
                         int *next_marker, bool *truncated,
                         bool assume_unsorted)
 {
-  return list_multipart_parts(store, s->bucket->get_info(), s->cct, upload_id,
+  return list_multipart_parts(s->bucket.get(), s->cct, upload_id,
                              meta_oid, num_parts, marker, parts,
                              next_marker, truncated, assume_unsorted);
 }
 
 int abort_multipart_upload(const DoutPrefixProvider *dpp,
-                           rgw::sal::RGWRadosStore *store, CephContext *cct,
-                          RGWObjectCtx *obj_ctx, RGWBucketInfo& bucket_info,
+                          rgw::sal::RGWStore *store, CephContext *cct,
+                          RGWObjectCtx *obj_ctx, rgw::sal::RGWBucket* bucket,
                           RGWMPObj& mp_obj)
 {
-  rgw_obj meta_obj;
-  meta_obj.init_ns(bucket_info.bucket, mp_obj.get_meta(), RGW_OBJ_NS_MULTIPART);
-  meta_obj.set_in_extra_data(true);
-  meta_obj.index_hash_source = mp_obj.get_key();
-  cls_rgw_obj_chain chain;
+  std::unique_ptr<rgw::sal::RGWObject> meta_obj = bucket->get_object(
+                   rgw_obj_key(mp_obj.get_meta(), std::string(), RGW_OBJ_NS_MULTIPART));
+  meta_obj->set_in_extra_data(true);
+  meta_obj->set_hash_source(mp_obj.get_key());
+  std::unique_ptr<rgw::sal::GCChain> chain = store->get_gc_chain(meta_obj.get());
   list<rgw_obj_index_key> remove_objs;
   map<uint32_t, RGWUploadPartInfo> obj_parts;
   bool truncated;
@@ -218,7 +213,7 @@ int abort_multipart_upload(const DoutPrefixProvider *dpp,
   uint64_t parts_accounted_size = 0;
 
   do {
-    ret = list_multipart_parts(store, bucket_info, cct,
+    ret = list_multipart_parts(bucket, cct,
                               mp_obj.get_upload_id(), mp_obj.get_meta(),
                               1000, marker, obj_parts, &marker, &truncated);
     if (ret < 0) {
@@ -231,24 +226,24 @@ int abort_multipart_upload(const DoutPrefixProvider *dpp,
         obj_iter != obj_parts.end();
         ++obj_iter) {
       RGWUploadPartInfo& obj_part = obj_iter->second;
-      rgw_obj obj;
       if (obj_part.manifest.empty()) {
         string oid = mp_obj.get_part(obj_iter->second.num);
-        obj.init_ns(bucket_info.bucket, oid, RGW_OBJ_NS_MULTIPART);
-        obj.index_hash_source = mp_obj.get_key();
-        ret = store->getRados()->delete_obj(dpp, *obj_ctx, bucket_info, obj, 0);
+       std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(
+                                   rgw_obj_key(oid, std::string(), RGW_OBJ_NS_MULTIPART));
+       obj->set_hash_source(mp_obj.get_key());
+       ret = obj->delete_object(dpp, obj_ctx, null_yield);
         if (ret < 0 && ret != -ENOENT)
           return ret;
       } else {
-        store->getRados()->update_gc_chain(meta_obj, obj_part.manifest, &chain);
+       chain->update(&obj_part.manifest);
         RGWObjManifest::obj_iterator oiter = obj_part.manifest.obj_begin();
         if (oiter != obj_part.manifest.obj_end()) {
-          rgw_obj head;
+         std::unique_ptr<rgw::sal::RGWObject> head = bucket->get_object(rgw_obj_key());
           rgw_raw_obj raw_head = oiter.get_location().get_raw_obj(store);
-          RGWSI_Tier_RADOS::raw_obj_to_obj(bucket_info.bucket, raw_head, &head);
+         head->raw_obj_to_obj(raw_head);
 
           rgw_obj_index_key key;
-          head.key.get_index_key(&key);
+          head->get_key().get_index_key(&key);
           remove_objs.push_back(key);
         }
       }
@@ -257,29 +252,28 @@ int abort_multipart_upload(const DoutPrefixProvider *dpp,
   } while (truncated);
 
   /* use upload id as tag and do it synchronously */
-  ret = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id());
+  ret = chain->send(mp_obj.get_upload_id());
   if (ret < 0) {
     ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl;
     if (ret == -ENOENT) {
       return -ERR_NO_SUCH_UPLOAD;
     }
     //Delete objects inline if send chain to gc fails
-    store->getRados()->delete_objs_inline(chain, mp_obj.get_upload_id());
+    chain->delete_inline(mp_obj.get_upload_id());
   }
 
-  RGWRados::Object del_target(store->getRados(), bucket_info, *obj_ctx, meta_obj);
-  RGWRados::Object::Delete del_op(&del_target);
-  del_op.params.bucket_owner = bucket_info.owner;
-  del_op.params.versioning_status = 0;
+  std::unique_ptr<rgw::sal::RGWObject::DeleteOp> del_op = meta_obj->get_delete_op(obj_ctx);
+  del_op->params.bucket_owner = bucket->get_acl_owner();
+  del_op->params.versioning_status = 0;
   if (!remove_objs.empty()) {
-    del_op.params.remove_objs = &remove_objs;
+    del_op->params.remove_objs = &remove_objs;
   }
   
-  del_op.params.abortmp = true;
-  del_op.params.parts_accounted_size = parts_accounted_size;
+  del_op->params.abortmp = true;
+  del_op->params.parts_accounted_size = parts_accounted_size;
 
   // and also remove the metadata obj
-  ret = del_op.delete_obj(null_yield, dpp);
+  ret = del_op->delete_obj(dpp, null_yield);
   if (ret < 0) {
     ldpp_dout(dpp, 20) << __func__ << ": del_op.delete_obj returned " <<
       ret << dendl;
@@ -287,30 +281,39 @@ int abort_multipart_upload(const DoutPrefixProvider *dpp,
   return (ret == -ENOENT) ? -ERR_NO_SUCH_UPLOAD : ret;
 }
 
-int list_bucket_multiparts(const DoutPrefixProvider *dpp, 
-                           rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info,
+int list_bucket_multiparts(const DoutPrefixProvider *dpp,
+                          rgw::sal::RGWBucket* bucket,
                           const string& prefix, const string& marker,
                           const string& delim,
                           const int& max_uploads,
                           vector<rgw_bucket_dir_entry> *objs,
                           map<string, bool> *common_prefixes, bool *is_truncated)
 {
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
   MultipartMetaFilter mp_filter;
 
-  list_op.params.prefix = prefix;
-  list_op.params.delim = delim;
-  list_op.params.marker = marker;
-  list_op.params.ns = RGW_OBJ_NS_MULTIPART;
-  list_op.params.filter = &mp_filter;
+  params.prefix = prefix;
+  params.delim = delim;
+  params.marker = marker;
+  params.ns = RGW_OBJ_NS_MULTIPART;
+  params.filter = &mp_filter;
+
+  int ret = bucket->list(dpp, params, max_uploads, results, null_yield);
+
+  if (ret < 0)
+    return ret;
+
+  *objs = std::move(results.objs);
+  *common_prefixes = std::move(results.common_prefixes);
+  *is_truncated = results.is_truncated;
 
-  return(list_op.list_objects(dpp, max_uploads, objs, common_prefixes, is_truncated, null_yield));
+  return ret;
 }
 
-int abort_bucket_multiparts(const DoutPrefixProvider *dpp, 
-                            rgw::sal::RGWRadosStore *store, CephContext *cct, 
-                            RGWBucketInfo& bucket_info, string& prefix, string& delim)
+int abort_bucket_multiparts(const DoutPrefixProvider *dpp,
+                           rgw::sal::RGWStore *store, CephContext *cct,
+                           rgw::sal::RGWBucket* bucket, string& prefix, string& delim)
 {
   constexpr int max = 1000;
   int ret, num_deleted = 0;
@@ -320,18 +323,18 @@ int abort_bucket_multiparts(const DoutPrefixProvider *dpp,
   bool is_truncated;
 
   do {
-    ret = list_bucket_multiparts(dpp, store, bucket_info, prefix, marker, delim,
+    ret = list_bucket_multiparts(dpp, bucket, prefix, marker, delim,
                                 max, &objs, nullptr, &is_truncated);
     if (ret < 0) {
       ldpp_dout(dpp, 0) << __func__ <<
        " ERROR : calling list_bucket_multiparts; ret=" << ret <<
-       "; bucket=\"" << bucket_info.bucket << "\"; prefix=\"" <<
+       "; bucket=\"" << bucket << "\"; prefix=\"" <<
        prefix << "\"; delim=\"" << delim << "\"" << dendl;
       return ret;
     }
     ldpp_dout(dpp, 20) << __func__ <<
       " INFO: aborting and cleaning up multipart upload(s); bucket=\"" <<
-      bucket_info.bucket << "\"; objs.size()=" << objs.size() <<
+      bucket << "\"; objs.size()=" << objs.size() <<
       "; is_truncated=" << is_truncated << dendl;
 
     if (!objs.empty()) {
@@ -340,7 +343,7 @@ int abort_bucket_multiparts(const DoutPrefixProvider *dpp,
         rgw_obj_key key(obj.key);
         if (!mp.from_meta(key.name))
           continue;
-        ret = abort_multipart_upload(dpp, store, cct, &obj_ctx, bucket_info, mp);
+        ret = abort_multipart_upload(dpp, store, cct, &obj_ctx, bucket, mp);
         if (ret < 0) {
          // we're doing a best-effort; if something cannot be found,
          // log it and keep moving forward
index 4b6cad74c5225dea817b79850d8c3aad63027186..2f79a6f041affa676434058fb121c427f76fe84c 100644 (file)
@@ -10,7 +10,7 @@
 #include "rgw_compression_types.h"
 
 namespace rgw { namespace sal {
-  class RGWRadosStore;
+  class RGWStore;
 } }
 
 #define MULTIPART_UPLOAD_ID_PREFIX_LEGACY "2/"
@@ -108,7 +108,7 @@ public:
 
 extern bool is_v2_upload_id(const string& upload_id);
 
-extern int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info,
+extern int list_multipart_parts(rgw::sal::RGWBucket* bucket,
                                CephContext *cct,
                                 const string& upload_id,
                                 const string& meta_oid, int num_parts,
@@ -116,18 +116,19 @@ extern int list_multipart_parts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& b
                                 int *next_marker, bool *truncated,
                                 bool assume_unsorted = false);
 
-extern int list_multipart_parts(rgw::sal::RGWRadosStore *store, struct req_state *s,
+extern int list_multipart_parts(struct req_state *s,
                                 const string& upload_id,
                                 const string& meta_oid, int num_parts,
                                 int marker, map<uint32_t, RGWUploadPartInfo>& parts,
                                 int *next_marker, bool *truncated,
                                 bool assume_unsorted = false);
 
-extern int abort_multipart_upload(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, CephContext *cct, RGWObjectCtx *obj_ctx,
-                                RGWBucketInfo& bucket_info, RGWMPObj& mp_obj);
+extern int abort_multipart_upload(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store,
+                                 CephContext *cct, RGWObjectCtx *obj_ctx,
+                                 rgw::sal::RGWBucket* bucket, RGWMPObj& mp_obj);
 
-extern int list_bucket_multiparts(const DoutPrefixProvider *dpp, 
-                                  rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info,
+extern int list_bucket_multiparts(const DoutPrefixProvider *dpp,
+                                 rgw::sal::RGWBucket* bucket,
                                  const string& prefix,
                                  const string& marker,
                                  const string& delim,
@@ -135,6 +136,8 @@ extern int list_bucket_multiparts(const DoutPrefixProvider *dpp,
                                  vector<rgw_bucket_dir_entry> *objs,
                                  map<string, bool> *common_prefixes, bool *is_truncated);
 
-extern int abort_bucket_multiparts(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, CephContext *cct, RGWBucketInfo& bucket_info,
-                                string& prefix, string& delim);
+extern int abort_bucket_multiparts(const DoutPrefixProvider *dpp,
+                                  rgw::sal::RGWStore *store, CephContext *cct,
+                                  rgw::sal::RGWBucket* bucket,
+                                  string& prefix, string& delim);
 #endif
index c21c986f011d5538d7bc9928aa547b4eab021751..33811b9c1a363585ed0bf45403e83b07c5b4b18d 100644 (file)
@@ -8,10 +8,10 @@
 #include <boost/algorithm/hex.hpp>
 #include <boost/context/protected_fixedsize_stack.hpp>
 #include <spawn/spawn.hpp>
+#include "rgw_sal_rados.h"
 #include "rgw_pubsub.h"
 #include "rgw_pubsub_push.h"
 #include "rgw_perf_counters.h"
-#include "rgw_sal_rados.h"
 #include "common/dout.h"
 #include <chrono>
 
index 169e09c6b20cba4f795a1ba3a542ca68b182fcbb..bc2529a0576666a42cb56408680d3404823f53b2 100644 (file)
@@ -1,5 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
+// vim: ts=8 sw=2 smarttab ft=cpp
 
 #pragma once
 
index 42aefea6712a199a7e5f81aa9e23a8de5982303f..35828e1b99e45ad3fe8ebeff34e2e9826716f7b7 100644 (file)
 
 #define dout_subsys ceph_subsys_rgw
 
-static rgw::sal::RGWRadosStore *store = NULL;
+static rgw::sal::RGWStore *store = NULL;
 
 class StoreDestructor {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
 
 public:
-  explicit StoreDestructor(rgw::sal::RGWRadosStore *_s) : store(_s) {}
+  explicit StoreDestructor(rgw::sal::RGWStore *_s) : store(_s) {}
   ~StoreDestructor() {
     if (store) {
       RGWStoreManager::close_storage(store);
@@ -81,7 +81,7 @@ int main(const int argc, const char **argv)
   common_init_finish(g_ceph_context);
 
   const DoutPrefix dp(cct.get(), dout_subsys, "rgw object expirer: ");
-  store = RGWStoreManager::get_storage(&dp, g_ceph_context, false, false, false, false, false);
+  store = RGWStoreManager::get_storage(&dp, g_ceph_context, "rados", false, false, false, false, false);
   if (!store) {
     std::cerr << "couldn't init storage provider" << std::endl;
     return EIO;
index facfa2eac24cf3deff54fc0ddb2aa54156d34413..559d1ff63b1f348458f8ed7987bc4ab223124f9e 100644 (file)
@@ -190,32 +190,12 @@ int RGWObjExpStore::objexp_hint_trim(const string& oid,
   return 0;
 }
 
-int RGWObjectExpirer::init_bucket_info(const string& tenant_name,
-                                       const string& bucket_name,
-                                       const string& bucket_id,
-                                       RGWBucketInfo& bucket_info)
-{
-  /*
-   * XXX Here's where it gets tricky. We went to all the trouble of
-   * punching the tenant through the objexp_hint_entry, but now we
-   * find that our instances do not actually have tenants. They are
-   * unique thanks to IDs. So the tenant string is not needed...
-
-   * XXX reloaded: it turns out tenants were needed after all since bucket ids
-   * are ephemeral, good call encoding tenant info!
-   */
-
-  return store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name,
-                               bucket_info, nullptr, null_yield, nullptr);
-
-}
-
 int RGWObjectExpirer::garbage_single_object(const DoutPrefixProvider *dpp, objexp_hint_entry& hint)
 {
   RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
 
-  int ret = init_bucket_info(hint.tenant, hint.bucket_name,
-          hint.bucket_id, bucket_info);
+  int ret = store->get_bucket(dpp, nullptr, rgw_bucket(hint.tenant, hint.bucket_name, hint.bucket_id), &bucket, null_yield);
   if (-ENOENT == ret) {
     ldpp_dout(dpp, 15) << "NOTICE: cannot find bucket = " \
         << hint.bucket_name << ". The object must be already removed" << dendl;
@@ -233,10 +213,9 @@ int RGWObjectExpirer::garbage_single_object(const DoutPrefixProvider *dpp, objex
     key.instance = "null";
   }
 
-  rgw_obj obj(bucket_info.bucket, key);
-  store->getRados()->set_atomic(&rctx, obj);
-  ret = store->getRados()->delete_obj(dpp, rctx, bucket_info, obj,
-          bucket_info.versioning_status(), 0, hint.exp_time);
+  std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(key);
+  obj->set_atomic(&rctx);
+  ret = obj->delete_object(dpp, &rctx, null_yield);
 
   return ret;
 }
@@ -255,7 +234,7 @@ void RGWObjectExpirer::garbage_chunk(const DoutPrefixProvider *dpp,
     ldpp_dout(dpp, 15) << "got removal hint for: " << iter->key_ts.sec() \
         << " - " << iter->key_ext << dendl;
 
-    int ret = objexp_hint_parse(store->getRados()->ctx(), *iter, &hint);
+    int ret = objexp_hint_parse(store->ctx(), *iter, &hint);
     if (ret < 0) {
       ldpp_dout(dpp, 1) << "cannot parse removal hint for " << hint.obj_key << dendl;
       continue;
@@ -319,7 +298,7 @@ bool RGWObjectExpirer::process_single_shard(const DoutPrefixProvider *dpp,
   utime_t time(max_secs, 0);
   l.set_duration(time);
 
-  int ret = l.lock_exclusive(&store->getRados()->objexp_pool_ctx, shard);
+  int ret = l.lock_exclusive(&static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->objexp_pool_ctx, shard);
   if (ret == -EBUSY) { /* already locked by another processor */
     ldpp_dout(dpp, 5) << __func__ << "(): failed to acquire lock on " << shard << dendl;
     return false;
@@ -355,7 +334,7 @@ bool RGWObjectExpirer::process_single_shard(const DoutPrefixProvider *dpp,
     marker = out_marker;
   } while (truncated);
 
-  l.unlock(&store->getRados()->objexp_pool_ctx, shard);
+  l.unlock(&static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->objexp_pool_ctx, shard);
   return done;
 }
 
index b259f1c43b2c35dc456b2eff620e3a2dc3cb545d..15c1bcaf90b3640edce04ffa326d2d0d64bfe83f 100644 (file)
@@ -70,14 +70,9 @@ public:
 
 class RGWObjectExpirer {
 protected:
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   RGWObjExpStore exp_store;
 
-  int init_bucket_info(const std::string& tenant_name,
-                       const std::string& bucket_name,
-                       const std::string& bucket_id,
-                       RGWBucketInfo& bucket_info);
-
   class OEWorker : public Thread, public DoutPrefixProvider {
     CephContext *cct;
     RGWObjectExpirer *oe;
@@ -103,9 +98,9 @@ protected:
   std::atomic<bool> down_flag = { false };
 
 public:
-  explicit RGWObjectExpirer(rgw::sal::RGWRadosStore *_store)
+  explicit RGWObjectExpirer(rgw::sal::RGWStore *_store)
     : store(_store),
-      exp_store(_store->getRados()->ctx(), _store->svc()->rados, _store->svc()->zone),
+      exp_store(_store->ctx(), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone),
       worker(NULL) {
   }
   ~RGWObjectExpirer() {
index 0a6b5aea0eada8b1609ca9fd1dddd22b027f285a..7f00a7fc1c71970f665a4f308f44478d4d726ab7 100644 (file)
@@ -243,13 +243,14 @@ bool RGWOIDCProvider::validate_input()
   return true;
 }
 
-int RGWOIDCProvider::get_providers(const DoutPrefixProvider *dpp, RGWRados *store,
-                                    const string& tenant,
-                                    vector<RGWOIDCProvider>& providers)
+int RGWOIDCProvider::get_providers(const DoutPrefixProvider *dpp,
+                                  rgw::sal::RGWStore* store,
+                                  const string& tenant,
+                                  vector<RGWOIDCProvider>& providers)
 {
-  auto ctl = store->pctl;
+  auto ctl = store->get_ctl();
   auto svc = ctl->svc;
-  auto pool = store->svc.zone->get_zone_params().oidc_pool;
+  auto pool = store->get_zone_params().oidc_pool;
   string prefix = tenant + oidc_url_oid_prefix;
 
   //Get the filtered objects
@@ -265,7 +266,7 @@ int RGWOIDCProvider::get_providers(const DoutPrefixProvider *dpp, RGWRados *stor
       return r;
     }
     for (const auto& iter : oids) {
-      RGWOIDCProvider provider(ctl->cct, store->pctl);
+      RGWOIDCProvider provider(ctl->cct, store->get_ctl());
       bufferlist bl;
       auto obj_ctx = svc->sysobj->init_obj_ctx();
 
index 88fa8fb3092516217cb6cc529156da4ad8c979f7..a19803afc10c5d4254b1e8410cea4829691a63f0 100644 (file)
@@ -9,7 +9,7 @@
 #include "common/ceph_context.h"
 #include "common/ceph_json.h"
 
-#include "rgw/rgw_rados.h"
+#include "rgw/rgw_sal.h"
 
 class RGWCtl;
 
@@ -118,9 +118,10 @@ public:
   void decode_json(JSONObj *obj);
 
   static const string& get_url_oid_prefix();
-  static int get_providers(const DoutPrefixProvider *dpp, RGWRados *store,
-                            const string& tenant,
-                            vector<RGWOIDCProvider>& providers);
+  static int get_providers(const DoutPrefixProvider *dpp,
+                          rgw::sal::RGWStore* store,
+                          const string& tenant,
+                          vector<RGWOIDCProvider>& providers);
 };
 WRITE_CLASS_ENCODER(RGWOIDCProvider)
 #endif /* CEPH_RGW_OIDC_PROVIDER_H */
index 8b35662ac5735e44d607ea74bef25d71d6b34f4c..8ccbfce34670b373e1236066a7c757a9b70e62b2 100644 (file)
@@ -49,6 +49,7 @@
 #include "rgw_perf_counters.h"
 #include "rgw_notify.h"
 #include "rgw_notify_event_type.h"
+#include "rgw_sal.h"
 #include "rgw_sal_rados.h"
 
 #include "services/svc_zone.h"
@@ -185,7 +186,6 @@ static int decode_policy(CephContext *cct,
 
 
 static int get_user_policy_from_attr(CephContext * const cct,
-                                    rgw::sal::RGWRadosStore * const store,
                                     map<string, bufferlist>& attrs,
                                     RGWAccessControlPolicy& policy    /* out */)
 {
@@ -311,7 +311,6 @@ get_public_access_conf_from_attr(const map<string, bufferlist>& attrs)
 }
 
 vector<Policy> get_iam_user_policy_from_attr(CephContext* cct,
-                        rgw::sal::RGWRadosStore* store,
                         map<string, bufferlist>& attrs,
                         const string& tenant) {
   vector<Policy> policies;
@@ -514,10 +513,9 @@ static int read_obj_policy(const DoutPrefixProvider *dpp,
  * only_bucket: If true, reads the user and bucket ACLs rather than the object ACL.
  * Returns: 0 on success, -ERR# otherwise.
  */
-int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y)
+int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store, struct req_state* s, optional_yield y)
 {
   int ret = 0;
-  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
 
   string bi = s->info.args.get(RGW_SYS_PARAM_PREFIX "bucket-instance");
   if (!bi.empty()) {
@@ -545,11 +543,11 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosS
   /* check if copy source is within the current domain */
   if (!s->src_bucket_name.empty()) {
     std::unique_ptr<rgw::sal::RGWBucket> src_bucket;
-    ret = store->get_bucket(dpp, nullptr, s->src_tenant_name, s->src_bucket_name, &src_bucket, y);
-    if (ret == 0) {
-      ret = src_bucket->load_by_name(dpp, s->src_tenant_name, s->src_bucket_name,
-                                    s->bucket_instance_id, &obj_ctx, s->yield);
-    }
+    ret = store->get_bucket(dpp, nullptr,
+                           rgw_bucket(s->src_tenant_name,
+                                      s->src_bucket_name,
+                                      s->bucket_instance_id),
+                           &src_bucket, y);
     if (ret == 0) {
       string& zonegroup = src_bucket->get_info().zonegroup;
       s->local_source = store->get_zonegroup().equals(zonegroup);
@@ -632,7 +630,7 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosS
     s->dest_placement.storage_class = s->info.storage_class;
     s->dest_placement.inherit_from(s->bucket->get_placement_rule());
 
-    if (!store->svc()->zone->get_zone_params().valid_placement(s->dest_placement)) {
+    if (!store->get_zone_params().valid_placement(s->dest_placement)) {
       ldpp_dout(dpp, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
       return -EINVAL;
     }
@@ -642,10 +640,12 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosS
 
   /* handle user ACL only for those APIs which support it */
   if (s->user_acl) {
-    map<string, bufferlist> uattrs;
-    ret = store->ctl()->user->get_attrs_by_uid(dpp, acct_acl_user.uid, &uattrs, s->yield);
+    rgw::sal::RGWAttrs uattrs;
+    std::unique_ptr<rgw::sal::RGWUser> acl_user = store->get_user(acct_acl_user.uid);
+
+    ret = acl_user->read_attrs(dpp, y, &uattrs);
     if (!ret) {
-      ret = get_user_policy_from_attr(s->cct, store, uattrs, *s->user_acl);
+      ret = get_user_policy_from_attr(s->cct, uattrs, *s->user_acl);
     }
     if (-ENOENT == ret) {
       /* In already existing clusters users won't have ACL. In such case
@@ -668,9 +668,10 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosS
   // hence the check for user type
   if (! s->user->get_id().empty() && s->auth.identity->get_identity_type() != TYPE_ROLE) {
     try {
-      map<string, bufferlist> uattrs;
-      if (ret = store->ctl()->user->get_attrs_by_uid(dpp, s->user->get_id(), &uattrs, s->yield); ! ret) {
-          auto user_policies = get_iam_user_policy_from_attr(s->cct, store, uattrs, s->user->get_tenant());
+      rgw::sal::RGWAttrs uattrs;
+      ret = s->user->read_attrs(dpp, y, &uattrs);
+      if (ret == 0) {
+          auto user_policies = get_iam_user_policy_from_attr(s->cct, uattrs, s->user->get_tenant());
           s->iam_user_policies.insert(s->iam_user_policies.end(),
                                       std::make_move_iterator(user_policies.begin()),
                                       std::make_move_iterator(user_policies.end()));
@@ -695,7 +696,7 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosS
     ret = -EACCES;
   }
 
-  bool success = store->svc()->zone->get_redirect_zone_endpoint(&s->redirect_zone_endpoint);
+  bool success = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_redirect_zone_endpoint(&s->redirect_zone_endpoint);
   if (success) {
     ldpp_dout(dpp, 20) << "redirect_zone_endpoint=" << s->redirect_zone_endpoint << dendl;
   }
@@ -709,8 +710,8 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosS
  * only_bucket: If true, reads the bucket ACL rather than the object ACL.
  * Returns: 0 on success, -ERR# otherwise.
  */
-int rgw_build_object_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, struct req_state *s,
-                             bool prefetch_data, optional_yield y)
+int rgw_build_object_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store,
+                             struct req_state *s, bool prefetch_data, optional_yield y)
 {
   int ret = 0;
 
@@ -757,7 +758,7 @@ static int rgw_iam_add_tags_from_bl(struct req_state* s, bufferlist& bl){
   return 0;
 }
 
-static int rgw_iam_add_existing_objtags(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, struct req_state* s, std::uint64_t action) {
+static int rgw_iam_add_existing_objtags(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store, struct req_state* s, std::uint64_t action) {
   s->object->set_atomic(s->obj_ctx);
   int op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, dpp);
   if (op_ret < 0)
@@ -791,7 +792,7 @@ static void rgw_add_grant_to_iam_environment(rgw::IAM::Environment& e, struct re
   }
 }
 
-void rgw_build_iam_environment(rgw::sal::RGWRadosStore* store,
+void rgw_build_iam_environment(rgw::sal::RGWStore* store,
                                      struct req_state* s)
 {
   const auto& m = s->info.env->get_map();
@@ -942,7 +943,7 @@ int RGWOp::verify_op_mask()
     return -EPERM;
   }
 
-  if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && !store->svc()->zone->zone_is_writeable()) {
+  if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && !static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->zone_is_writeable()) {
     ldpp_dout(this, 5) << "NOTICE: modify request to a read-only zone by a "
         "non-system user, permission denied"  << dendl;
     return -EPERM;
@@ -1290,30 +1291,29 @@ int RGWOp::init_quota()
     return 0;
   }
 
-  rgw::sal::RGWRadosUser owner_user(store, s->bucket->get_info().owner);
+  std::unique_ptr<rgw::sal::RGWUser> owner_user =
+                       store->get_user(s->bucket->get_info().owner);
   rgw::sal::RGWUser* user;
 
   if (s->user->get_id() == s->bucket_owner.get_id()) {
     user = s->user.get();
   } else {
-    int r = owner_user.load_by_id(this, s->yield);
+    int r = owner_user->load_by_id(this, s->yield);
     if (r < 0)
       return r;
-    user = &owner_user;
+    user = owner_user.get();
   }
 
+  store->get_quota(bucket_quota, user_quota);
+
   if (s->bucket->get_info().quota.enabled) {
     bucket_quota = s->bucket->get_info().quota;
   } else if (user->get_info().bucket_quota.enabled) {
     bucket_quota = user->get_info().bucket_quota;
-  } else {
-    bucket_quota = store->svc()->quota->get_bucket_quota();
   }
 
   if (user->get_info().user_quota.enabled) {
     user_quota = user->get_info().user_quota;
-  } else {
-    user_quota = store->svc()->quota->get_user_quota();
   }
 
   return 0;
@@ -1924,7 +1924,6 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl, optional_yield y)
        RGWAccessControlPolicy& _bucket_acl = allocated_acls.back();
 
        std::unique_ptr<rgw::sal::RGWBucket> tmp_bucket;
-        auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
        int r = store->get_bucket(this, s->user.get(), s->user->get_tenant(), bucket_name, &tmp_bucket, y);
         if (r < 0) {
           ldpp_dout(this, 0) << "could not get bucket info for bucket="
@@ -2289,7 +2288,7 @@ void RGWListBuckets::execute(optional_yield y)
   }
 
   if (supports_account_metadata()) {
-    op_ret = store->ctl()->user->get_attrs_by_uid(this, s->user->get_id(), &attrs, s->yield);
+    op_ret = s->user->read_attrs(this, s->yield, &attrs);
     if (op_ret < 0) {
       goto send_end;
     }
@@ -2408,19 +2407,19 @@ void RGWGetUsage::execute(optional_yield y)
     }    
   }
 
-  op_ret = rgw_user_sync_all_stats(this, store, s->user->get_id(), y);
+  op_ret = rgw_user_sync_all_stats(this, store, s->user.get(), y);
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "ERROR: failed to sync user stats" << dendl;
     return;
   }
 
-  op_ret = rgw_user_get_all_buckets_stats(this, store, s->user->get_id(), buckets_usage, y);
+  op_ret = rgw_user_get_all_buckets_stats(this, store, s->user.get(), buckets_usage, y);
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "ERROR: failed to get user's buckets stats" << dendl;
     return;
   }
 
-  op_ret = store->ctl()->user->read_stats(s->user->get_id(), &stats, y);
+  op_ret = s->user->read_stats(y, &stats);
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "ERROR: can't read user header"  << dendl;
     return;
@@ -2448,12 +2447,11 @@ void RGWStatAccount::execute(optional_yield y)
   do {
 
     lastmarker = nullptr;
-    op_ret = rgw_read_user_buckets(this, store, s->user->get_id(), buckets, marker,
-                                  string(), max_buckets, true, y);
+    op_ret = s->user->list_buckets(this, marker, string(), max_buckets, true, buckets, y);
     if (op_ret < 0) {
       /* hmm.. something wrong here.. the user was authenticated, so it
          should exist */
-      ldpp_dout(this, 10) << "WARNING: failed on rgw_read_user_buckets uid="
+      ldpp_dout(this, 10) << "WARNING: failed on list_buckets uid="
                        << s->user->get_id() << " ret=" << op_ret << dendl;
       break;
     } else {
@@ -2848,9 +2846,8 @@ int RGWCreateBucket::verify_permission(optional_yield y)
   if (s->user->get_max_buckets()) {
     rgw::sal::RGWBucketList buckets;
     string marker;
-    op_ret = rgw_read_user_buckets(this, store, s->user->get_id(), buckets,
-                                  marker, string(), s->user->get_max_buckets(),
-                                  false, y);
+    op_ret = s->user->list_buckets(this, marker, string(), s->user->get_max_buckets(),
+                                  false, buckets, y);
     if (op_ret < 0) {
       return op_ret;
     }
@@ -3039,7 +3036,7 @@ void RGWCreateBucket::execute(optional_yield y)
   buffer::list aclbl;
   buffer::list corsbl;
   string bucket_name = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
-  rgw_raw_obj obj(store->svc()->zone->get_zone_params().domain_root, bucket_name);
+  rgw_raw_obj obj(store->get_zone_params().domain_root, bucket_name);
 
   op_ret = get_params(y);
   if (op_ret < 0)
@@ -3047,7 +3044,7 @@ void RGWCreateBucket::execute(optional_yield y)
 
   if (!relaxed_region_enforcement &&
       !location_constraint.empty() &&
-      !store->svc()->zone->has_zonegroup_api(location_constraint)) {
+      !static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->has_zonegroup_api(location_constraint)) {
       ldpp_dout(this, 0) << "location constraint (" << location_constraint << ")"
                        << " can't be found." << dendl;
       op_ret = -ERR_INVALID_LOCATION_CONSTRAINT;
@@ -3085,7 +3082,7 @@ void RGWCreateBucket::execute(optional_yield y)
 
   if (s->bucket_exists) {
     if (!s->system_request &&
-        store->svc()->zone->get_zonegroup().get_id() != s->bucket->get_info().zonegroup) {
+        store->get_zonegroup().get_id() != s->bucket->get_info().zonegroup) {
       op_ret = -EEXIST;
       return;
     }
@@ -3182,11 +3179,10 @@ void RGWCreateBucket::execute(optional_yield y)
     }
   }
 
-  op_ret = store->ctl()->bucket->link_bucket(s->user->get_id(), s->bucket->get_key(),
-                                          s->bucket->get_creation_time(), y, s, false);
+  op_ret = s->bucket->link(this, s->user.get(), y, false);
   if (op_ret && !existed && op_ret != -EEXIST) {
     /* if it exists (or previously existed), don't remove it! */
-    op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), s->bucket->get_key(), y, this);
+    op_ret = s->bucket->unlink(this, s->user.get(), y);
     if (op_ret < 0) {
       ldpp_dout(this, 0) << "WARNING: failed to unlink bucket: ret=" << op_ret
                       << dendl;
@@ -3239,9 +3235,7 @@ void RGWCreateBucket::execute(optional_yield y)
       s->bucket->get_info().has_website = !s->bucket->get_info().website_conf.is_empty();
 
       /* This will also set the quota on the bucket. */
-      op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
-                                                           &s->bucket->get_info().objv_tracker,
-                                                           y, this);
+      op_ret = s->bucket->set_instance_attrs(this, attrs, y);
     } while (op_ret == -ECANCELED && tries++ < 20);
 
     /* Restore the proper return code. */
@@ -3775,9 +3769,9 @@ void RGWPutObj::execute(optional_yield y)
   }
 
   // make reservation for notification if needed
-  rgw::notify::reservation_t res(store, s, s->object.get());
-  const auto event_type = rgw::notify::ObjectCreatedPut;
-  op_ret = rgw::notify::publish_reserve(event_type, res, obj_tags.get());
+  std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
+                                               s, rgw::notify::ObjectCreatedPut);
+  op_ret = res->publish_reserve(obj_tags.get());
   if (op_ret < 0) {
     return;
   }
@@ -3847,11 +3841,17 @@ void RGWPutObj::execute(optional_yield y)
   }
 
   if ((! copy_source.empty()) && !copy_source_range) {
-    rgw::sal::RGWRadosObject obj(store, rgw_obj_key(copy_source_object_name, copy_source_version_id));
-    rgw::sal::RGWRadosBucket bucket(store, copy_source_bucket_info);
+    std::unique_ptr<rgw::sal::RGWBucket> bucket;
+    op_ret = store->get_bucket(nullptr, copy_source_bucket_info, &bucket);
+    if (op_ret < 0) {
+      ldpp_dout(this, 0) << "ERROR: failed to get bucket with error" << op_ret << dendl;
+      return;
+    }
+    std::unique_ptr<rgw::sal::RGWObject> obj =
+      bucket->get_object(rgw_obj_key(copy_source_object_name, copy_source_version_id));
 
     RGWObjState *astate;
-    op_ret = obj.get_obj_state(this, &obj_ctx, bucket, &astate, s->yield);
+    op_ret = obj->get_obj_state(this, &obj_ctx, &astate, s->yield);
     if (op_ret < 0) {
       ldpp_dout(this, 0) << "ERROR: get copy source obj state returned with error" << op_ret << dendl;
       return;
@@ -3870,7 +3870,7 @@ void RGWPutObj::execute(optional_yield y)
   // no filters by default
   DataProcessor *filter = processor.get();
 
-  const auto& compression_type = store->svc()->zone->get_zone_params().get_compression_type(*pdest_placement);
+  const auto& compression_type = store->get_zone_params().get_compression_type(*pdest_placement);
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
 
@@ -4061,7 +4061,7 @@ void RGWPutObj::execute(optional_yield y)
   }
 
   // send request to notification manager
-  const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, mtime, etag, event_type, res, this);
+  int ret = res->publish_commit(this, s->obj_size, mtime, etag);
   if (ret < 0) {
     ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
     // too late to rollback operation, hence op_ret is not set here
@@ -4124,9 +4124,8 @@ void RGWPostObj::execute(optional_yield y)
   }
 
   // make reservation for notification if needed
-  rgw::notify::reservation_t res(store, s, s->object.get());
-  const auto event_type = rgw::notify::ObjectCreatedPost;
-  op_ret = rgw::notify::publish_reserve(event_type, res, nullptr);
+  std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(), s, rgw::notify::ObjectCreatedPost);
+  op_ret = res->publish_reserve();
   if (op_ret < 0) {
     return;
   }
@@ -4191,7 +4190,7 @@ void RGWPostObj::execute(optional_yield y)
     if (encrypt != nullptr) {
       filter = encrypt.get();
     } else {
-      const auto& compression_type = store->svc()->zone->get_zone_params().get_compression_type(
+      const auto& compression_type = store->get_zone_params().get_compression_type(
           s->dest_placement);
       if (compression_type != "none") {
         plugin = Compressor::create(s->cct, compression_type);
@@ -4294,7 +4293,7 @@ void RGWPostObj::execute(optional_yield y)
   } while (is_next_file_to_upload());
 
   // send request to notification manager
-  const auto ret = rgw::notify::publish_commit(s->object.get(), ofs, ceph::real_clock::now(), etag, event_type, res, this);
+  int ret = res->publish_commit(this, ofs, ceph::real_clock::now(), etag);
   if (ret < 0) {
     ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
     // too late to rollback operation, hence op_ret is not set here
@@ -4346,9 +4345,7 @@ int RGWPutMetadataAccount::init_processing(optional_yield y)
     return op_ret;
   }
 
-  op_ret = store->ctl()->user->get_attrs_by_uid(this, s->user->get_id(), &orig_attrs,
-                                            s->yield,
-                                             &acct_op_tracker);
+  op_ret = s->user->read_attrs(this, y, &orig_attrs, &acct_op_tracker);
   if (op_ret < 0) {
     return op_ret;
   }
@@ -4408,10 +4405,7 @@ int RGWPutMetadataAccount::verify_permission(optional_yield y)
 void RGWPutMetadataAccount::execute(optional_yield y)
 {
   /* Params have been extracted earlier. See init_processing(). */
-  RGWUserInfo new_uinfo;
-  op_ret = store->ctl()->user->get_info_by_uid(this, s->user->get_id(), &new_uinfo, s->yield,
-                                            RGWUserCtl::GetParams()
-                                            .set_objv_tracker(&acct_op_tracker));
+  op_ret = s->user->load_by_id(this, y, RGWUserCtl::GetParams().set_objv_tracker(&acct_op_tracker));
   if (op_ret < 0) {
     return;
   }
@@ -4419,22 +4413,21 @@ void RGWPutMetadataAccount::execute(optional_yield y)
   /* Handle the TempURL-related stuff. */
   if (!temp_url_keys.empty()) {
     for (auto& pair : temp_url_keys) {
-      new_uinfo.temp_url_keys[pair.first] = std::move(pair.second);
+      s->user->get_info().temp_url_keys[pair.first] = std::move(pair.second);
     }
   }
 
   /* Handle the quota extracted at the verify_permission step. */
   if (new_quota_extracted) {
-    new_uinfo.user_quota = std::move(new_quota);
+    s->user->get_info().user_quota = std::move(new_quota);
   }
 
   /* We are passing here the current (old) user info to allow the function
    * optimize-out some operations. */
-  op_ret = store->ctl()->user->store_info(this, new_uinfo, s->yield,
-                                       RGWUserCtl::PutParams()
-                                       .set_old_info(&s->user->get_info())
-                                       .set_objv_tracker(&acct_op_tracker)
-                                       .set_attrs(&attrs));
+  op_ret = s->user->store_info(this, y, RGWUserCtl::PutParams()
+                            .set_old_info(&s->user->get_info())
+                            .set_objv_tracker(&acct_op_tracker)
+                            .set_attrs(&attrs));
 }
 
 int RGWPutMetadataBucket::verify_permission(optional_yield y)
@@ -4760,11 +4753,12 @@ void RGWDeleteObj::execute(optional_yield y)
     }
 
     // make reservation for notification if needed
-    rgw::notify::reservation_t res(store, s, s->object.get());
     const auto versioned_object = s->bucket->versioning_enabled();
     const auto event_type = versioned_object && s->object->get_instance().empty() ? 
         rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete;
-    op_ret = rgw::notify::publish_reserve(event_type, res, nullptr);
+    std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
+                                                                       s, event_type);
+    op_ret = res->publish_reserve();
     if (op_ret < 0) {
       return;
     }
@@ -4789,10 +4783,19 @@ void RGWDeleteObj::execute(optional_yield y)
        return;
       }
 
-      op_ret = s->object->delete_object(this, obj_ctx, s->owner, s->bucket_owner, unmod_since,
-                                       s->system_request, epoch, version_id, s->yield);
+      std::unique_ptr<rgw::sal::RGWObject::DeleteOp> del_op = s->object->get_delete_op(obj_ctx);
+      del_op->params.obj_owner = s->owner;
+      del_op->params.bucket_owner = s->bucket_owner;
+      del_op->params.versioning_status = s->bucket->get_info().versioning_status();
+      del_op->params.unmod_since = unmod_since;
+      del_op->params.high_precision_time = s->system_request;
+      del_op->params.olh_epoch = epoch;
+      del_op->params.marker_version_id = version_id;
+
+      op_ret = del_op->delete_obj(this, y);
       if (op_ret >= 0) {
-       delete_marker = s->object->get_delete_marker();
+       delete_marker = del_op->result.delete_marker;
+       version_id = del_op->result.version_id;
       }
 
       /* Check whether the object has expired. Swift API documentation
@@ -4813,7 +4816,7 @@ void RGWDeleteObj::execute(optional_yield y)
     const auto obj_state = obj_ctx->get_state(s->object->get_obj());
 
     // send request to notification manager
-    const auto ret = rgw::notify::publish_commit(s->object.get(), obj_state->size, obj_state->mtime, attrs[RGW_ATTR_ETAG].to_str(), event_type, res, this);
+    int ret = res->publish_commit(this, obj_state->size, obj_state->mtime, attrs[RGW_ATTR_ETAG].to_str());
     if (ret < 0) {
       ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
       // too late to rollback operation, hence op_ret is not set here
@@ -4879,17 +4882,11 @@ int RGWCopyObj::verify_permission(optional_yield y)
     return op_ret;
   }
 
-  /* This is a bit of a hack; create an empty bucket, then load it below. */
-  op_ret = store->get_bucket(s->user.get(), RGWBucketInfo(), &src_bucket);
-  if (op_ret < 0) {
-    if (op_ret == -ENOENT) {
-      op_ret = -ERR_NO_SUCH_BUCKET;
-    }
-    return op_ret;
-  }
-
-  op_ret = src_bucket->load_by_name(this, src_tenant_name, src_bucket_name, s->bucket_instance_id,
-                                   s->sysobj_ctx, s->yield);
+  op_ret = store->get_bucket(this, s->user.get(),
+                            rgw_bucket(src_tenant_name,
+                                       src_bucket_name,
+                                       s->bucket_instance_id),
+                            &src_bucket, y);
   if (op_ret < 0) {
     if (op_ret == -ENOENT) {
       op_ret = -ERR_NO_SUCH_BUCKET;
@@ -4951,21 +4948,13 @@ int RGWCopyObj::verify_permission(optional_yield y)
                                                            or intra region sync */
     dest_bucket = src_bucket->clone();
   } else {
-    op_ret = store->get_bucket(s->user.get(), RGWBucketInfo(), &dest_bucket);
+    op_ret = store->get_bucket(this, s->user.get(), dest_tenant_name, dest_bucket_name, &dest_bucket, y);
     if (op_ret < 0) {
       if (op_ret == -ENOENT) {
        op_ret = -ERR_NO_SUCH_BUCKET;
       }
       return op_ret;
     }
-    op_ret = dest_bucket->load_by_name(this, dest_tenant_name, dest_bucket_name, std::string(),
-                                     s->sysobj_ctx, s->yield);
-    if (op_ret < 0) {
-      if (op_ret == -ENOENT) {
-        op_ret = -ERR_NO_SUCH_BUCKET;
-      }
-      return op_ret;
-    }
   }
 
   dest_object = store->get_object(rgw_obj_key(dest_obj_name));
@@ -5082,9 +5071,9 @@ void RGWCopyObj::execute(optional_yield y)
   }
 
   // make reservation for notification if needed
-  rgw::notify::reservation_t res(store, s, s->object.get());
-  const auto event_type = rgw::notify::ObjectCreatedCopy; 
-  op_ret = rgw::notify::publish_reserve(event_type, res, nullptr);
+  std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
+                                               s, rgw::notify::ObjectCreatedPost);
+  op_ret = res->publish_reserve();
   if (op_ret < 0) {
     return;
   }
@@ -5103,8 +5092,7 @@ void RGWCopyObj::execute(optional_yield y)
   if (!s->system_request) { // no quota enforcement for system requests
     // get src object size (cached in obj_ctx from verify_permission())
     RGWObjState* astate = nullptr;
-    op_ret = src_object->get_obj_state(this, s->obj_ctx, *src_bucket, &astate,
-                                      s->yield, true);
+    op_ret = src_object->get_obj_state(this, s->obj_ctx, &astate, s->yield, true);
     if (op_ret < 0) {
       return;
     }
@@ -5155,7 +5143,7 @@ void RGWCopyObj::execute(optional_yield y)
           s->yield);
 
   // send request to notification manager
-  const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, mtime, etag, event_type, res, this);
+  int ret = res->publish_commit(this, s->obj_size, mtime, etag);
   if (ret < 0) {
     ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
     // too late to rollback operation, hence op_ret is not set here
@@ -5382,7 +5370,7 @@ void RGWPutACLs::execute(optional_yield y)
     *_dout << dendl;
   }
 
-  op_ret = policy->rebuild(this, store->ctl()->user, &owner, new_policy, s->err.message);
+  op_ret = policy->rebuild(this, store, &owner, new_policy, s->err.message);
   if (op_ret < 0)
     return;
 
@@ -5408,9 +5396,7 @@ void RGWPutACLs::execute(optional_yield y)
   } else {
     map<string,bufferlist> attrs = s->bucket_attrs;
     attrs[RGW_ATTR_ACL] = bl;
-    op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
-                                                         &s->bucket->get_info().objv_tracker,
-                                                         s->yield, this);
+    op_ret = s->bucket->set_instance_attrs(this, attrs, y);
   }
   if (op_ret == -ECANCELED) {
     op_ret = 0; /* lost a race, but it's ok because acls are immutable */
@@ -5502,7 +5488,7 @@ void RGWPutLC::execute(optional_yield y)
     return;
   }
 
-  op_ret = store->get_rgwlc()->set_bucket_config(s->bucket->get_info(), s->bucket_attrs, &new_config);
+  op_ret = store->get_rgwlc()->set_bucket_config(s->bucket.get(), s->bucket_attrs, &new_config);
   if (op_ret < 0) {
     return;
   }
@@ -5518,7 +5504,7 @@ void RGWDeleteLC::execute(optional_yield y)
     return;
   }
 
-  op_ret = store->get_rgwlc()->remove_bucket_config(s->bucket->get_info(), s->bucket_attrs);
+  op_ret = store->get_rgwlc()->remove_bucket_config(s->bucket.get(), s->bucket_attrs);
   if (op_ret < 0) {
     return;
   }
@@ -5774,9 +5760,9 @@ void RGWInitMultipart::execute(optional_yield y)
   }
 
   // make reservation for notification if needed
-  rgw::notify::reservation_t res(store, s, s->object.get());
-  const auto event_type = rgw::notify::ObjectCreatedPost;
-  op_ret = rgw::notify::publish_reserve(event_type, res, nullptr);
+  std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
+                               s, rgw::notify::ObjectCreatedCompleteMultipartUpload);
+  op_ret = res->publish_reserve();
   if (op_ret < 0) {
     return;
   }
@@ -5819,7 +5805,7 @@ void RGWInitMultipart::execute(optional_yield y)
   } while (op_ret == -EEXIST);
   
   // send request to notification manager
-  const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), event_type, res, this);
+  int ret = res->publish_commit(this, s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str());
   if (ret < 0) {
     ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
     // too late to rollback operation, hence op_ret is not set here
@@ -5922,9 +5908,9 @@ void RGWCompleteMultipart::execute(optional_yield y)
   mp.init(s->object->get_name(), upload_id);
 
   // make reservation for notification if needed
-  rgw::notify::reservation_t res(store, s, s->object.get());
-  const auto event_type = rgw::notify::ObjectCreatedCompleteMultipartUpload;
-  op_ret = rgw::notify::publish_reserve(event_type, res, nullptr);
+  std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
+                               s, rgw::notify::ObjectCreatedCompleteMultipartUpload);
+  op_ret = res->publish_reserve();
   if (op_ret < 0) {
     return;
   }
@@ -5976,7 +5962,7 @@ void RGWCompleteMultipart::execute(optional_yield y)
   attrs = meta_obj->get_attrs();
 
   do {
-    op_ret = list_multipart_parts(store, s, upload_id, meta_oid, max_parts,
+    op_ret = list_multipart_parts(s, upload_id, meta_oid, max_parts,
                                  marker, obj_parts, &marker, &truncated);
     if (op_ret == -ENOENT) {
       op_ret = -ERR_NO_SUCH_UPLOAD;
@@ -6033,7 +6019,7 @@ void RGWCompleteMultipart::execute(optional_yield y)
         op_ret = -ERR_INVALID_PART;
         return;
       } else {
-        manifest.append(obj_part.manifest, store->svc()->zone);
+        manifest.append(obj_part.manifest, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone);
       }
 
       bool part_compressed = (obj_part.cs_info.compression_type != "none");
@@ -6129,8 +6115,7 @@ void RGWCompleteMultipart::execute(optional_yield y)
     return;
 
   // remove the upload obj
-  string version_id;
-  int r = meta_obj->delete_object(this, s->obj_ctx, ACLOwner(), ACLOwner(), ceph::real_time(), false, 0, version_id, null_yield);
+  int r = meta_obj->delete_object(this, s->obj_ctx, y);
   if (r >= 0)  {
     /* serializer's exclusive lock is released */
     serializer->clear_locked();
@@ -6139,7 +6124,7 @@ void RGWCompleteMultipart::execute(optional_yield y)
   }
 
   // send request to notification manager
-  const auto ret = rgw::notify::publish_commit(s->object.get(), ofs, ceph::real_clock::now(), final_etag_str, event_type, res, this);
+  int ret = res->publish_commit(this, ofs, ceph::real_clock::now(), final_etag_str);
   if (ret < 0) {
     ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
     // too late to rollback operation, hence op_ret is not set here
@@ -6215,7 +6200,7 @@ void RGWAbortMultipart::execute(optional_yield y)
     return;
 
   RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(s->obj_ctx);
-  op_ret = abort_multipart_upload(this, store, s->cct, obj_ctx, s->bucket->get_info(), mp);
+  op_ret = abort_multipart_upload(this, store, s->cct, obj_ctx, s->bucket.get(), mp);
 }
 
 int RGWListMultipart::verify_permission(optional_yield y)
@@ -6247,7 +6232,7 @@ void RGWListMultipart::execute(optional_yield y)
   if (op_ret < 0)
     return;
 
-  op_ret = list_multipart_parts(store, s, upload_id, meta_oid, max_parts,
+  op_ret = list_multipart_parts(s, upload_id, meta_oid, max_parts,
                                marker, parts, NULL, &truncated);
 }
 
@@ -6289,7 +6274,7 @@ void RGWListBucketMultiparts::execute(optional_yield y)
   }
   marker_meta = marker.get_meta();
 
-  op_ret = list_bucket_multiparts(this, store, s->bucket->get_info(), prefix, marker_meta, delimiter,
+  op_ret = list_bucket_multiparts(this, s->bucket.get(), prefix, marker_meta, delimiter,
                                   max_uploads, &objs, &common_prefixes, &is_truncated);
   if (op_ret < 0) {
     return;
@@ -6504,10 +6489,11 @@ void RGWDeleteMultiObj::execute(optional_yield y)
     }
     // make reservation for notification if needed
     const auto versioned_object = s->bucket->versioning_enabled();
-    rgw::notify::reservation_t res(store, s, obj.get());
     const auto event_type = versioned_object && obj->get_instance().empty() ? 
         rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete;
-    op_ret = rgw::notify::publish_reserve(event_type, res, nullptr);
+    std::unique_ptr<rgw::sal::Notification> res = store->get_notification(obj.get(),
+                                                                       s, event_type);
+    op_ret = res->publish_reserve();
     if (op_ret < 0) {
       send_partial_response(*iter, false, "", op_ret);
       continue;
@@ -6515,20 +6501,25 @@ void RGWDeleteMultiObj::execute(optional_yield y)
 
     obj->set_atomic(obj_ctx);
 
-    op_ret = obj->delete_object(this, obj_ctx, s->owner, s->bucket_owner, ceph::real_time(),
-                               false, 0, version_id, s->yield);
+    std::unique_ptr<rgw::sal::RGWObject::DeleteOp> del_op = obj->get_delete_op(obj_ctx);
+    del_op->params.versioning_status = obj->get_bucket()->get_info().versioning_status();
+    del_op->params.obj_owner = s->owner;
+    del_op->params.bucket_owner = s->bucket_owner;
+    del_op->params.marker_version_id = version_id;
+
+    op_ret = del_op->delete_obj(this, y);
     if (op_ret == -ENOENT) {
       op_ret = 0;
     }
 
-    send_partial_response(*iter, obj->get_delete_marker(), version_id, op_ret);
+    send_partial_response(*iter, obj->get_delete_marker(), del_op->result.version_id, op_ret);
 
     const auto obj_state = obj_ctx->get_state(obj->get_obj());
     bufferlist etag_bl;
     const auto etag = obj_state->get_attr(RGW_ATTR_ETAG, etag_bl) ? etag_bl.to_str() : "";
 
     // send request to notification manager
-    const auto ret = rgw::notify::publish_commit(obj.get(), obj_state->size, obj_state->mtime, etag, event_type, res, this);
+    int ret = res->publish_commit(this, obj_state->size, obj_state->mtime, etag);
     if (ret < 0) {
       ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
       // too late to rollback operation, hence op_ret is not set here
@@ -6594,13 +6585,17 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path, optional_yie
 
   if (!path.obj_key.empty()) {
     ACLOwner bucket_owner;
-    std::string version_id;
 
     bucket_owner.set_id(bucket->get_info().owner);
     std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(path.obj_key);
     obj->set_atomic(s->obj_ctx);
 
-    ret = obj->delete_object(dpp, s->obj_ctx, bowner, bucket_owner, ceph::real_time(), false, 0, version_id, s->yield);
+    std::unique_ptr<rgw::sal::RGWObject::DeleteOp> del_op = obj->get_delete_op(s->obj_ctx);
+    del_op->params.versioning_status = obj->get_bucket()->get_info().versioning_status();
+    del_op->params.obj_owner = bowner;
+    del_op->params.bucket_owner = bucket_owner;
+
+    ret = del_op->delete_obj(dpp, y);
     if (ret < 0) {
       goto delop_fail;
     }
@@ -6781,9 +6776,8 @@ int RGWBulkUploadOp::handle_dir_verify_permission(optional_yield y)
   if (s->user->get_max_buckets() > 0) {
     rgw::sal::RGWBucketList buckets;
     std::string marker;
-    op_ret = rgw_read_user_buckets(this, store, s->user->get_user(), buckets,
-                                   marker, std::string(), s->user->get_max_buckets(),
-                                   false, y);
+    op_ret = s->user->list_buckets(this, marker, std::string(), s->user->get_max_buckets(),
+                                   false, buckets, y);
     if (op_ret < 0) {
       return op_ret;
     }
@@ -6810,12 +6804,11 @@ static void forward_req_info(CephContext *cct, req_info& info, const std::string
   info.effective_uri = "/" + bucket_name;
 }
 
-void RGWBulkUploadOp::init(rgw::sal::RGWRadosStore* const store,
+void RGWBulkUploadOp::init(rgw::sal::RGWStore* const store,
                            struct req_state* const s,
                            RGWHandler* const h)
 {
   RGWOp::init(store, s, h);
-  dir_ctx.emplace(store->svc()->sysobj->init_obj_ctx());
 }
 
 int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y)
@@ -6831,7 +6824,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y)
   rgw_obj_key object_junk;
   std::tie(bucket_name, object_junk) =  *parse_path(path);
 
-  rgw_raw_obj obj(store->svc()->zone->get_zone_params().domain_root,
+  rgw_raw_obj obj(store->get_zone_params().domain_root,
                   rgw_make_bucket_entry_name(s->bucket_tenant, bucket_name));
 
   /* we need to make sure we read bucket info, it's not read before for this
@@ -6889,15 +6882,12 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y)
       ldpp_dout(this, 20) << "conflicting bucket name" << dendl;
       return op_ret;
     }
-    new_bucket = out_info.bucket;
   }
 
-  op_ret = store->ctl()->bucket->link_bucket(s->user->get_id(), new_bucket,
-                                          out_info.creation_time,
-                                         s->yield, s, false);
+  op_ret = bucket->link(this, s->user.get(), y, false);
   if (op_ret && !existed && op_ret != -EEXIST) {
     /* if it exists (or previously existed), don't remove it! */
-    op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), new_bucket, s->yield, this);
+    op_ret = bucket->unlink(this, s->user.get(), y);
     if (op_ret < 0) {
       ldpp_dout(this, 0) << "WARNING: failed to unlink bucket: ret=" << op_ret << dendl;
     }
@@ -7013,7 +7003,7 @@ int RGWBulkUploadOp::handle_file(const std::string_view path,
   /* No filters by default. */
   DataProcessor *filter = &processor;
 
-  const auto& compression_type = store->svc()->zone->get_zone_params().get_compression_type(
+  const auto& compression_type = store->get_zone_params().get_compression_type(
       dest_placement);
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
@@ -7364,9 +7354,7 @@ void RGWSetAttrs::execute(optional_yield y)
     for (auto& iter : attrs) {
       s->bucket_attrs[iter.first] = std::move(iter.second);
     }
-    op_ret = store->ctl()->bucket->set_bucket_instance_attrs(
-      s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker,
-      s->yield, this);
+    op_ret = s->bucket->set_instance_attrs(this, attrs, y);
   }
 
 } /* RGWSetAttrs::execute() */
@@ -7474,7 +7462,7 @@ RGWHandler::~RGWHandler()
 {
 }
 
-int RGWHandler::init(rgw::sal::RGWRadosStore *_store,
+int RGWHandler::init(rgw::sal::RGWStore *_store,
                      struct req_state *_s,
                      rgw::io::BasicClient *cio)
 {
index 252aa3dc0fe9ba3c47807004dd097ab1302ee4d2..8df15c42e4183d672d286f0cbdb86ac4c6114826 100644 (file)
@@ -84,7 +84,7 @@ int rgw_op_get_bucket_policy_from_attr(const DoutPrefixProvider *dpp,
 
 class RGWHandler {
 protected:
-  rgw::sal::RGWRadosStore* store{nullptr};
+  rgw::sal::RGWStore* store{nullptr};
   struct req_state *s{nullptr};
 
   int do_init_permissions(const DoutPrefixProvider *dpp, optional_yield y);
@@ -94,7 +94,7 @@ public:
   RGWHandler() {}
   virtual ~RGWHandler();
 
-  virtual int init(rgw::sal::RGWRadosStore* store,
+  virtual int init(rgw::sal::RGWStore* store,
                    struct req_state* _s,
                    rgw::io::BasicClient* cio);
 
@@ -131,7 +131,7 @@ class RGWOp : public DoutPrefixProvider {
 protected:
   struct req_state *s;
   RGWHandler *dialect_handler;
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   RGWCORSConfiguration bucket_cors;
   bool cors_exist;
   RGWQuotaInfo bucket_quota;
@@ -164,7 +164,7 @@ public:
     return 0;
   }
 
-  virtual void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *dialect_handler) {
+  virtual void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *dialect_handler) {
     this->store = store;
     this->s = s;
     this->dialect_handler = dialect_handler;
@@ -529,11 +529,11 @@ public:
     unsigned int num_unfound;
     std::list<fail_desc_t> failures;
 
-    rgw::sal::RGWRadosStore * const store;
+    rgw::sal::RGWStore * const store;
     req_state * const s;
 
   public:
-    Deleter(const DoutPrefixProvider* dpp, rgw::sal::RGWRadosStore * const str, req_state * const s)
+    Deleter(const DoutPrefixProvider* dpp, rgw::sal::RGWStore * const str, req_state * const s)
       : dpp(dpp),
         num_deleted(0),
         num_unfound(0),
@@ -592,8 +592,6 @@ inline ostream& operator<<(ostream& out, const RGWBulkDelete::acct_path_t &o) {
 
 
 class RGWBulkUploadOp : public RGWOp {
-  boost::optional<RGWSysObjectCtx> dir_ctx;
-
 protected:
   class fail_desc_t {
   public:
@@ -645,7 +643,7 @@ public:
     : num_created(0) {
   }
 
-  void init(rgw::sal::RGWRadosStore* const store,
+  void init(rgw::sal::RGWStore* const store,
             struct req_state* const s,
             RGWHandler* const h) override;
 
@@ -739,7 +737,7 @@ protected:
   std::string end_marker;
   int64_t limit;
   uint64_t limit_max;
-  std::map<std::string, ceph::bufferlist> attrs;
+  rgw::sal::RGWAttrs attrs;
   bool is_truncated;
 
   RGWUsageStats global_stats;
@@ -857,7 +855,7 @@ public:
   void pre_exec() override;
   void execute(optional_yield y) override;
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
   }
   virtual int get_params(optional_yield y) = 0;
@@ -1030,7 +1028,7 @@ public:
   int verify_permission(optional_yield y) override;
   void pre_exec() override;
   void execute(optional_yield y) override;
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
     relaxed_region_enforcement =
@@ -1183,7 +1181,7 @@ public:
     delete obj_legal_hold;
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
   }
@@ -1255,7 +1253,7 @@ public:
     attrs.emplace(std::move(key), std::move(bl)); /* key and bl are r-value refs */
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
   }
@@ -1296,7 +1294,7 @@ public:
       has_policy(false) {
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
   }
@@ -1335,7 +1333,7 @@ public:
     attrs.emplace(std::move(key), std::move(bl)); /* key and bl are r-value refs */
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
   }
@@ -1362,7 +1360,7 @@ public:
     : dlo_manifest(NULL)
   {}
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
   }
@@ -1483,7 +1481,7 @@ public:
     attrs.emplace(std::move(key), std::move(bl));
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     dest_policy.set_ctx(s->cct);
   }
@@ -1536,7 +1534,7 @@ public:
   void pre_exec() override;
   void execute(optional_yield y) override;
 
-  virtual int get_policy_from_state(rgw::sal::RGWRadosStore *store, struct req_state *s, stringstream& ss) { return 0; }
+  virtual int get_policy_from_state(rgw::sal::RGWStore *store, struct req_state *s, stringstream& ss) { return 0; }
   virtual int get_params(optional_yield y) = 0;
   void send_response() override = 0;
   const char* name() const override { return "put_acls"; }
@@ -1573,7 +1571,7 @@ public:
   }
   ~RGWPutLC() override {}
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *dialect_handler) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *dialect_handler) override {
 #define COOKIE_LEN 16
     char buf[COOKIE_LEN + 1];
 
@@ -1721,7 +1719,7 @@ protected:
 public:
   RGWInitMultipart() {}
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
   }
@@ -1791,7 +1789,7 @@ public:
     truncated = false;
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy = RGWAccessControlPolicy(s->cct);
   }
@@ -1838,7 +1836,7 @@ public:
     default_max = 0;
   }
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     max_uploads = default_max;
   }
@@ -1947,13 +1945,13 @@ public:
   uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
 };
 
-extern int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y);
-extern int rgw_build_object_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, struct req_state *s,
-                                    bool prefetch_data, optional_yield y);
-extern void rgw_build_iam_environment(rgw::sal::RGWRadosStore* store,
-                                                                         struct req_state* s);
+extern int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                                    struct req_state* s, optional_yield y);
+extern int rgw_build_object_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store,
+                                    struct req_state *s, bool prefetch_data, optional_yield y);
+extern void rgw_build_iam_environment(rgw::sal::RGWStore* store,
+                                     struct req_state* s);
 extern vector<rgw::IAM::Policy> get_iam_user_policy_from_attr(CephContext* cct,
-                        rgw::sal::RGWRadosStore* store,
                         map<string, bufferlist>& attrs,
                         const string& tenant);
 
@@ -2420,7 +2418,7 @@ protected:
 public:
   RGWGetClusterStat() {}
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
   }
   int verify_permission(optional_yield) override {return 0;}
index 5dbca116c74505edd6afc19519c7a4bda89c50e7..1e2b2bd896e302e00d5917c312de5a8ff9a7e5fe 100644 (file)
@@ -148,8 +148,8 @@ int RGWOrphanStore::list_jobs(map <string,RGWOrphanSearchState>& job_list)
 
 int RGWOrphanStore::init()
 {
-  const rgw_pool& log_pool = store->svc()->zone->get_zone_params().log_pool;
-  int r = rgw_init_ioctx(store->getRados()->get_rados_handle(), log_pool, ioctx);
+  const rgw_pool& log_pool = store->get_zone_params().log_pool;
+  int r = rgw_init_ioctx(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_rados_handle(), log_pool, ioctx);
   if (r < 0) {
     cerr << "ERROR: failed to open log pool (" << log_pool << " ret=" << r << std::endl;
     return r;
@@ -295,7 +295,7 @@ int RGWOrphanSearch::build_all_oids_index()
 {
   librados::IoCtx ioctx;
 
-  int ret = rgw_init_ioctx(store->getRados()->get_rados_handle(), search_info.pool, ioctx);
+  int ret = rgw_init_ioctx(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_rados_handle(), search_info.pool, ioctx);
   if (ret < 0) {
     lderr(store->ctx()) << __func__ << ": rgw_init_ioctx() returned ret=" << ret << dendl;
     return ret;
@@ -374,7 +374,7 @@ int RGWOrphanSearch::build_buckets_instance_index()
   void *handle;
   int max = 1000;
   string section = "bucket.instance";
-  int ret = store->ctl()->meta.mgr->list_keys_init(section, &handle);
+  int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init(section, &handle);
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: can't get key: " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -391,7 +391,7 @@ int RGWOrphanSearch::build_buckets_instance_index()
 
   do {
     list<string> keys;
-    ret = store->ctl()->meta.mgr->list_keys_next(handle, max, keys, &truncated);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, max, keys, &truncated);
     if (ret < 0) {
       lderr(store->ctx()) << "ERROR: lists_keys_next(): " << cpp_strerror(-ret) << dendl;
       return ret;
@@ -421,17 +421,17 @@ int RGWOrphanSearch::build_buckets_instance_index()
     lderr(store->ctx()) << __func__ << ": ERROR: log_oids() returned ret=" << ret << dendl;
     return ret;
   }
-  store->ctl()->meta.mgr->list_keys_complete(handle);
+  static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
 
   return 0;
 }
 
-int RGWOrphanSearch::handle_stat_result(map<int, list<string> >& oids, RGWRados::Object::Stat::Result& result)
+int RGWOrphanSearch::handle_stat_result(map<int, list<string> >& oids, rgw::sal::RGWObject::StatOp::Result& result)
 {
   set<string> obj_oids;
-  rgw_bucket& bucket = result.obj.bucket;
+  rgw::sal::RGWBucket* bucket = result.obj->get_bucket();
   if (!result.manifest) { /* a very very old object, or part of a multipart upload during upload */
-    const string loc = bucket.bucket_id + "_" + result.obj.get_oid();
+    const string loc = bucket->get_bucket_id() + "_" + result.obj->get_oid();
     obj_oids.insert(obj_fingerprint(loc));
 
     /*
@@ -466,18 +466,18 @@ int RGWOrphanSearch::handle_stat_result(map<int, list<string> >& oids, RGWRados:
   return 0;
 }
 
-int RGWOrphanSearch::pop_and_handle_stat_op(map<int, list<string> >& oids, std::deque<RGWRados::Object::Stat>& ops)
+int RGWOrphanSearch::pop_and_handle_stat_op(map<int, list<string> >& oids, std::deque<std::unique_ptr<rgw::sal::RGWObject::StatOp>>& ops)
 {
-  RGWRados::Object::Stat& front_op = ops.front();
+  rgw::sal::RGWObject::StatOp* front_op = ops.front().get();
 
-  int ret = front_op.wait();
+  int ret = front_op->wait();
   if (ret < 0) {
     if (ret != -ENOENT) {
       lderr(store->ctx()) << "ERROR: stat_async() returned error: " << cpp_strerror(-ret) << dendl;
     }
     goto done;
   }
-  ret = handle_stat_result(oids, front_op.result);
+  ret = handle_stat_result(oids, front_op->result);
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: handle_stat_response() returned error: " << cpp_strerror(-ret) << dendl;
   }
@@ -489,8 +489,6 @@ done:
 int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const string& bucket_instance_id, map<int, list<string> >& oids)
 {
   RGWObjectCtx obj_ctx(store);
-  auto sysobj_ctx = store->svc()->sysobj->init_obj_ctx();
-
   rgw_bucket orphan_bucket;
   int shard_id;
   int ret = rgw_bucket_parse_bucket_key(store->ctx(), bucket_instance_id,
@@ -501,9 +499,8 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
     return ret;
   }
 
-  RGWBucketInfo cur_bucket_info;
-  ret = store->getRados()->get_bucket_info(store->svc(), orphan_bucket.tenant,
-                              orphan_bucket.name, cur_bucket_info, nullptr, null_yield, dpp);
+  std::unique_ptr<rgw::sal::RGWBucket> cur_bucket;
+  ret = store->get_bucket(dpp, nullptr, orphan_bucket, &cur_bucket, null_yield);
   if (ret < 0) {
     if (ret == -ENOENT) {
       /* probably raced with bucket removal */
@@ -513,22 +510,24 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
     return ret;
   }
 
-  if (cur_bucket_info.bucket.bucket_id != orphan_bucket.bucket_id) {
+  if (cur_bucket->get_bucket_id() != orphan_bucket.bucket_id) {
     ldpp_dout(dpp, 0) << __func__ << ": Skipping stale bucket instance: "
                            << orphan_bucket.name << ": "
                            << orphan_bucket.bucket_id << dendl;
     return 0;
   }
 
-  if (cur_bucket_info.reshard_status == cls_rgw_reshard_status::IN_PROGRESS) {
+  if (cur_bucket->get_info().reshard_status == cls_rgw_reshard_status::IN_PROGRESS) {
     ldpp_dout(dpp, 0) << __func__ << ": reshard in progress. Skipping "
                            << orphan_bucket.name << ": "
                            << orphan_bucket.bucket_id << dendl;
     return 0;
   }
 
-  RGWBucketInfo bucket_info;
-  ret = store->getRados()->get_bucket_instance_info(sysobj_ctx, bucket_instance_id, bucket_info, nullptr, nullptr, null_yield, dpp);
+  rgw_bucket b;
+  rgw_bucket_parse_bucket_key(store->ctx(), bucket_instance_id, &b, nullptr);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  ret = store->get_bucket(dpp, nullptr, b, &bucket, null_yield);
   if (ret < 0) {
     if (ret == -ENOENT) {
       /* probably raced with bucket removal */
@@ -539,29 +538,25 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
   }
 
   ldpp_dout(dpp, 10) << "building linked oids for bucket instance: " << bucket_instance_id << dendl;
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
   string marker;
-  list_op.params.marker = rgw_obj_key(marker);
-  list_op.params.list_versions = true;
-  list_op.params.enforce_ns = false;
-
-  bool truncated;
+  params.marker = rgw_obj_key(marker);
+  params.list_versions = true;
+  params.enforce_ns = false;
 
-  deque<RGWRados::Object::Stat> stat_ops;
+  std::deque<std::unique_ptr<rgw::sal::RGWObject>> objs;
+  std::deque<std::unique_ptr<rgw::sal::RGWObject::StatOp>> stat_ops;
 
   do {
-    vector<rgw_bucket_dir_entry> result;
-
-    ret = list_op.list_objects(dpp, max_list_bucket_entries,
-                               &result, nullptr, &truncated, null_yield);
+    ret = bucket->list(dpp, params, max_list_bucket_entries, results, null_yield);
     if (ret < 0) {
       cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
       return ret;
     }
 
-    for (vector<rgw_bucket_dir_entry>::iterator iter = result.begin(); iter != result.end(); ++iter) {
+    for (vector<rgw_bucket_dir_entry>::iterator iter = results.objs.begin(); iter != results.objs.end(); ++iter) {
       rgw_bucket_dir_entry& entry = *iter;
       if (entry.key.instance.empty()) {
         ldpp_dout(dpp, 20) << "obj entry: " << entry.key.name << dendl;
@@ -578,15 +573,15 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
         continue;
       }
 
-      rgw_obj obj(bucket_info.bucket, entry.key);
+      std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(entry.key);
+      std::unique_ptr<rgw::sal::RGWObject::StatOp> stat_op = obj->get_stat_op(&obj_ctx);
+      rgw::sal::RGWObject::StatOp* op = stat_op.get();
 
-      RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj);
+      objs.push_back(std::move(obj));
+      stat_ops.push_back(std::move(stat_op));
 
-      stat_ops.push_back(RGWRados::Object::Stat(&op_target));
-      RGWRados::Object::Stat& op = stat_ops.back();
 
-
-      ret = op.stat_async();
+      ret = op->stat_async();
       if (ret < 0) {
         lderr(store->ctx()) << "ERROR: stat_async() returned error: " << cpp_strerror(-ret) << dendl;
         return ret;
@@ -608,7 +603,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
         oids.clear();
       }
     }
-  } while (truncated);
+  } while (results.is_truncated);
 
   while (!stat_ops.empty()) {
     ret = pop_and_handle_stat_op(oids, stat_ops);
@@ -739,7 +734,7 @@ int RGWOrphanSearch::compare_oid_indexes()
 
   librados::IoCtx data_ioctx;
 
-  int ret = rgw_init_ioctx(store->getRados()->get_rados_handle(), search_info.pool, data_ioctx);
+  int ret = rgw_init_ioctx(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_rados_handle(), search_info.pool, data_ioctx);
   if (ret < 0) {
     lderr(store->ctx()) << __func__ << ": rgw_init_ioctx() returned ret=" << ret << dendl;
     return ret;
@@ -924,23 +919,23 @@ int RGWOrphanSearch::finish()
 }
 
 
-int RGWRadosList::handle_stat_result(RGWRados::Object::Stat::Result& result,
+int RGWRadosList::handle_stat_result(rgw::sal::RGWObject::StatOp::Result& result,
                                     std::string& bucket_name,
                                     rgw_obj_key& obj_key,
                                      std::set<string>& obj_oids)
 {
   obj_oids.clear();
 
-  rgw_bucket& bucket = result.obj.bucket;
+  rgw::sal::RGWBucket* bucket = result.obj->get_bucket();
 
   ldout(store->ctx(), 20) << "RGWRadosList::" << __func__ <<
     " bucket=" << bucket <<
-    ", has_manifest=" << result.manifest.has_value() <<
+    ", has_manifest=" << !!result.manifest <<
     dendl;
 
   // iterator to store result of dlo/slo attribute find
-  decltype(result.attrs)::iterator attr_it = result.attrs.end();
-  const std::string oid = bucket.marker + "_" + result.obj.get_oid();
+  auto attr_it = result.obj->get_attrs().end();
+  const std::string oid = bucket->get_marker() + "_" + result.obj->get_oid();
   ldout(store->ctx(), 20) << "radoslist processing object=\"" <<
       oid << "\"" << dendl;
   if (visited_oids.find(oid) != visited_oids.end()) {
@@ -951,8 +946,8 @@ int RGWRadosList::handle_stat_result(RGWRados::Object::Stat::Result& result,
     return 0;
   }
 
-  bucket_name = bucket.name;
-  obj_key = result.obj.key;
+  bucket_name = bucket->get_name();
+  obj_key = result.obj->get_key();
 
   if (!result.manifest) {
     /* a very very old object, or part of a multipart upload during upload */
@@ -963,8 +958,8 @@ int RGWRadosList::handle_stat_result(RGWRados::Object::Stat::Result& result,
      * object; we'll process them in
      * RGWRadosList::do_incomplete_multipart
      */
-  } else if ((attr_it = result.attrs.find(RGW_ATTR_USER_MANIFEST)) !=
-            result.attrs.end()) {
+  } else if ((attr_it = result.obj->get_attrs().find(RGW_ATTR_USER_MANIFEST)) !=
+            result.obj->get_attrs().end()) {
     // *** handle DLO object ***
 
     obj_oids.insert(oid);
@@ -987,8 +982,8 @@ int RGWRadosList::handle_stat_result(RGWRados::Object::Stat::Result& result,
     ldout(store->ctx(), 25) << "radoslist DLO oid=\"" << oid <<
       "\" added bucket=\"" << bucket_name << "\" prefix=\"" <<
       prefix << "\" to process list" << dendl;
-  } else if ((attr_it = result.attrs.find(RGW_ATTR_SLO_MANIFEST)) !=
-            result.attrs.end()) {
+  } else if ((attr_it = result.obj->get_attrs().find(RGW_ATTR_SLO_MANIFEST)) !=
+            result.obj->get_attrs().end()) {
     // *** handle SLO object ***
 
     obj_oids.insert(oid);
@@ -1052,14 +1047,14 @@ int RGWRadosList::handle_stat_result(RGWRados::Object::Stat::Result& result,
 
 int RGWRadosList::pop_and_handle_stat_op(
   RGWObjectCtx& obj_ctx,
-  std::deque<RGWRados::Object::Stat>& ops)
+  std::deque<std::unique_ptr<rgw::sal::RGWObject::StatOp>>& ops)
 {
   std::string bucket_name;
   rgw_obj_key obj_key;
   std::set<std::string> obj_oids;
-  RGWRados::Object::Stat& front_op = ops.front();
+  std::unique_ptr<rgw::sal::RGWObject::StatOp> front_op = std::move(ops.front());
 
-  int ret = front_op.wait();
+  int ret = front_op->wait();
   if (ret < 0) {
     if (ret != -ENOENT) {
       lderr(store->ctx()) << "ERROR: stat_async() returned error: " <<
@@ -1068,7 +1063,7 @@ int RGWRadosList::pop_and_handle_stat_op(
     goto done;
   }
 
-  ret = handle_stat_result(front_op.result, bucket_name, obj_key, obj_oids);
+  ret = handle_stat_result(front_op->result, bucket_name, obj_key, obj_oids);
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: handle_stat_result() returned error: " <<
       cpp_strerror(-ret) << dendl;
@@ -1090,7 +1085,7 @@ done:
 
   // invalidate object context for this object to avoid memory leak
   // (see pr https://github.com/ceph/ceph/pull/30174)
-  obj_ctx.invalidate(front_op.result.obj);
+  obj_ctx.invalidate(front_op->result.obj->get_obj());
 
   ops.pop_front();
   return ret;
@@ -1167,15 +1162,10 @@ int RGWRadosList::process_bucket(
     ", prefix=" << prefix <<
     ", entries_filter.size=" << entries_filter.size() << dendl;
 
-  RGWBucketInfo bucket_info;
-  RGWSysObjectCtx sys_obj_ctx = store->svc()->sysobj->init_obj_ctx();
-  int ret = store->getRados()->get_bucket_instance_info(sys_obj_ctx,
-                                                       bucket_instance_id,
-                                                       bucket_info,
-                                                       nullptr,
-                                                       nullptr,
-                                                       null_yield,
-                                                        dpp);
+  rgw_bucket b;
+  rgw_bucket_parse_bucket_key(store->ctx(), bucket_instance_id, &b, nullptr);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  int ret = store->get_bucket(dpp, nullptr, b, &bucket, null_yield);
   if (ret < 0) {
     if (ret == -ENOENT) {
       // probably raced with bucket removal
@@ -1187,29 +1177,25 @@ int RGWRadosList::process_bucket(
     return ret;
   }
 
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
   std::string marker;
-  list_op.params.marker = rgw_obj_key(marker);
-  list_op.params.list_versions = true;
-  list_op.params.enforce_ns = false;
-  list_op.params.allow_unordered = false;
-  list_op.params.prefix = prefix;
-
-  bool truncated;
-
-  std::deque<RGWRados::Object::Stat> stat_ops;
+  params.marker = rgw_obj_key(marker);
+  params.list_versions = true;
+  params.enforce_ns = false;
+  params.allow_unordered = false;
+  params.prefix = prefix;
+
+  std::deque<std::unique_ptr<rgw::sal::RGWObject>> objs;
+  std::deque<std::unique_ptr<rgw::sal::RGWObject::StatOp>> stat_ops;
   std::string prev_versioned_key_name = "";
 
   RGWObjectCtx obj_ctx(store);
 
   do {
-    std::vector<rgw_bucket_dir_entry> result;
-
     constexpr int64_t LIST_OBJS_MAX_ENTRIES = 100;
-    ret = list_op.list_objects(dpp, LIST_OBJS_MAX_ENTRIES, &result,
-                              NULL, &truncated, null_yield);
+    ret = bucket->list(dpp, params, LIST_OBJS_MAX_ENTRIES, results, null_yield);
     if (ret == -ENOENT) {
       // race with bucket delete?
       ret = 0;
@@ -1220,8 +1206,8 @@ int RGWRadosList::process_bucket(
       return ret;
     }
 
-    for (std::vector<rgw_bucket_dir_entry>::iterator iter = result.begin();
-        iter != result.end();
+    for (std::vector<rgw_bucket_dir_entry>::iterator iter = results.objs.begin();
+        iter != results.objs.end();
         ++iter) {
       rgw_bucket_dir_entry& entry = *iter;
 
@@ -1247,15 +1233,14 @@ int RGWRadosList::process_bucket(
        [&](const rgw_obj_key& key) -> int {
          int ret;
 
-         rgw_obj obj(bucket_info.bucket, key);
+         std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(key);
+         std::unique_ptr<rgw::sal::RGWObject::StatOp> stat_op = obj->get_stat_op(&obj_ctx);
+         rgw::sal::RGWObject::StatOp* op = stat_op.get();
 
-         RGWRados::Object op_target(store->getRados(), bucket_info,
-                                    obj_ctx, obj);
+         objs.push_back(std::move(obj));
+         stat_ops.push_back(std::move(stat_op));
 
-         stat_ops.push_back(RGWRados::Object::Stat(&op_target));
-         RGWRados::Object::Stat& op = stat_ops.back();
-
-         ret = op.stat_async();
+         ret = op->stat_async();
          if (ret < 0) {
            lderr(store->ctx()) << "ERROR: stat_async() returned error: " <<
              cpp_strerror(-ret) << dendl;
@@ -1302,7 +1287,7 @@ int RGWRadosList::process_bucket(
        return ret;
       }
     } // for iter loop
-  } while (truncated);
+  } while (results.is_truncated);
 
   while (!stat_ops.empty()) {
     ret = pop_and_handle_stat_op(obj_ctx, stat_ops);
@@ -1323,7 +1308,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp)
   int ret;
   void* handle = nullptr;
 
-  ret = store->ctl()->meta.mgr->list_keys_init("bucket", &handle);
+  ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init("bucket", &handle);
   if (ret < 0) {
     lderr(store->ctx()) << "RGWRadosList::" << __func__ <<
       " ERROR: list_keys_init returned " <<
@@ -1336,7 +1321,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp)
 
   do {
     std::list<std::string> buckets;
-    ret = store->ctl()->meta.mgr->list_keys_next(handle, max_keys,
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, max_keys,
                                                 buckets, &truncated);
 
     for (std::string& bucket_id : buckets) {
@@ -1355,9 +1340,8 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp)
 
 int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bucket_name)
 {
-  RGWSysObjectCtx sys_obj_ctx = store->svc()->sysobj->init_obj_ctx();
   RGWObjectCtx obj_ctx(store);
-  RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
   int ret;
 
   add_bucket_entire(start_bucket_name);
@@ -1370,14 +1354,8 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bu
     std::swap(process, front->second);
     bucket_process_map.erase(front);
 
-    RGWBucketInfo bucket_info;
-    ret = store->getRados()->get_bucket_info(store->svc(),
-                                            tenant_name,
-                                            bucket_name,
-                                            bucket_info,
-                                            nullptr,
-                                            null_yield,
-                                             dpp);
+    std::unique_ptr<rgw::sal::RGWBucket> bucket;
+    ret = store->get_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, null_yield);
     if (ret == -ENOENT) {
       std::cerr << "WARNING: bucket " << bucket_name <<
        " does not exist; could it have been deleted very recently?" <<
@@ -1389,7 +1367,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bu
       return ret;
     }
 
-    const std::string bucket_id = bucket_info.bucket.get_key();
+    const std::string bucket_id = bucket->get_key().get_key();
 
     static const std::set<rgw_obj_key> empty_filter;
     static const std::string empty_prefix;
@@ -1441,13 +1419,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bu
   // now handle incomplete multipart uploads by going back to the
   // initial bucket
 
-  ret = store->getRados()->get_bucket_info(store->svc(),
-                                          tenant_name,
-                                          start_bucket_name,
-                                          bucket_info,
-                                          nullptr,
-                                          null_yield,
-                                           dpp);
+  ret = store->get_bucket(dpp, nullptr, tenant_name, start_bucket_name, &bucket, null_yield);
   if (ret == -ENOENT) {
     // bucket deletion race?
     return 0;
@@ -1457,7 +1429,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bu
     return ret;
   }
 
-  ret = do_incomplete_multipart(dpp, store, bucket_info);
+  ret = do_incomplete_multipart(dpp, bucket.get());
   if (ret < 0) {
     lderr(store->ctx()) << "RGWRadosList::" << __func__ <<
       ": ERROR: do_incomplete_multipart returned ret=" << ret << dendl;
@@ -1470,10 +1442,8 @@ done:
 } // RGWRadosList::run(string)
 
 
-int RGWRadosList::do_incomplete_multipart(
-  const DoutPrefixProvider *dpp,
-  rgw::sal::RGWRadosStore* store,
-  RGWBucketInfo& bucket_info)
+int RGWRadosList::do_incomplete_multipart(const DoutPrefixProvider *dpp,
+                                         rgw::sal::RGWBucket* bucket)
 {
   constexpr int max_uploads = 1000;
   constexpr int max_parts = 1000;
@@ -1482,20 +1452,16 @@ int RGWRadosList::do_incomplete_multipart(
 
   int ret;
 
-  RGWRados::Bucket target(store->getRados(), bucket_info);
-  RGWRados::Bucket::List list_op(&target);
-  list_op.params.ns = mp_ns;
-  list_op.params.filter = &mp_filter;
-  // use empty string for initial list_op.params.marker
-  // use empty strings for list_op.params.{prefix,delim}
+  rgw::sal::RGWBucket::ListParams params;
+  rgw::sal::RGWBucket::ListResults results;
 
-  bool is_listing_truncated;
+  params.ns = mp_ns;
+  params.filter = &mp_filter;
+  // use empty string for initial params.marker
+  // use empty strings for params.{prefix,delim}
 
   do {
-    std::vector<rgw_bucket_dir_entry> objs;
-    std::map<string, bool> common_prefixes;
-    ret = list_op.list_objects(dpp, max_uploads, &objs, &common_prefixes,
-                              &is_listing_truncated, null_yield);
+    ret = bucket->list(dpp, params, max_uploads, results, null_yield);
     if (ret == -ENOENT) {
       // could bucket have been removed while this is running?
       ldpp_dout(dpp, 20) << "RGWRadosList::" << __func__ <<
@@ -1508,10 +1474,10 @@ int RGWRadosList::do_incomplete_multipart(
       return ret;
     }
 
-    if (!objs.empty()) {
+    if (!results.objs.empty()) {
       std::vector<RGWMultipartUploadEntry> uploads;
       RGWMultipartUploadEntry entry;
-      for (const rgw_bucket_dir_entry& obj : objs) {
+      for (const rgw_bucket_dir_entry& obj : results.objs) {
        const rgw_obj_key& key = obj.key;
        if (!entry.mp.from_meta(key.name)) {
          // we only want the meta objects, so skip all the components
@@ -1532,7 +1498,7 @@ int RGWRadosList::do_incomplete_multipart(
 
        for (const auto& upload : uploads) {
          const RGWMPObj& mp = upload.mp;
-         ret = list_multipart_parts(store, bucket_info, store->ctx(),
+         ret = list_multipart_parts(bucket, store->ctx(),
                                     mp.get_upload_id(), mp.get_meta(),
                                     max_parts,
                                     parts_marker, parts, NULL, &is_parts_truncated);
@@ -1556,8 +1522,8 @@ int RGWRadosList::do_incomplete_multipart(
          }
        }
       } while (is_parts_truncated);
-    } // if objs not empty
-  } while (is_listing_truncated);
+    } // if results.objs not empty
+  } while (results.is_truncated);
 
   return 0;
 } // RGWRadosList::do_incomplete_multipart
index 10e9f52390995c5dad95f538fe90637de39b53cc..bdf17069856023062d5e72130062dffd1fd5a4ec 100644 (file)
@@ -123,13 +123,13 @@ struct RGWOrphanSearchState {
 WRITE_CLASS_ENCODER(RGWOrphanSearchState)
 
 class RGWOrphanStore {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   librados::IoCtx ioctx;
 
   string oid;
 
 public:
-  explicit RGWOrphanStore(rgw::sal::RGWRadosStore *_store) : store(_store), oid(RGW_ORPHAN_INDEX_OID) {}
+  explicit RGWOrphanStore(rgw::sal::RGWStore *_store) : store(_store), oid(RGW_ORPHAN_INDEX_OID) {}
 
   librados::IoCtx& get_ioctx() { return ioctx; }
 
@@ -147,7 +147,7 @@ public:
 
 
 class RGWOrphanSearch {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
 
   RGWOrphanStore orphan_store;
 
@@ -179,13 +179,13 @@ class RGWOrphanSearch {
     return ceph_str_hash_linux(str.c_str(), str.size()) % RGW_ORPHANSEARCH_HASH_PRIME % search_info.num_shards;
   }
 
-  int handle_stat_result(map<int, list<string> >& oids, RGWRados::Object::Stat::Result& result);
-  int pop_and_handle_stat_op(map<int, list<string> >& oids, std::deque<RGWRados::Object::Stat>& ops);
+  int handle_stat_result(map<int, list<string> >& oids, rgw::sal::RGWObject::StatOp::Result& result);
+  int pop_and_handle_stat_op(map<int, list<string> >& oids, std::deque<std::unique_ptr<rgw::sal::RGWObject::StatOp>>& ops);
 
 
   int remove_index(map<int, string>& index);
 public:
-  RGWOrphanSearch(rgw::sal::RGWRadosStore *_store, int _max_ios, uint64_t _stale_secs) : store(_store), orphan_store(store), max_concurrent_ios(_max_ios), stale_secs(_stale_secs) {}
+  RGWOrphanSearch(rgw::sal::RGWStore *_store, int _max_ios, uint64_t _stale_secs) : store(_store), orphan_store(store), max_concurrent_ios(_max_ios), stale_secs(_stale_secs) {}
 
   int save_state() {
     RGWOrphanSearchState state;
@@ -251,7 +251,7 @@ class RGWRadosList {
     p.first->second.filter_keys.insert(obj_key);
   }
 
-  rgw::sal::RGWRadosStore* store;
+  rgw::sal::RGWStore* store;
 
   uint16_t max_concurrent_ios;
   uint64_t stale_secs;
@@ -260,16 +260,16 @@ class RGWRadosList {
   bool include_rgw_obj_name;
   std::string field_separator;
 
-  int handle_stat_result(RGWRados::Object::Stat::Result& result,
+  int handle_stat_result(rgw::sal::RGWObject::StatOp::Result& result,
                         std::string& bucket_name,
                         rgw_obj_key& obj_key,
                         std::set<string>& obj_oids);
   int pop_and_handle_stat_op(RGWObjectCtx& obj_ctx,
-                            std::deque<RGWRados::Object::Stat>& ops);
+                            std::deque<std::unique_ptr<rgw::sal::RGWObject::StatOp>>& ops);
 
 public:
 
-  RGWRadosList(rgw::sal::RGWRadosStore* _store,
+  RGWRadosList(rgw::sal::RGWStore* _store,
               int _max_ios,
               uint64_t _stale_secs,
               const std::string& _tenant_name) :
@@ -285,9 +285,8 @@ public:
                     const std::string& prefix,
                     const std::set<rgw_obj_key>& entries_filter);
 
-  int do_incomplete_multipart(const DoutPrefixProvider *dpp, 
-                              rgw::sal::RGWRadosStore* store,
-                             RGWBucketInfo& bucket_info);
+  int do_incomplete_multipart(const DoutPrefixProvider *dpp,
+                             rgw::sal::RGWBucket* bucket);
 
   int build_linked_oids_index();
 
index 5742a9c6f555b684c08eb0ca97d1dc7e5982e065..a8bf42398a7651ba23e2eb7f2d922ca6713ffa30 100644 (file)
@@ -11,7 +11,7 @@
 namespace rgw {
 
 /* static */
-  int RGWHandler_Lib::init_from_header(rgw::sal::RGWRadosStore *store,
+  int RGWHandler_Lib::init_from_header(rgw::sal::RGWStore *store,
                                       struct req_state *s)
   {
     string req;
index 57ef4b2a26545b60b9e4d9be4042a1e75a2b0cd3..fce7fb3ecbcfe8712edd570724c16570f7af13cf 100644 (file)
@@ -5,7 +5,7 @@
 #define CEPH_RGW_OTP_H
 
 namespace rgw { namespace sal {
-class RGWRadosStore;
+class RGWStore;
 } }
 
 #include "cls/otp/cls_otp_types.h"
index 66511bbcaeda3587cb210286d5ca62ee81a2edfb..aecb8b89ee9fe9fc374ed2db2c59a239edc1473e 100644 (file)
@@ -158,18 +158,19 @@ class RGWPeriodPusher::CRThread {
 };
 
 
-RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWRadosStore* store,
+RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWStore* store,
                                 optional_yield y)
   : cct(store->ctx()), store(store)
 {
-  const auto& realm = store->svc()->zone->get_realm();
+  const auto& realm = store->get_realm();
   auto& realm_id = realm.get_id();
   if (realm_id.empty()) // no realm configuration
     return;
 
   // always send out the current period on startup
   RGWPeriod period;
-  int r = period.init(cct, store->svc()->sysobj, realm_id, y, realm.get_name());
+  // XXX dang
+  int r = period.init(cct, static_cast<rgw::sal::RGWRadosStore *>(store)->svc()->sysobj, realm_id, y, realm.get_name());
   if (r < 0) {
     lderr(cct) << "failed to load period for realm " << realm_id << dendl;
     return;
@@ -224,7 +225,7 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
 
   // find our zonegroup in the new period
   auto& zonegroups = period.get_map().zonegroups;
-  auto i = zonegroups.find(store->svc()->zone->get_zonegroup().get_id());
+  auto i = zonegroups.find(store->get_zonegroup().get_id());
   if (i == zonegroups.end()) {
     lderr(cct) << "The new period does not contain my zonegroup!" << dendl;
     return;
@@ -232,7 +233,7 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
   auto& my_zonegroup = i->second;
 
   // if we're not a master zone, we're not responsible for pushing any updates
-  if (my_zonegroup.master_zone != store->svc()->zone->get_zone_params().get_id())
+  if (my_zonegroup.master_zone != store->get_zone_params().get_id())
     return;
 
   // construct a map of the zones that need this period. the map uses the same
@@ -241,11 +242,11 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
   auto hint = conns.end();
 
   // are we the master zonegroup in this period?
-  if (period.get_map().master_zonegroup == store->svc()->zone->get_zonegroup().get_id()) {
+  if (period.get_map().master_zonegroup == store->get_zonegroup().get_id()) {
     // update other zonegroup endpoints
     for (auto& zg : zonegroups) {
       auto& zonegroup = zg.second;
-      if (zonegroup.get_id() == store->svc()->zone->get_zonegroup().get_id())
+      if (zonegroup.get_id() == store->get_zonegroup().get_id())
         continue;
       if (zonegroup.endpoints.empty())
         continue;
@@ -253,14 +254,14 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
       hint = conns.emplace_hint(
           hint, std::piecewise_construct,
           std::forward_as_tuple(zonegroup.get_id()),
-          std::forward_as_tuple(cct, store->svc()->zone, zonegroup.get_id(), zonegroup.endpoints));
+          std::forward_as_tuple(cct, store, zonegroup.get_id(), zonegroup.endpoints));
     }
   }
 
   // update other zone endpoints
   for (auto& z : my_zonegroup.zones) {
     auto& zone = z.second;
-    if (zone.id == store->svc()->zone->get_zone_params().get_id())
+    if (zone.id == store->get_zone_params().get_id())
       continue;
     if (zone.endpoints.empty())
       continue;
@@ -268,7 +269,7 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
     hint = conns.emplace_hint(
         hint, std::piecewise_construct,
         std::forward_as_tuple(zone.id),
-        std::forward_as_tuple(cct, store->svc()->zone, zone.id, zone.endpoints));
+        std::forward_as_tuple(cct, store, zone.id, zone.endpoints));
   }
 
   if (conns.empty()) {
@@ -294,7 +295,7 @@ void RGWPeriodPusher::pause()
   store = nullptr;
 }
 
-void RGWPeriodPusher::resume(rgw::sal::RGWRadosStore* store)
+void RGWPeriodPusher::resume(rgw::sal::RGWStore* store)
 {
   std::lock_guard<std::mutex> lock(mutex);
   this->store = store;
index fded5095c1b22193d7810ed8bd80a858667b7138..5d768443d4472c100e88fa30bdafe3c35436e992 100644 (file)
@@ -13,7 +13,7 @@
 
 namespace rgw {
 namespace sal {
-class RGWRadosStore;
+class RGWStore;
 }
 }
 
@@ -29,7 +29,7 @@ using RGWZonesNeedPeriod = RGWPeriod;
 class RGWPeriodPusher final : public RGWRealmWatcher::Watcher,
                               public RGWRealmReloader::Pauser {
  public:
-  explicit RGWPeriodPusher(rgw::sal::RGWRadosStore* store, optional_yield y);
+  explicit RGWPeriodPusher(rgw::sal::RGWStore* store, optional_yield y);
   ~RGWPeriodPusher() override;
 
   /// respond to realm notifications by pushing new periods to other zones
@@ -40,13 +40,13 @@ class RGWPeriodPusher final : public RGWRealmWatcher::Watcher,
   void pause() override;
 
   /// continue processing notifications with a new RGWRados instance
-  void resume(rgw::sal::RGWRadosStore* store) override;
+  void resume(rgw::sal::RGWStore* store) override;
 
  private:
   void handle_notify(RGWZonesNeedPeriod&& period);
 
   CephContext *const cct;
-  rgw::sal::RGWRadosStore* store;
+  rgw::sal::RGWStore* store;
 
   std::mutex mutex;
   epoch_t realm_epoch{0}; //< the current realm epoch being sent
index 57c72e9365c461bc144ebc44918c33c3a9ec5d30..3cfe5d53a0a8c0f55f60aaff8500b900d215d13a 100644 (file)
@@ -172,7 +172,7 @@ int rgw_process_authenticated(RGWHandler_REST * const handler,
   return 0;
 }
 
-int process_request(rgw::sal::RGWRadosStore* const store,
+int process_request(rgw::sal::RGWStore* const store,
                     RGWREST* const rest,
                     RGWRequest* const req,
                     const std::string& frontend_prefix,
@@ -201,7 +201,7 @@ int process_request(rgw::sal::RGWRadosStore* const store,
   RGWObjectCtx rados_ctx(store, s);
   s->obj_ctx = &rados_ctx;
 
-  auto sysobj_ctx = store->svc()->sysobj->init_obj_ctx();
+  auto sysobj_ctx = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj->init_obj_ctx();
   s->sysobj_ctx = &sysobj_ctx;
 
   if (ret < 0) {
@@ -210,9 +210,9 @@ int process_request(rgw::sal::RGWRadosStore* const store,
     return ret;
   }
 
-  s->req_id = store->svc()->zone_utils->unique_id(req->id);
-  s->trans_id = store->svc()->zone_utils->unique_trans_id(req->id);
-  s->host_id = store->getRados()->host_id;
+  s->req_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_id(req->id);
+  s->trans_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_trans_id(req->id);
+  s->host_id = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->host_id;
   s->yield = yield;
 
   ldpp_dout(s, 2) << "initializing for trans_id = " << s->trans_id << dendl;
@@ -332,7 +332,7 @@ done:
   }
 
   if (should_log) {
-    rgw_log_op(store->getRados(), rest, s, (op ? op->name() : "unknown"), olog);
+    rgw_log_op(store, rest, s, (op ? op->name() : "unknown"), olog);
   }
 
   if (http_ret != nullptr) {
index b0365ece9d088a7d6e91e56dd74cb26bcae47e9d..2cf6fb7df9151c1d021edbc4aefceeb8a1498799 100644 (file)
@@ -32,7 +32,7 @@ namespace rgw::dmclock {
 }
 
 struct RGWProcessEnv {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   RGWREST *rest;
   OpsLogSocket *olog;
   int port;
@@ -47,7 +47,7 @@ class RGWProcess {
   deque<RGWRequest*> m_req_queue;
 protected:
   CephContext *cct;
-  rgw::sal::RGWRadosStore* store;
+  rgw::sal::RGWStore* store;
   rgw_auth_registry_ptr_t auth_registry;
   OpsLogSocket* olog;
   ThreadPool m_tp;
@@ -117,7 +117,7 @@ public:
     m_tp.pause();
   }
 
-  void unpause_with_new_config(rgw::sal::RGWRadosStore* const store,
+  void unpause_with_new_config(rgw::sal::RGWStore* const store,
                                rgw_auth_registry_ptr_t auth_registry) {
     this->store = store;
     this->auth_registry = std::move(auth_registry);
@@ -176,7 +176,7 @@ public:
   void set_access_key(RGWAccessKey& key) { access_key = key; }
 };
 /* process stream request */
-extern int process_request(rgw::sal::RGWRadosStore* store,
+extern int process_request(rgw::sal::RGWStore* store,
                            RGWREST* rest,
                            RGWRequest* req,
                            const std::string& frontend_prefix,
index 80c93bd87fc83c5afe0ad39f2d3fa1888d06b450..74ab2bd144bb19562c7ed64d40f211e97f50b7db 100644 (file)
@@ -4,13 +4,14 @@
 #ifndef CEPH_RGW_PUBSUB_H
 #define CEPH_RGW_PUBSUB_H
 
-#include "rgw_sal.h"
 #include "services/svc_sys_obj.h"
 #include "rgw_tools.h"
 #include "rgw_zone.h"
 #include "rgw_notify_event_type.h"
 #include <boost/container/flat_map.hpp>
 
+namespace rgw::sal { class RGWRadosStore; }
+
 class XMLObj;
 
 struct rgw_s3_key_filter {
index e3d9271548301034fad75b8930a5c02583aa7804..4151294d1cb200516224fafb10edf5db6b1d6a25 100644 (file)
@@ -34,6 +34,7 @@ class DataProcessor {
 class Pipe : public DataProcessor {
   DataProcessor *next;
  public:
+  explicit Pipe() : next(nullptr) {}
   explicit Pipe(DataProcessor *next) : next(next) {}
 
   // passes the data on to the next processor
@@ -47,6 +48,7 @@ class ChunkProcessor : public Pipe {
   uint64_t chunk_size;
   bufferlist chunk; // leftover bytes from the last call to process()
  public:
+  ChunkProcessor() {}
   ChunkProcessor(DataProcessor *next, uint64_t chunk_size)
     : Pipe(next), chunk_size(chunk_size)
   {}
@@ -68,6 +70,7 @@ class StripeProcessor : public Pipe {
   StripeGenerator *gen;
   std::pair<uint64_t, uint64_t> bounds; // bounds of current stripe
  public:
+  StripeProcessor() {}
   StripeProcessor(DataProcessor *next, StripeGenerator *gen,
                   uint64_t first_stripe_size)
     : Pipe(next), gen(gen), bounds(0, first_stripe_size)
index 66428b2c16debd20c9cefd6fff7679cb622594a6..12773ccf7c4dfb56ec6ad8bdeac1ce49fb0e5ad4 100644 (file)
@@ -60,113 +60,6 @@ int HeadObjectProcessor::process(bufferlist&& data, uint64_t logical_offset)
   return processor->process(std::move(data), write_offset);
 }
 
-
-static int process_completed(const AioResultList& completed, RawObjSet *written)
-{
-  std::optional<int> error;
-  for (auto& r : completed) {
-    if (r.result >= 0) {
-      written->insert(r.obj.get_ref().obj);
-    } else if (!error) { // record first error code
-      error = r.result;
-    }
-  }
-  return error.value_or(0);
-}
-
-int RadosWriter::set_stripe_obj(const rgw_raw_obj& raw_obj)
-{
-  stripe_obj = store->svc()->rados->obj(raw_obj);
-  return stripe_obj.open();
-}
-
-int RadosWriter::process(bufferlist&& bl, uint64_t offset)
-{
-  bufferlist data = std::move(bl);
-  const uint64_t cost = data.length();
-  if (cost == 0) { // no empty writes, use aio directly for creates
-    return 0;
-  }
-  librados::ObjectWriteOperation op;
-  if (offset == 0) {
-    op.write_full(data);
-  } else {
-    op.write(offset, data);
-  }
-  constexpr uint64_t id = 0; // unused
-  auto c = aio->get(stripe_obj, Aio::librados_op(std::move(op), y), cost, id);
-  return process_completed(c, &written);
-}
-
-int RadosWriter::write_exclusive(const bufferlist& data)
-{
-  const uint64_t cost = data.length();
-
-  librados::ObjectWriteOperation op;
-  op.create(true); // exclusive create
-  op.write_full(data);
-
-  constexpr uint64_t id = 0; // unused
-  auto c = aio->get(stripe_obj, Aio::librados_op(std::move(op), y), cost, id);
-  auto d = aio->drain();
-  c.splice(c.end(), d);
-  return process_completed(c, &written);
-}
-
-int RadosWriter::drain()
-{
-  return process_completed(aio->drain(), &written);
-}
-
-RadosWriter::~RadosWriter()
-{
-  // wait on any outstanding aio completions
-  process_completed(aio->drain(), &written);
-
-  bool need_to_remove_head = false;
-  std::optional<rgw_raw_obj> raw_head;
-  if (!rgw::sal::RGWObject::empty(head_obj.get())) {
-    raw_head.emplace();
-    head_obj->get_raw_obj(&*raw_head);
-  }
-
-  /**
-   * We should delete the object in the "multipart" namespace to avoid race condition.
-   * Such race condition is caused by the fact that the multipart object is the gatekeeper of a multipart
-   * upload, when it is deleted, a second upload would start with the same suffix("2/"), therefore, objects
-   * written by the second upload may be deleted by the first upload.
-   * details is describled on #11749
-   *
-   * The above comment still stands, but instead of searching for a specific object in the multipart
-   * namespace, we just make sure that we remove the object that is marked as the head object after
-   * we remove all the other raw objects. Note that we use different call to remove the head object,
-   * as this one needs to go via the bucket index prepare/complete 2-phase commit scheme.
-   */
-  for (const auto& obj : written) {
-    if (raw_head && obj == *raw_head) {
-      ldpp_dout(dpp, 5) << "NOTE: we should not process the head object (" << obj << ") here" << dendl;
-      need_to_remove_head = true;
-      continue;
-    }
-
-    int r = store->delete_raw_obj(obj);
-    if (r < 0 && r != -ENOENT) {
-      ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << obj << "), leaked" << dendl;
-    }
-  }
-
-  if (need_to_remove_head) {
-    std::string version_id;
-    ldpp_dout(dpp, 5) << "NOTE: we are going to process the head obj (" << *raw_head << ")" << dendl;
-    int r = head_obj->delete_object(dpp, &obj_ctx, ACLOwner(), bucket->get_acl_owner(), ceph::real_time(),
-                                   false, 0, version_id, null_yield);
-    if (r < 0 && r != -ENOENT) {
-      ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << *raw_head << "), leaked" << dendl;
-    }
-  }
-}
-
-
 // advance to the next stripe
 int ManifestObjectProcessor::next(uint64_t offset, uint64_t *pstripe_size)
 {
@@ -183,12 +76,12 @@ int ManifestObjectProcessor::next(uint64_t offset, uint64_t *pstripe_size)
   if (r < 0) {
     return r;
   }
-  r = writer.set_stripe_obj(stripe_obj);
+  r = writer->set_stripe_obj(stripe_obj);
   if (r < 0) {
     return r;
   }
 
-  chunk = ChunkProcessor(&writer, chunk_size);
+  chunk = ChunkProcessor(writer.get(), chunk_size);
   *pstripe_size = manifest_gen.cur_stripe_max_size();
   return 0;
 }
@@ -252,14 +145,14 @@ int AtomicObjectProcessor::prepare(optional_yield y)
 
   rgw_raw_obj stripe_obj = manifest_gen.get_cur_obj(store);
 
-  r = writer.set_stripe_obj(stripe_obj);
+  r = writer->set_stripe_obj(stripe_obj);
   if (r < 0) {
     return r;
   }
 
   set_head_chunk_size(head_max_size);
   // initialize the processors
-  chunk = ChunkProcessor(&writer, chunk_size);
+  chunk = ChunkProcessor(writer.get(), chunk_size);
   stripe = StripeProcessor(&chunk, this, head_max_size);
   return 0;
 }
@@ -276,7 +169,7 @@ int AtomicObjectProcessor::complete(size_t accounted_size,
                                     rgw_zone_set *zones_trace,
                                     bool *pcanceled, optional_yield y)
 {
-  int r = writer.drain();
+  int r = writer->drain();
   if (r < 0) {
     return r;
   }
@@ -319,7 +212,7 @@ int AtomicObjectProcessor::complete(size_t accounted_size,
   }
   if (!obj_op->params.canceled) {
     // on success, clear the set of objects for deletion
-    writer.clear_written();
+    writer->clear_written();
   }
   if (pcanceled) {
     *pcanceled = obj_op->params.canceled;
@@ -333,7 +226,7 @@ int MultipartObjectProcessor::process_first_chunk(bufferlist&& data,
 {
   // write the first chunk of the head object as part of an exclusive create,
   // then drain to wait for the result in case of EEXIST
-  int r = writer.write_exclusive(data);
+  int r = writer->write_exclusive(data);
   if (r == -EEXIST) {
     // randomize the oid prefix and reprepare the head/manifest
     std::string oid_rand = gen_rand_alphanumeric(store->ctx(), 32);
@@ -346,7 +239,7 @@ int MultipartObjectProcessor::process_first_chunk(bufferlist&& data,
       return r;
     }
     // resubmit the write op on the new head object
-    r = writer.write_exclusive(data);
+    r = writer->write_exclusive(data);
   }
   if (r < 0) {
     return r;
@@ -384,14 +277,14 @@ int MultipartObjectProcessor::prepare_head()
   head_obj->raw_obj_to_obj(stripe_obj);
   head_obj->set_hash_source(target_obj->get_name());
 
-  r = writer.set_stripe_obj(stripe_obj);
+  r = writer->set_stripe_obj(stripe_obj);
   if (r < 0) {
     return r;
   }
   stripe_size = manifest_gen.cur_stripe_max_size();
   set_head_chunk_size(stripe_size);
 
-  chunk = ChunkProcessor(&writer, chunk_size);
+  chunk = ChunkProcessor(writer.get(), chunk_size);
   stripe = StripeProcessor(&chunk, this, stripe_size);
   return 0;
 }
@@ -415,7 +308,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
                                        rgw_zone_set *zones_trace,
                                        bool *pcanceled, optional_yield y)
 {
-  int r = writer.drain();
+  int r = writer->drain();
   if (r < 0) {
     return r;
   }
@@ -483,7 +376,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
 
   if (!obj_op->params.canceled) {
     // on success, clear the set of objects for deletion
-    writer.clear_written();
+    writer->clear_written();
   }
   if (pcanceled) {
     *pcanceled = obj_op->params.canceled;
@@ -493,7 +386,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
 
 int AppendObjectProcessor::process_first_chunk(bufferlist &&data, rgw::putobj::DataProcessor **processor)
 {
-  int r = writer.write_exclusive(data);
+  int r = writer->write_exclusive(data);
   if (r < 0) {
     return r;
   }
@@ -504,7 +397,7 @@ int AppendObjectProcessor::process_first_chunk(bufferlist &&data, rgw::putobj::D
 int AppendObjectProcessor::prepare(optional_yield y)
 {
   RGWObjState *astate;
-  int r = head_obj->get_obj_state(dpp, &obj_ctx, *bucket, &astate, y);
+  int r = head_obj->get_obj_state(dpp, &obj_ctx, &astate, y);
   if (r < 0) {
     return r;
   }
@@ -575,7 +468,7 @@ int AppendObjectProcessor::prepare(optional_yield y)
   if (r < 0) {
     return r;
   }
-  r = writer.set_stripe_obj(std::move(stripe_obj));
+  r = writer->set_stripe_obj(std::move(stripe_obj));
   if (r < 0) {
     return r;
   }
@@ -586,7 +479,7 @@ int AppendObjectProcessor::prepare(optional_yield y)
   set_head_chunk_size(max_head_size);
 
   // initialize the processors
-  chunk = ChunkProcessor(&writer, chunk_size);
+  chunk = ChunkProcessor(writer.get(), chunk_size);
   stripe = StripeProcessor(&chunk, this, stripe_size);
 
   return 0;
@@ -598,7 +491,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
                                     const string *user_data, rgw_zone_set *zones_trace, bool *pcanceled,
                                     optional_yield y)
 {
-  int r = writer.drain();
+  int r = writer->drain();
   if (r < 0)
     return r;
   const uint64_t actual_size = get_actual_size();
@@ -611,7 +504,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
   //For Append obj, disable versioning
   obj_op->params.versioning_disabled = true;
   if (cur_manifest) {
-    cur_manifest->append(manifest, store->svc()->zone);
+    cur_manifest->append(manifest, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone);
     obj_op->params.manifest = cur_manifest;
   } else {
     obj_op->params.manifest = &manifest;
@@ -660,7 +553,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
   }
   if (!obj_op->params.canceled) {
     // on success, clear the set of objects for deletion
-    writer.clear_written();
+    writer->clear_written();
   }
   if (pcanceled) {
     *pcanceled = obj_op->params.canceled;
index f6308ddb7fb2a3323017d3a9c919d1dcee71e2e8..e4c5ae025954a14932dee530dd62fffa4b834848 100644 (file)
@@ -75,64 +75,18 @@ class HeadObjectProcessor : public ObjectProcessor {
 };
 
 
-using RawObjSet = std::set<rgw_raw_obj>;
-
-// a data sink that writes to rados objects and deletes them on cancelation
-class RadosWriter : public DataProcessor {
-  Aio *const aio;
-  rgw::sal::RGWRadosStore *const store;
-  rgw::sal::RGWBucket* bucket;
-  RGWObjectCtx& obj_ctx;
-  std::unique_ptr<rgw::sal::RGWObject> head_obj;
-  RGWSI_RADOS::Obj stripe_obj; // current stripe object
-  RawObjSet written; // set of written objects for deletion
-  const DoutPrefixProvider *dpp;
-  optional_yield y;
-
- public:
-  RadosWriter(Aio *aio, rgw::sal::RGWRadosStore *store,
-             rgw::sal::RGWBucket* bucket,
-              RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
-              const DoutPrefixProvider *dpp, optional_yield y)
-    : aio(aio), store(store), bucket(bucket),
-      obj_ctx(obj_ctx), head_obj(std::move(_head_obj)), dpp(dpp), y(y)
-  {}
-  RadosWriter(RadosWriter&& r)
-    : aio(r.aio), store(r.store), bucket(r.bucket),
-      obj_ctx(r.obj_ctx), head_obj(std::move(r.head_obj)), dpp(r.dpp), y(r.y)
-  {}
-
-  ~RadosWriter();
-
-  // change the current stripe object
-  int set_stripe_obj(const rgw_raw_obj& obj);
-
-  // write the data at the given offset of the current stripe object
-  int process(bufferlist&& data, uint64_t stripe_offset) override;
-
-  // write the data as an exclusive create and wait for it to complete
-  int write_exclusive(const bufferlist& data);
-
-  int drain();
-
-  // when the operation completes successfully, clear the set of written objects
-  // so they aren't deleted on destruction
-  void clear_written() { written.clear(); }
-
-};
-
 // a rados object processor that stripes according to RGWObjManifest
 class ManifestObjectProcessor : public HeadObjectProcessor,
                                 public StripeGenerator {
  protected:
-  rgw::sal::RGWRadosStore *const store;
+  rgw::sal::RGWStore *const store;
   rgw::sal::RGWBucket* bucket;
   rgw_placement_rule tail_placement_rule;
   rgw_user owner;
   RGWObjectCtx& obj_ctx;
   std::unique_ptr<rgw::sal::RGWObject> head_obj;
 
-  RadosWriter writer;
+  std::unique_ptr<rgw::sal::Writer> writer;
   RGWObjManifest manifest;
   RGWObjManifest::generator manifest_gen;
   ChunkProcessor chunk;
@@ -143,7 +97,7 @@ class ManifestObjectProcessor : public HeadObjectProcessor,
   int next(uint64_t offset, uint64_t *stripe_size) override;
 
  public:
-  ManifestObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
+  ManifestObjectProcessor(Aio *aio, rgw::sal::RGWStore *store,
                          rgw::sal::RGWBucket* bucket,
                           const rgw_placement_rule *ptail_placement_rule,
                           const rgw_user& owner, RGWObjectCtx& obj_ctx,
@@ -153,8 +107,10 @@ class ManifestObjectProcessor : public HeadObjectProcessor,
       store(store), bucket(bucket),
       owner(owner),
       obj_ctx(obj_ctx), head_obj(std::move(_head_obj)),
-      writer(aio, store, bucket, obj_ctx, head_obj->clone(), dpp, y),
-      chunk(&writer, 0), stripe(&chunk, this, 0), dpp(dpp) {
+      dpp(dpp) {
+       writer = store->get_writer(aio, bucket, obj_ctx, head_obj->clone(), dpp, y);
+       chunk = ChunkProcessor(writer.get(), 0);
+       stripe = StripeProcessor(&chunk, this, 0);
         if (ptail_placement_rule) {
           tail_placement_rule = *ptail_placement_rule;
         }
@@ -183,7 +139,7 @@ class AtomicObjectProcessor : public ManifestObjectProcessor {
 
   int process_first_chunk(bufferlist&& data, DataProcessor **processor) override;
  public:
-  AtomicObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
+  AtomicObjectProcessor(Aio *aio, rgw::sal::RGWStore *store,
                        rgw::sal::RGWBucket* bucket,
                         const rgw_placement_rule *ptail_placement_rule,
                         const rgw_user& owner,
@@ -228,7 +184,7 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
   // prepare the head stripe and manifest
   int prepare_head();
  public:
-  MultipartObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
+  MultipartObjectProcessor(Aio *aio, rgw::sal::RGWStore *store,
                           rgw::sal::RGWBucket* bucket,
                            const rgw_placement_rule *ptail_placement_rule,
                            const rgw_user& owner, RGWObjectCtx& obj_ctx,
@@ -271,7 +227,7 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
     int process_first_chunk(bufferlist&& data, DataProcessor **processor) override;
 
   public:
-    AppendObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
+    AppendObjectProcessor(Aio *aio, rgw::sal::RGWStore *store,
                          rgw::sal::RGWBucket* bucket,
                           const rgw_placement_rule *ptail_placement_rule,
                           const rgw_user& owner, RGWObjectCtx& obj_ctx,
index 2b26362472128188f0e166bb1c92f5053cccee20..c7981a56b9d2b845cc69bcbb3c2ed2e5160a0002 100644 (file)
@@ -45,7 +45,7 @@ struct RGWQuotaCacheStats {
 template<class T>
 class RGWQuotaCache {
 protected:
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   lru_map<T, RGWQuotaCacheStats> stats_map;
   RefCountedWaitObject *async_refcount;
 
@@ -74,7 +74,7 @@ protected:
 
   virtual void data_modified(const rgw_user& user, rgw_bucket& bucket) {}
 public:
-  RGWQuotaCache(rgw::sal::RGWRadosStore *_store, int size) : store(_store), stats_map(size) {
+  RGWQuotaCache(rgw::sal::RGWStore *_store, int size) : store(_store), stats_map(size) {
     async_refcount = new RefCountedWaitObject;
   }
   virtual ~RGWQuotaCache() {
@@ -93,10 +93,10 @@ public:
 
   class AsyncRefreshHandler {
   protected:
-    rgw::sal::RGWRadosStore *store;
+    rgw::sal::RGWStore *store;
     RGWQuotaCache<T> *cache;
   public:
-    AsyncRefreshHandler(rgw::sal::RGWRadosStore *_store, RGWQuotaCache<T> *_cache) : store(_store), cache(_cache) {}
+    AsyncRefreshHandler(rgw::sal::RGWStore *_store, RGWQuotaCache<T> *_cache) : store(_store), cache(_cache) {}
     virtual ~AsyncRefreshHandler() {}
 
     virtual int init_fetch() = 0;
@@ -281,7 +281,7 @@ class BucketAsyncRefreshHandler : public RGWQuotaCache<rgw_bucket>::AsyncRefresh
                                   public RGWGetBucketStats_CB {
   rgw_user user;
 public:
-  BucketAsyncRefreshHandler(rgw::sal::RGWRadosStore *_store, RGWQuotaCache<rgw_bucket> *_cache,
+  BucketAsyncRefreshHandler(rgw::sal::RGWStore *_store, RGWQuotaCache<rgw_bucket> *_cache,
                             const rgw_user& _user, const rgw_bucket& _bucket) :
                                       RGWQuotaCache<rgw_bucket>::AsyncRefreshHandler(_store, _cache),
                                       RGWGetBucketStats_CB(_bucket), user(_user) {}
@@ -293,12 +293,10 @@ public:
 
 int BucketAsyncRefreshHandler::init_fetch()
 {
-  RGWBucketInfo bucket_info;
-
-  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
+  std::unique_ptr<rgw::sal::RGWBucket> rbucket;
 
   const DoutPrefix dp(store->ctx(), dout_subsys, "rgw bucket async refresh handler: ");
-  int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, null_yield, &dp);
+  int r = store->get_bucket(&dp, nullptr, bucket, &rbucket, null_yield);
   if (r < 0) {
     ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl;
     return r;
@@ -306,7 +304,7 @@ int BucketAsyncRefreshHandler::init_fetch()
 
   ldout(store->ctx(), 20) << "initiating async quota refresh for bucket=" << bucket << dendl;
 
-  r = store->getRados()->get_bucket_stats_async(bucket_info, RGW_NO_SHARD, this);
+  r = rbucket->get_bucket_stats_async(RGW_NO_SHARD, this);
   if (r < 0) {
     ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket.name << dendl;
 
@@ -355,7 +353,7 @@ protected:
   int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp) override;
 
 public:
-  explicit RGWBucketStatsCache(rgw::sal::RGWRadosStore *_store) : RGWQuotaCache<rgw_bucket>(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size) {
+  explicit RGWBucketStatsCache(rgw::sal::RGWStore *_store) : RGWQuotaCache<rgw_bucket>(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size) {
   }
 
   AsyncRefreshHandler *allocate_refresh_handler(const rgw_user& user, const rgw_bucket& bucket) override {
@@ -363,15 +361,14 @@ public:
   }
 };
 
-int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp)
+int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& _u, const rgw_bucket& _b, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp)
 {
-  RGWBucketInfo bucket_info;
-
-  RGWSysObjectCtx obj_ctx = store->svc()->sysobj->init_obj_ctx();
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(_u);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
 
-  int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, y, dpp);
+  int r = store->get_bucket(dpp, user.get(), _b, &bucket, y);
   if (r < 0) {
-    ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl;
+    ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << _b << " r=" << r << dendl;
     return r;
   }
 
@@ -379,11 +376,10 @@ int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& user, const rg
   string master_ver;
 
   map<RGWObjCategory, RGWStorageStats> bucket_stats;
-  r = store->getRados()->get_bucket_stats(bucket_info, RGW_NO_SHARD, &bucket_ver,
-                                  &master_ver, bucket_stats, nullptr);
+  r = bucket->get_bucket_stats(RGW_NO_SHARD, &bucket_ver, &master_ver, bucket_stats);
   if (r < 0) {
     ldout(store->ctx(), 0) << "could not get bucket stats for bucket="
-                           << bucket.name << dendl;
+                           << _b.name << dendl;
     return r;
   }
 
@@ -404,7 +400,7 @@ class UserAsyncRefreshHandler : public RGWQuotaCache<rgw_user>::AsyncRefreshHand
                                 public RGWGetUserStats_CB {
   rgw_bucket bucket;
 public:
-  UserAsyncRefreshHandler(rgw::sal::RGWRadosStore *_store, RGWQuotaCache<rgw_user> *_cache,
+  UserAsyncRefreshHandler(rgw::sal::RGWStore *_store, RGWQuotaCache<rgw_user> *_cache,
                           const rgw_user& _user, const rgw_bucket& _bucket) :
                           RGWQuotaCache<rgw_user>::AsyncRefreshHandler(_store, _cache),
                           RGWGetUserStats_CB(_user),
@@ -417,8 +413,10 @@ public:
 
 int UserAsyncRefreshHandler::init_fetch()
 {
+  std::unique_ptr<rgw::sal::RGWUser> ruser = store->get_user(user);
+
   ldout(store->ctx(), 20) << "initiating async quota refresh for user=" << user << dendl;
-  int r = store->ctl()->user->read_stats_async(user, this);
+  int r = ruser->read_stats_async(this);
   if (r < 0) {
     ldout(store->ctx(), 0) << "could not get bucket info for user=" << user << dendl;
 
@@ -576,7 +574,7 @@ protected:
   }
 
 public:
-  RGWUserStatsCache(rgw::sal::RGWRadosStore *_store, bool quota_threads)
+  RGWUserStatsCache(rgw::sal::RGWStore *_store, bool quota_threads)
     : RGWQuotaCache<rgw_user>(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size)
   {
     if (quota_threads) {
@@ -618,13 +616,14 @@ public:
   }
 };
 
-int RGWUserStatsCache::fetch_stats_from_storage(const rgw_user& user,
-                                               const rgw_bucket& bucket,
+int RGWUserStatsCache::fetch_stats_from_storage(const rgw_user& _u,
+                                               const rgw_bucket& _b,
                                                RGWStorageStats& stats,
                                                optional_yield y,
                                                 const DoutPrefixProvider *dpp)
 {
-  int r = store->ctl()->user->read_stats(user, &stats, y);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(_u);
+  int r = user->read_stats(y, &stats);
   if (r < 0) {
     ldout(store->ctx(), 0) << "could not get user stats for user=" << user << dendl;
     return r;
@@ -633,34 +632,34 @@ int RGWUserStatsCache::fetch_stats_from_storage(const rgw_user& user,
   return 0;
 }
 
-int RGWUserStatsCache::sync_bucket(const rgw_user& user, rgw_bucket& bucket, optional_yield y, const DoutPrefixProvider *dpp)
+int RGWUserStatsCache::sync_bucket(const rgw_user& _u, rgw_bucket& _b, optional_yield y, const DoutPrefixProvider *dpp)
 {
-  RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(_u);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
 
-  int r = store->ctl()->bucket->read_bucket_instance_info(bucket, &bucket_info, y, dpp);
+  int r = store->get_bucket(dpp, user.get(), _b, &bucket, y);
   if (r < 0) {
-    ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl;
+    ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << _b << " r=" << r << dendl;
     return r;
   }
 
-  RGWBucketEnt ent;
-  r = store->ctl()->bucket->sync_user_stats(user, bucket_info, y, &ent);
+  r = bucket->sync_user_stats(y);
   if (r < 0) {
-    ldout(store->ctx(), 0) << "ERROR: sync_user_stats() for user=" << user << ", bucket=" << bucket << " returned " << r << dendl;
+    ldout(store->ctx(), 0) << "ERROR: sync_user_stats() for user=" << _u << ", bucket=" << bucket << " returned " << r << dendl;
     return r;
   }
 
-  return store->getRados()->check_bucket_shards(bucket_info, bucket, ent.count, dpp);
+  return bucket->check_bucket_shards(dpp);
 }
 
-int RGWUserStatsCache::sync_user(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y)
+int RGWUserStatsCache::sync_user(const DoutPrefixProvider *dpp, const rgw_user& _u, optional_yield y)
 {
-  string user_str = user.to_str();
   RGWStorageStats stats;
   ceph::real_time last_stats_sync;
   ceph::real_time last_stats_update;
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(_u.to_str()));
 
-  int ret = store->ctl()->user->read_stats(rgw_user(user_str), &stats, y, &last_stats_sync, &last_stats_update);
+  int ret = user->read_stats(y, &stats, &last_stats_sync, &last_stats_update);
   if (ret < 0) {
     ldout(store->ctx(), 5) << "ERROR: can't read user header: ret=" << ret << dendl;
     return ret;
@@ -678,7 +677,7 @@ int RGWUserStatsCache::sync_user(const DoutPrefixProvider *dpp, const rgw_user&
   // check if enough time passed since last full sync
   /* FIXME: missing check? */
 
-  ret = rgw_user_sync_all_stats(dpp, store, user, y);
+  ret = rgw_user_sync_all_stats(dpp, store, user.get(), y);
   if (ret < 0) {
     ldout(store->ctx(), 0) << "ERROR: failed user stats sync, ret=" << ret << dendl;
     return ret;
@@ -692,7 +691,7 @@ int RGWUserStatsCache::sync_all_users(const DoutPrefixProvider *dpp, optional_yi
   string key = "user";
   void *handle;
 
-  int ret = store->ctl()->meta.mgr->list_keys_init(key, &handle);
+  int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init(key, &handle);
   if (ret < 0) {
     ldout(store->ctx(), 10) << "ERROR: can't get key: ret=" << ret << dendl;
     return ret;
@@ -703,7 +702,7 @@ int RGWUserStatsCache::sync_all_users(const DoutPrefixProvider *dpp, optional_yi
 
   do {
     list<string> keys;
-    ret = store->ctl()->meta.mgr->list_keys_next(handle, max, keys, &truncated);
+    ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_next(handle, max, keys, &truncated);
     if (ret < 0) {
       ldout(store->ctx(), 0) << "ERROR: lists_keys_next(): ret=" << ret << dendl;
       goto done;
@@ -725,7 +724,7 @@ int RGWUserStatsCache::sync_all_users(const DoutPrefixProvider *dpp, optional_yi
 
   ret = 0;
 done:
-  store->ctl()->meta.mgr->list_keys_complete(handle);
+  static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_complete(handle);
   return ret;
 }
 
@@ -892,7 +891,7 @@ const RGWQuotaInfoApplier& RGWQuotaInfoApplier::get_instance(
 
 
 class RGWQuotaHandlerImpl : public RGWQuotaHandler {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   RGWBucketStatsCache bucket_stats_cache;
   RGWUserStatsCache user_stats_cache;
 
@@ -926,7 +925,7 @@ class RGWQuotaHandlerImpl : public RGWQuotaHandler {
     return 0;
   }
 public:
-  RGWQuotaHandlerImpl(rgw::sal::RGWRadosStore *_store, bool quota_threads) : store(_store),
+  RGWQuotaHandlerImpl(rgw::sal::RGWStore *_store, bool quota_threads) : store(_store),
                                     bucket_stats_cache(_store),
                                     user_stats_cache(_store, quota_threads) {}
 
@@ -999,7 +998,7 @@ public:
 };
 
 
-RGWQuotaHandler *RGWQuotaHandler::generate_handler(rgw::sal::RGWRadosStore *store, bool quota_threads)
+RGWQuotaHandler *RGWQuotaHandler::generate_handler(rgw::sal::RGWStore *store, bool quota_threads)
 {
   return new RGWQuotaHandlerImpl(store, quota_threads);
 }
index 6901aa913a561ca997de0e89f4ae4101fb1e789c..d6338f81cf15987f57bf2e60fea8daa3d4bd200f 100644 (file)
@@ -32,7 +32,7 @@ static inline int64_t rgw_rounded_kb(int64_t bytes)
 
 class JSONObj;
 namespace rgw { namespace sal {
-  class RGWRadosStore;
+  class RGWStore;
 } }
 
 struct RGWQuotaInfo {
@@ -115,7 +115,7 @@ public:
 
   virtual void update_stats(const rgw_user& bucket_owner, rgw_bucket& bucket, int obj_delta, uint64_t added_bytes, uint64_t removed_bytes) = 0;
 
-  static RGWQuotaHandler *generate_handler(rgw::sal::RGWRadosStore *store, bool quota_threads);
+  static RGWQuotaHandler *generate_handler(rgw::sal::RGWStore *store, bool quota_threads);
   static void free_handler(RGWQuotaHandler *handler);
 };
 
index 97c968ea793ce4193d11d865582411f0424d1aed..c8932c748aa1c8d7967d03a82acda8c88ba450f9 100644 (file)
@@ -602,14 +602,14 @@ public:
   int process() override {
     list<RGWCoroutinesStack*> stacks;
     auto meta = new RGWCoroutinesStack(store->ctx(), &crs);
-    meta->call(create_meta_log_trim_cr(this, store, &http,
+    meta->call(create_meta_log_trim_cr(this, static_cast<rgw::sal::RGWRadosStore*>(store), &http,
                                        cct->_conf->rgw_md_log_max_shards,
                                        trim_interval));
     stacks.push_back(meta);
 
     if (store->svc()->zone->sync_module_exports_data()) {
       auto data = new RGWCoroutinesStack(store->ctx(), &crs);
-      data->call(create_data_log_trim_cr(store, &http,
+      data->call(create_data_log_trim_cr(static_cast<rgw::sal::RGWRadosStore*>(store), &http,
                                          cct->_conf->rgw_data_log_num_shards,
                                          trim_interval));
       stacks.push_back(data);
index debd342725a1bb1ceec3a2d93b76de9893d89ec3..f4564104c4b105e7c4e9aa0ae2d17f2799608d9b 100644 (file)
@@ -225,20 +225,20 @@ public:
 };
 
 class RGWObjectCtx {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   ceph::shared_mutex lock = ceph::make_shared_mutex("RGWObjectCtx");
   void *s{nullptr};
 
   std::map<rgw_obj, RGWObjState> objs_state;
 public:
-  explicit RGWObjectCtx(rgw::sal::RGWRadosStore *_store) : store(_store) {}
-  explicit RGWObjectCtx(rgw::sal::RGWRadosStore *_store, void *_s) : store(_store), s(_s) {}
+  explicit RGWObjectCtx(rgw::sal::RGWStore *_store) : store(_store) {}
+  explicit RGWObjectCtx(rgw::sal::RGWStore *_store, void *_s) : store(_store), s(_s) {}
 
   void *get_private() {
     return s;
   }
 
-  rgw::sal::RGWRadosStore *get_store() {
+  rgw::sal::RGWStore *get_store() {
     return store;
   }
 
@@ -342,35 +342,10 @@ class RGWMetaSyncStatusManager;
 class RGWDataSyncStatusManager;
 class RGWCoroutinesManagerRegistry;
 
-class RGWGetBucketStats_CB : public RefCountedObject {
-protected:
-  rgw_bucket bucket;
-  map<RGWObjCategory, RGWStorageStats> *stats;
-public:
-  explicit RGWGetBucketStats_CB(const rgw_bucket& _bucket) : bucket(_bucket), stats(NULL) {}
-  ~RGWGetBucketStats_CB() override {}
-  virtual void handle_response(int r) = 0;
-  virtual void set_response(map<RGWObjCategory, RGWStorageStats> *_stats) {
-    stats = _stats;
-  }
-};
-
-class RGWGetUserStats_CB : public RefCountedObject {
-protected:
-  rgw_user user;
-  RGWStorageStats stats;
-public:
-  explicit RGWGetUserStats_CB(const rgw_user& _user) : user(_user) {}
-  ~RGWGetUserStats_CB() override {}
-  virtual void handle_response(int r) = 0;
-  virtual void set_response(RGWStorageStats& _stats) {
-    stats = _stats;
-  }
-};
-
 class RGWGetDirHeader_CB;
 class RGWGetUserHeader_CB;
 namespace rgw { namespace sal {
+  class RGWStore;
   class RGWRadosStore;
   class MPRadosSerializer;
   class LCRadosSerializer;
index 1487eb8c9149e1c3c820769817389918c0709aee..1721036388f64250ce95ebf9b7b994ee02c819f0 100644 (file)
@@ -26,7 +26,7 @@
 static constexpr bool USE_SAFE_TIMER_CALLBACKS = false;
 
 
-RGWRealmReloader::RGWRealmReloader(rgw::sal::RGWRadosStore*& store, std::map<std::string, std::string>& service_map_meta,
+RGWRealmReloader::RGWRealmReloader(rgw::sal::RGWStore*& store, std::map<std::string, std::string>& service_map_meta,
                                    Pauser* frontends)
   : store(store),
     service_map_meta(service_map_meta),
@@ -107,6 +107,7 @@ void RGWRealmReloader::reload()
     // recreate and initialize a new store
     store =
       RGWStoreManager::get_storage(&dp, cct,
+                                  "rados",
                                   cct->_conf->rgw_enable_gc_threads,
                                   cct->_conf->rgw_enable_lc_threads,
                                   cct->_conf->rgw_enable_quota_threads,
@@ -116,7 +117,7 @@ void RGWRealmReloader::reload()
 
     ldout(cct, 1) << "Creating new store" << dendl;
 
-    rgw::sal::RGWRadosStore* store_cleanup = nullptr;
+    rgw::sal::RGWStore* store_cleanup = nullptr;
     {
       std::unique_lock lock{mutex};
 
@@ -153,7 +154,7 @@ void RGWRealmReloader::reload()
     }
   }
 
-  int r = store->getRados()->register_to_service_map("rgw", service_map_meta);
+  int r = store->register_to_service_map("rgw", service_map_meta);
   if (r < 0) {
     lderr(cct) << "ERROR: failed to register to service map: " << cpp_strerror(-r) << dendl;
 
@@ -163,9 +164,9 @@ void RGWRealmReloader::reload()
   ldout(cct, 1) << "Finishing initialization of new store" << dendl;
   // finish initializing the new store
   ldout(cct, 1) << " - REST subsystem init" << dendl;
-  rgw_rest_init(cct, store->svc()->zone->get_zonegroup());
+  rgw_rest_init(cct, store->get_zonegroup());
   ldout(cct, 1) << " - usage subsystem init" << dendl;
-  rgw_log_usage_init(cct, store->getRados());
+  rgw_log_usage_init(cct, store);
 
   ldout(cct, 1) << "Resuming frontends with new realm configuration." << dendl;
 
index ac14eec2ba61225a4db6bb6609e228f8547b2916..08c441b68fa6499c37388a0e3dec81adf1d66762 100644 (file)
@@ -9,7 +9,7 @@
 
 namespace rgw {
 namespace sal {
-class RGWRadosStore;
+class RGWStore;
 }
 }
 
@@ -33,10 +33,10 @@ class RGWRealmReloader : public RGWRealmWatcher::Watcher {
     /// pause all frontends while realm reconfiguration is in progress
     virtual void pause() = 0;
     /// resume all frontends with the given RGWRados instance
-    virtual void resume(rgw::sal::RGWRadosStore* store) = 0;
+    virtual void resume(rgw::sal::RGWStore* store) = 0;
   };
 
-  RGWRealmReloader(rgw::sal::RGWRadosStore*& store, std::map<std::string, std::string>& service_map_meta,
+  RGWRealmReloader(rgw::sal::RGWStore*& store, std::map<std::string, std::string>& service_map_meta,
                    Pauser* frontends);
   ~RGWRealmReloader() override;
 
@@ -49,8 +49,8 @@ class RGWRealmReloader : public RGWRealmWatcher::Watcher {
 
   class C_Reload; //< Context that calls reload()
 
-  /// main()'s RGWRadosStore pointer as a reference, modified by reload()
-  rgw::sal::RGWRadosStore*& store;
+  /// main()'s RGWStore pointer as a reference, modified by reload()
+  rgw::sal::RGWStore*& store;
   std::map<std::string, std::string>& service_map_meta;
   Pauser *const frontends;
 
index 555e589d25df31db1383785804ebe7866406426a..a8fb3262ce45b451dcc236ce0d2c40fcadfac547 100644 (file)
@@ -1849,9 +1849,9 @@ int RGWHandler_REST::init_permissions(RGWOp* op, optional_yield y)
     // We don't need user policies in case of STS token returned by AssumeRole, hence the check for user type
     if (! s->user->get_id().empty() && s->auth.identity->get_identity_type() != TYPE_ROLE) {
       try {
-        map<string, bufferlist> uattrs;
-        if (auto ret = store->ctl()->user->get_attrs_by_uid(s, s->user->get_id(), &uattrs, y); ! ret) {
-          auto user_policies = get_iam_user_policy_from_attr(s->cct, store, uattrs, s->user->get_tenant());
+       rgw::sal::RGWAttrs uattrs;
+        if (auto ret = s->user->read_attrs(s, y, &uattrs); ! ret) {
+          auto user_policies = get_iam_user_policy_from_attr(s->cct, uattrs, s->user->get_tenant());
           s->iam_user_policies.insert(s->iam_user_policies.end(),
                                       std::make_move_iterator(user_policies.begin()),
                                       std::make_move_iterator(user_policies.end()));
@@ -2271,7 +2271,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio)
 }
 
 RGWHandler_REST* RGWREST::get_handler(
-  rgw::sal::RGWRadosStore * const store,
+  rgw::sal::RGWStore * const store,
   struct req_state* const s,
   const rgw::auth::StrategyRegistry& auth_registry,
   const std::string& frontend_prefix,
index 0d6b67bbb41ea8e962448cb534905a5597788f17..b2c6ed00e8b68e9e0f89711f98fa7516278e8083 100644 (file)
@@ -162,7 +162,7 @@ protected:
 public:
   RGWGetObj_ObjStore() : sent_header(false) {}
 
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
+  void init(rgw::sal::RGWStore *store, struct req_state *s, RGWHandler *h) override {
     RGWGetObj::init(store, s, h);
     sent_header = false;
   }
@@ -544,7 +544,7 @@ class RGWRESTOp : public RGWOp {
 protected:
   RGWRESTFlusher flusher;
 public:
-  void init(rgw::sal::RGWRadosStore *store, struct req_state *s,
+  void init(rgw::sal::RGWStore *store, struct req_state *s,
             RGWHandler *dialect_handler) override {
     RGWOp::init(store, s, dialect_handler);
     flusher.init(s, this);
@@ -637,7 +637,7 @@ public:
   }
 
   virtual RGWHandler_REST* get_handler(
-    rgw::sal::RGWRadosStore *store,
+    rgw::sal::RGWStore *store,
     struct req_state* const s,
     const rgw::auth::StrategyRegistry& auth_registry,
     const std::string& frontend_prefix
@@ -669,7 +669,7 @@ class RGWREST {
   static int preprocess(struct req_state *s, rgw::io::BasicClient* rio);
 public:
   RGWREST() {}
-  RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST *get_handler(rgw::sal::RGWStore *store,
                                struct req_state *s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix,
index cae41d31e0e0f5922e157cd8cf21fcbe657ef6df..ba58b24af066fda686b54a91cacbc10b0070c9f1 100644 (file)
@@ -4,7 +4,7 @@
 #include "rgw_op.h"
 #include "rgw_bucket.h"
 #include "rgw_rest_bucket.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 #include "include/str_list.h"
 
@@ -255,8 +255,8 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y)
   }
   rgw_user uid(uid_str);
   bool bucket_arg_existed = false;
-  std::string bucket;
-  RESTArgs::get_string(s, "bucket", bucket, &bucket, &bucket_arg_existed);
+  std::string bucket_name;
+  RESTArgs::get_string(s, "bucket", bucket_name, &bucket_name, &bucket_arg_existed);
   if (! bucket_arg_existed) {
     op_ret = -EINVAL;
     return;
@@ -282,13 +282,12 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y)
     }
   }
   if (use_http_params) {
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
-    op_ret = store->getRados()->get_bucket_info(store->svc(), uid.tenant, bucket, bucket_info, NULL, s->yield, s, &attrs);
+    std::unique_ptr<rgw::sal::RGWBucket> bucket;
+    op_ret = store->get_bucket(s, nullptr, uid.tenant, bucket_name, &bucket, s->yield);
     if (op_ret < 0) {
       return;
     }
-    RGWQuotaInfo *old_quota = &bucket_info.quota;
+    RGWQuotaInfo *old_quota = &bucket->get_info().quota;
     int64_t old_max_size_kb = rgw_rounded_kb(old_quota->max_size);
     int64_t max_size_kb;
     RESTArgs::get_int64(s, "max-objects", old_quota->max_objects, &quota.max_objects);
@@ -299,7 +298,7 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y)
 
   RGWBucketAdminOpState op_state;
   op_state.set_user_id(uid);
-  op_state.set_bucket_name(bucket);
+  op_state.set_bucket_name(bucket_name);
   op_state.set_quota(quota);
 
   op_ret = RGWBucketAdminOp::set_quota(store, op_state, s);
index 5220546be2e4273c807b5fc9da7e8a77e4838b5c..e0d45e31c41b8a8efc80d0cf3a758a8cd906760a 100644 (file)
@@ -27,7 +27,7 @@ public:
   RGWRESTMgr_Bucket() = default;
   ~RGWRESTMgr_Bucket() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string&) override {
index 9d906ec4c7bbcf369a447ec792af9938287f0848..446e2792eb003024ac9088ba376854c9a6df16ec 100644 (file)
@@ -31,7 +31,7 @@
 #define dout_subsys ceph_subsys_rgw
 
 void RGWOp_ZoneGroupMap_Get::execute(optional_yield y) {
-  op_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj, y);
+  op_ret = zonegroup_map.read(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, y);
   if (op_ret < 0) {
     dout(5) << "failed to read zone_group map" << dendl;
   }
@@ -59,7 +59,7 @@ void RGWOp_ZoneGroupMap_Get::send_response() {
 }
 
 void RGWOp_ZoneConfig_Get::send_response() {
-  const RGWZoneParams& zone_params = store->svc()->zone->get_zone_params();
+  const RGWZoneParams& zone_params = store->get_zone_params();
 
   set_req_state_err(s, op_ret);
   dump_errno(s);
index f21101a17765e6e32cc05c158c453df919b9ad04..7dbaddda5a000420fb3cb5b18346385d9c5ae56c 100644 (file)
@@ -79,7 +79,7 @@ public:
   RGWRESTMgr_Config() = default;
   ~RGWRESTMgr_Config() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string&) override {
index 3ee9183944c8f70b6f49d3814edd978488384eea..82e35c2514eb1369ac3c9ed6bde447f3edbe2dcf 100644 (file)
@@ -24,6 +24,20 @@ RGWRESTConn::RGWRESTConn(CephContext *_cct, RGWSI_Zone *zone_svc,
   }
 }
 
+RGWRESTConn::RGWRESTConn(CephContext *_cct, rgw::sal::RGWStore* store,
+                         const string& _remote_id,
+                         const list<string>& remote_endpoints,
+                         HostStyle _host_style)
+  : cct(_cct),
+    endpoints(remote_endpoints.begin(), remote_endpoints.end()),
+    remote_id(_remote_id), host_style(_host_style)
+{
+  if (store) {
+    key = store->get_zone_params().system_key;
+    self_zone_group = store->get_zonegroup().get_id();
+  }
+}
+
 RGWRESTConn::RGWRESTConn(CephContext *_cct, RGWSI_Zone *zone_svc,
                          const string& _remote_id,
                          const list<string>& remote_endpoints,
@@ -39,6 +53,21 @@ RGWRESTConn::RGWRESTConn(CephContext *_cct, RGWSI_Zone *zone_svc,
   }
 }
 
+RGWRESTConn::RGWRESTConn(CephContext *_cct, rgw::sal::RGWStore* store,
+                         const string& _remote_id,
+                         const list<string>& remote_endpoints,
+                         RGWAccessKey _cred,
+                         HostStyle _host_style)
+  : cct(_cct),
+    endpoints(remote_endpoints.begin(), remote_endpoints.end()),
+    key(std::move(_cred)),
+    remote_id(_remote_id), host_style(_host_style)
+{
+  if (store) {
+    self_zone_group = store->get_zonegroup().get_id();
+  }
+}
+
 RGWRESTConn::RGWRESTConn(RGWRESTConn&& other)
   : cct(other.cct),
     endpoints(std::move(other.endpoints)),
index b4fac21391b743a26716a3790a78b377ba2b5318..2afa0943a4fddab0c2f75daa11eb99d71ab2c7ae 100644 (file)
 
 #include <atomic>
 
+namespace rgw { namespace sal {
+  class RGWStore;
+} }
+
 class RGWSI_Zone;
 
 template <class T>
@@ -77,7 +81,9 @@ class RGWRESTConn
 public:
 
   RGWRESTConn(CephContext *_cct, RGWSI_Zone *zone_svc, const string& _remote_id, const list<string>& endpoints, HostStyle _host_style = PathStyle);
+  RGWRESTConn(CephContext *_cct, rgw::sal::RGWStore* store, const string& _remote_id, const list<string>& endpoints, HostStyle _host_style = PathStyle);
   RGWRESTConn(CephContext *_cct, RGWSI_Zone *zone_svc, const string& _remote_id, const list<string>& endpoints, RGWAccessKey _cred, HostStyle _host_style = PathStyle);
+  RGWRESTConn(CephContext *_cct, rgw::sal::RGWStore* store, const string& _remote_id, const list<string>& endpoints, RGWAccessKey _cred, HostStyle _host_style = PathStyle);
 
   // custom move needed for atomic
   RGWRESTConn(RGWRESTConn&& other);
@@ -199,8 +205,14 @@ public:
   S3RESTConn(CephContext *_cct, RGWSI_Zone *svc_zone, const string& _remote_id, const list<string>& endpoints, HostStyle _host_style = PathStyle) :
     RGWRESTConn(_cct, svc_zone, _remote_id, endpoints, _host_style) {}
 
+  S3RESTConn(CephContext *_cct, rgw::sal::RGWStore* store, const string& _remote_id, const list<string>& endpoints, HostStyle _host_style = PathStyle) :
+    RGWRESTConn(_cct, store, _remote_id, endpoints, _host_style) {}
+
   S3RESTConn(CephContext *_cct, RGWSI_Zone *svc_zone, const string& _remote_id, const list<string>& endpoints, RGWAccessKey _cred, HostStyle _host_style = PathStyle):
     RGWRESTConn(_cct, svc_zone, _remote_id, endpoints, _cred, _host_style) {}
+
+  S3RESTConn(CephContext *_cct, rgw::sal::RGWStore* store, const string& _remote_id, const list<string>& endpoints, RGWAccessKey _cred, HostStyle _host_style = PathStyle):
+    RGWRESTConn(_cct, store, _remote_id, endpoints, _cred, _host_style) {}
   ~S3RESTConn() override = default;
 
   void populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup) override {
index 4624cff90fe2f366f45c484dba46df025988abab..557b1922e870257e5c537063069d2e99ff39ee70 100644 (file)
@@ -82,7 +82,7 @@ RGWOp *RGWHandler_REST_IAM::op_post()
   return nullptr;
 }
 
-int RGWHandler_REST_IAM::init(rgw::sal::RGWRadosStore *store,
+int RGWHandler_REST_IAM::init(rgw::sal::RGWStore *store,
                               struct req_state *s,
                               rgw::io::BasicClient *cio)
 {
@@ -144,7 +144,7 @@ int RGWHandler_REST_IAM::init_from_header(struct req_state* s,
 }
 
 RGWHandler_REST*
-RGWRESTMgr_IAM::get_handler(rgw::sal::RGWRadosStore *store,
+RGWRESTMgr_IAM::get_handler(rgw::sal::RGWStore *store,
                            struct req_state* const s,
                            const rgw::auth::StrategyRegistry& auth_registry,
                            const std::string& frontend_prefix)
index 6b3518c2dc58b6930df622fc8a1dea96a3eee774..bde9017cbf390439cca6329e49efa9f53151c41d 100644 (file)
@@ -22,7 +22,7 @@ public:
       post_body(post_body) {}
   ~RGWHandler_REST_IAM() override = default;
 
-  int init(rgw::sal::RGWRadosStore *store,
+  int init(rgw::sal::RGWStore *store,
            struct req_state *s,
            rgw::io::BasicClient *cio) override;
   int authorize(const DoutPrefixProvider* dpp, optional_yield y) override;
@@ -40,7 +40,7 @@ public:
     return this;
   }
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry&,
                                const std::string&) override;
index 7c3540ce64cc4ac0fd6d09dd7774f9bf1c6b2a6f..2a6b59b29dd7999e901a1c5cd13c2e55e1c96fc3 100644 (file)
@@ -74,7 +74,7 @@ void RGWOp_MDLog_List::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = store->svc()->zone->get_current_period_id();
+    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
     if (period.empty()) {
       ldout(s->cct, 5) << "Missing period id" << dendl;
       op_ret = -EINVAL;
@@ -82,7 +82,7 @@ void RGWOp_MDLog_List::execute(optional_yield y) {
     }
   }
 
-  RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period};
+  RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls, period};
 
   meta_log.init_list_entries(shard_id, {}, {}, marker, &handle);
 
@@ -108,7 +108,7 @@ void RGWOp_MDLog_List::send_response() {
     for (list<cls_log_entry>::iterator iter = entries.begin();
         iter != entries.end(); ++iter) {
       cls_log_entry& entry = *iter;
-      store->ctl()->meta.mgr->dump_log_entry(entry, s->formatter);
+      static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->dump_log_entry(entry, s->formatter);
       flusher.flush();
     }
     s->formatter->close_section();
@@ -119,7 +119,7 @@ void RGWOp_MDLog_List::send_response() {
 
 void RGWOp_MDLog_Info::execute(optional_yield y) {
   num_objects = s->cct->_conf->rgw_md_log_max_shards;
-  period = store->svc()->mdlog->read_oldest_log_period(y, s);
+  period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->mdlog->read_oldest_log_period(y, s);
   op_ret = period.get_error();
 }
 
@@ -152,7 +152,7 @@ void RGWOp_MDLog_ShardInfo::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = store->svc()->zone->get_current_period_id();
+    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
 
     if (period.empty()) {
       ldout(s->cct, 5) << "Missing period id" << dendl;
@@ -160,7 +160,7 @@ void RGWOp_MDLog_ShardInfo::execute(optional_yield y) {
       return;
     }
   }
-  RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period};
+  RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls, period};
 
   op_ret = meta_log.get_info(shard_id, &info);
 }
@@ -218,7 +218,7 @@ void RGWOp_MDLog_Delete::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = store->svc()->zone->get_current_period_id();
+    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
 
     if (period.empty()) {
       ldout(s->cct, 5) << "Missing period id" << dendl;
@@ -226,7 +226,7 @@ void RGWOp_MDLog_Delete::execute(optional_yield y) {
       return;
     }
   }
-  RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period};
+  RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls, period};
 
   op_ret = meta_log.trim(shard_id, {}, {}, {}, marker);
 }
@@ -245,7 +245,7 @@ void RGWOp_MDLog_Lock::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = store->svc()->zone->get_current_period_id();
+    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
   }
 
   if (period.empty() ||
@@ -266,7 +266,7 @@ void RGWOp_MDLog_Lock::execute(optional_yield y) {
     return;
   }
 
-  RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period};
+  RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls, period};
   unsigned dur;
   dur = (unsigned)strict_strtol(duration_str.c_str(), 10, &err);
   if (!err.empty() || dur <= 0) {
@@ -293,7 +293,7 @@ void RGWOp_MDLog_Unlock::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = store->svc()->zone->get_current_period_id();
+    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
   }
 
   if (period.empty() ||
@@ -313,7 +313,7 @@ void RGWOp_MDLog_Unlock::execute(optional_yield y) {
     return;
   }
 
-  RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period};
+  RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls, period};
   op_ret = meta_log.unlock(shard_id, zone_id, locker_id);
 }
 
@@ -354,7 +354,7 @@ void RGWOp_MDLog_Notify::execute(optional_yield y) {
     }
   }
 
-  store->getRados()->wakeup_meta_sync_shards(updated_shards);
+  store->wakeup_meta_sync_shards(updated_shards);
 
   op_ret = 0;
 }
@@ -365,7 +365,8 @@ void RGWOp_BILog_List::execute(optional_yield y) {
          marker = s->info.args.get("marker"),
          max_entries_str = s->info.args.get("max-entries"),
          bucket_instance = s->info.args.get("bucket-instance");
-  RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name));
   unsigned max_entries;
 
   if (bucket_name.empty() && bucket_instance.empty()) {
@@ -382,18 +383,13 @@ void RGWOp_BILog_List::execute(optional_yield y) {
   }
 
   if (!bucket_instance.empty()) {
-    rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
-    op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield, s);
-    if (op_ret < 0) {
-      ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
-      return;
-    }
-  } else { /* !bucket_name.empty() */
-    op_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL);
-    if (op_ret < 0) {
-      ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
-      return;
-    }
+    b.name = bn;
+    b.bucket_id = bucket_instance;
+  }
+  op_ret = store->get_bucket(s, nullptr, b, &bucket, y);
+  if (op_ret < 0) {
+    ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
+    return;
   }
 
   bool truncated;
@@ -407,7 +403,7 @@ void RGWOp_BILog_List::execute(optional_yield y) {
   send_response();
   do {
     list<rgw_bi_log_entry> entries;
-    int ret = store->svc()->bilog_rados->log_list(bucket_info, shard_id,
+    int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->log_list(bucket->get_info(), shard_id,
                                                marker, max_entries - count, 
                                                entries, &truncated);
     if (ret < 0) {
@@ -459,7 +455,8 @@ void RGWOp_BILog_Info::execute(optional_yield y) {
   string tenant_name = s->info.args.get("tenant"),
          bucket_name = s->info.args.get("bucket"),
          bucket_instance = s->info.args.get("bucket-instance");
-  RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name));
 
   if (bucket_name.empty() && bucket_instance.empty()) {
     ldpp_dout(s, 5) << "ERROR: neither bucket nor bucket instance specified" << dendl;
@@ -475,21 +472,17 @@ void RGWOp_BILog_Info::execute(optional_yield y) {
   }
 
   if (!bucket_instance.empty()) {
-    rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
-    op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield, s);
-    if (op_ret < 0) {
-      ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
-      return;
-    }
-  } else { /* !bucket_name.empty() */
-    op_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL);
-    if (op_ret < 0) {
-      ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
-      return;
-    }
+    b.name = bn;
+    b.bucket_id = bucket_instance;
+  }
+  op_ret = store->get_bucket(s, nullptr, b, &bucket, y);
+  if (op_ret < 0) {
+    ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
+    return;
   }
+
   map<RGWObjCategory, RGWStorageStats> stats;
-  int ret =  store->getRados()->get_bucket_stats(bucket_info, shard_id, &bucket_ver, &master_ver, stats, &max_marker, &syncstopped);
+  int ret =  bucket->get_bucket_stats(shard_id, &bucket_ver, &master_ver, stats, &max_marker, &syncstopped);
   if (ret < 0 && ret != -ENOENT) {
     op_ret = ret;
     return;
@@ -521,7 +514,8 @@ void RGWOp_BILog_Delete::execute(optional_yield y) {
          end_marker = s->info.args.get("end-marker"),
          bucket_instance = s->info.args.get("bucket-instance");
 
-  RGWBucketInfo bucket_info;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name));
 
   op_ret = 0;
   if ((bucket_name.empty() && bucket_instance.empty()) ||
@@ -539,20 +533,16 @@ void RGWOp_BILog_Delete::execute(optional_yield y) {
   }
 
   if (!bucket_instance.empty()) {
-    rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
-    op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield, s);
-    if (op_ret < 0) {
-      ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
-      return;
-    }
-  } else { /* !bucket_name.empty() */
-    op_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL);
-    if (op_ret < 0) {
-      ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
-      return;
-    }
+    b.name = bn;
+    b.bucket_id = bucket_instance;
+  }
+  op_ret = store->get_bucket(s, nullptr, b, &bucket, y);
+  if (op_ret < 0) {
+    ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
+    return;
   }
-  op_ret = store->svc()->bilog_rados->log_trim(bucket_info, shard_id, start_marker, end_marker);
+
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->bilog_rados->log_trim(bucket->get_info(), shard_id, start_marker, end_marker);
   if (op_ret < 0) {
     ldpp_dout(s, 5) << "ERROR: trim_bi_log_entries() " << dendl;
   }
@@ -596,7 +586,7 @@ void RGWOp_DATALog_List::execute(optional_yield y) {
 
   // Note that last_marker is updated to be the marker of the last
   // entry listed
-  op_ret = store->svc()->datalog_rados->list_entries(shard_id,
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados->list_entries(shard_id,
                                                     max_entries, entries,
                                                     marker, &last_marker,
                                                     &truncated);
@@ -657,7 +647,7 @@ void RGWOp_DATALog_ShardInfo::execute(optional_yield y) {
     return;
   }
 
-  op_ret = store->svc()->datalog_rados->get_info(shard_id, &info);
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados->get_info(shard_id, &info);
 }
 
 void RGWOp_DATALog_ShardInfo::send_response() {
@@ -711,7 +701,7 @@ void RGWOp_DATALog_Notify::execute(optional_yield y) {
     }
   }
 
-  store->getRados()->wakeup_data_sync_shards(source_zone, updated_shards);
+  store->wakeup_data_sync_shards(source_zone, updated_shards);
 
   op_ret = 0;
 }
@@ -755,7 +745,7 @@ void RGWOp_DATALog_Delete::execute(optional_yield y) {
     return;
   }
 
-  op_ret = store->svc()->datalog_rados->trim_entries(shard_id, marker);
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->datalog_rados->trim_entries(shard_id, marker);
 }
 
 // not in header to avoid pulling in rgw_sync.h
@@ -775,7 +765,7 @@ public:
 
 void RGWOp_MDLog_Status::execute(optional_yield y)
 {
-  auto sync = store->getRados()->get_meta_sync_manager();
+  auto sync = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_meta_sync_manager();
   if (sync == nullptr) {
     ldout(s->cct, 1) << "no sync manager" << dendl;
     op_ret = -ENOENT;
@@ -827,9 +817,9 @@ void RGWOp_BILog_Status::execute(optional_yield y)
     return;
   }
 
-  rgw_bucket bucket;
+  rgw_bucket b;
   int shard_id{-1}; // unused
-  op_ret = rgw_bucket_parse_bucket_key(s->cct, key, &bucket, &shard_id);
+  op_ret = rgw_bucket_parse_bucket_key(s->cct, key, &b, &shard_id);
   if (op_ret < 0) {
     ldpp_dout(s, 4) << "invalid 'bucket' provided" << dendl;
     op_ret = -EINVAL;
@@ -837,9 +827,8 @@ void RGWOp_BILog_Status::execute(optional_yield y)
   }
 
   // read the bucket instance info for num_shards
-  auto ctx = store->svc()->sysobj->init_obj_ctx();
-  RGWBucketInfo info;
-  op_ret = store->getRados()->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr, s->yield, s);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  op_ret = store->get_bucket(s, nullptr, b, &bucket, y);
   if (op_ret < 0) {
     ldpp_dout(s, 4) << "failed to read bucket info: " << cpp_strerror(op_ret) << dendl;
     return;
@@ -849,7 +838,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
 
   if (source_key.empty() ||
       source_key == key) {
-    source_bucket = info.bucket;
+    source_bucket = bucket->get_key();
   } else {
     op_ret = rgw_bucket_parse_bucket_key(s->cct, source_key, &source_bucket, nullptr);
     if (op_ret < 0) {
@@ -858,18 +847,18 @@ void RGWOp_BILog_Status::execute(optional_yield y)
     }
   }
 
-  const auto& local_zone_id = store->svc()->zone->zone_id();
+  const auto& local_zone_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->zone_id();
 
   if (!merge) {
     rgw_sync_bucket_pipe pipe;
     pipe.source.zone = source_zone;
     pipe.source.bucket = source_bucket;
     pipe.dest.zone = local_zone_id;
-    pipe.dest.bucket = info.bucket;
+    pipe.dest.bucket = bucket->get_key();
 
     ldout(s->cct, 20) << "RGWOp_BILog_Status::execute(optional_yield y): getting sync status for pipe=" << pipe << dendl;
 
-    op_ret = rgw_bucket_sync_status(this, store, pipe, info, nullptr, &status);
+    op_ret = rgw_bucket_sync_status(this, static_cast<rgw::sal::RGWRadosStore*>(store), pipe, bucket->get_info(), nullptr, &status);
 
     if (op_ret < 0) {
       lderr(s->cct) << "ERROR: rgw_bucket_sync_status() on pipe=" << pipe << " returned ret=" << op_ret << dendl;
@@ -880,7 +869,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
   rgw_zone_id source_zone_id(source_zone);
 
   RGWBucketSyncPolicyHandlerRef source_handler;
-  op_ret = store->ctl()->bucket->get_sync_policy_handler(source_zone_id, source_bucket, &source_handler, y, s);
+  op_ret = store->get_sync_policy_handler(s, source_zone_id, source_bucket, &source_handler, y);
   if (op_ret < 0) {
     lderr(s->cct) << "could not get bucket sync policy handler (r=" << op_ret << ")" << dendl;
     return;
@@ -894,7 +883,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
 
     ldout(s->cct, 20) << "RGWOp_BILog_Status::execute(optional_yield y): getting sync status for pipe=" << pipe << dendl;
 
-    RGWBucketInfo *pinfo = &info;
+    RGWBucketInfo *pinfo = &bucket->get_info();
     std::optional<RGWBucketInfo> opt_dest_info;
 
     if (!pipe.dest.bucket) {
@@ -904,26 +893,21 @@ void RGWOp_BILog_Status::execute(optional_yield y)
       return;
     }
 
-    if (*pipe.dest.bucket != info.bucket) {
+    if (*pipe.dest.bucket != pinfo->bucket) {
       opt_dest_info.emplace();
-      pinfo = &(*opt_dest_info);
-
-      /* dest bucket might not have a bucket id */
-      op_ret = store->ctl()->bucket->read_bucket_info(*pipe.dest.bucket,
-                                                        pinfo,
-                                                        s->yield,
-                                                        s,
-                                                        RGWBucketCtl::BucketInstance::GetParams(),
-                                                        nullptr);
+      std::unique_ptr<rgw::sal::RGWBucket> dest_bucket;
+      op_ret = store->get_bucket(s, nullptr, *pipe.dest.bucket, &dest_bucket, y);
       if (op_ret < 0) {
         ldpp_dout(s, 4) << "failed to read target bucket info (bucket=: " << cpp_strerror(op_ret) << dendl;
         return;
       }
 
+      *opt_dest_info = dest_bucket->get_info();
+      pinfo = &(*opt_dest_info);
       pipe.dest.bucket = pinfo->bucket;
     }
 
-    int r = rgw_bucket_sync_status(this, store, pipe, *pinfo, &info, &current_status);
+    int r = rgw_bucket_sync_status(this, static_cast<rgw::sal::RGWRadosStore*>(store), pipe, *pinfo, &bucket->get_info(), &current_status);
     if (r < 0) {
       lderr(s->cct) << "ERROR: rgw_bucket_sync_status() on pipe=" << pipe << " returned ret=" << r << dendl;
       op_ret = r;
@@ -981,7 +965,7 @@ public:
 void RGWOp_DATALog_Status::execute(optional_yield y)
 {
   const auto source_zone = s->info.args.get("source-zone");
-  auto sync = store->getRados()->get_data_sync_manager(source_zone);
+  auto sync = store->get_data_sync_manager(source_zone);
   if (sync == nullptr) {
     ldout(s->cct, 1) << "no sync manager for source-zone " << source_zone << dendl;
     op_ret = -ENOENT;
index ad6abfd73845c49c3d6cb0af66da02278aaa8ca4..b316effb82a80cb2d1b6a333a3a5cd90f0eb6bc7 100644 (file)
@@ -301,7 +301,7 @@ public:
   RGWRESTMgr_Log() = default;
   ~RGWRESTMgr_Log() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state* const,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefixs) override {
index 07376bbe56960df2485be427d31dcb7623147d2a..226e649d56dd4bcb2acf38b6796fed4ea1ae4152 100644 (file)
@@ -54,7 +54,7 @@ void RGWOp_Metadata_Get::execute(optional_yield y) {
 
   frame_metadata_key(s, metadata_key);
 
-  auto meta_mgr = store->ctl()->meta.mgr;
+  auto meta_mgr = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr;
 
   /* Get keys */
   op_ret = meta_mgr->get(metadata_key, s->formatter, s->yield, s);
@@ -123,7 +123,7 @@ void RGWOp_Metadata_List::execute(optional_yield y) {
      marker = "3:bf885d8f:root::sorry_janefonda_665:head";
   */
 
-  op_ret = store->ctl()->meta.mgr->list_keys_init(metadata_key, marker, &handle);
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->list_keys_init(metadata_key, marker, &handle);
   if (op_ret < 0) {
     dout(5) << "ERROR: can't get key: " << cpp_strerror(op_ret) << dendl;
     return;
@@ -138,7 +138,7 @@ void RGWOp_Metadata_List::execute(optional_yield y) {
 
   s->formatter->open_array_section("keys");
 
-  auto meta_mgr = store->ctl()->meta.mgr;
+  auto meta_mgr = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr;
 
   uint64_t left;
   do {
@@ -263,7 +263,7 @@ void RGWOp_Metadata_Put::execute(optional_yield y) {
     }
   }
 
-  op_ret = store->ctl()->meta.mgr->put(metadata_key, bl, s->yield, s, sync_type,
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->put(metadata_key, bl, s->yield, s, sync_type,
                                       false, &ondisk_version);
   if (op_ret < 0) {
     ldpp_dout(s, 5) << "ERROR: can't put key: " << cpp_strerror(op_ret) << dendl;
@@ -294,7 +294,7 @@ void RGWOp_Metadata_Delete::execute(optional_yield y) {
   string metadata_key;
 
   frame_metadata_key(s, metadata_key);
-  op_ret = store->ctl()->meta.mgr->remove(metadata_key, s->yield, s);
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr->remove(metadata_key, s->yield, s);
   if (op_ret < 0) {
     ldpp_dout(s, 5) << "ERROR: can't remove key: " << cpp_strerror(op_ret) << dendl;
     return;
index 234ca5c3036393ebc4e0030cb7b90fb94fcaef30..7c4851d7f3ea417be654d099723a5381bbf5a92b 100644 (file)
@@ -98,7 +98,7 @@ public:
   RGWRESTMgr_Metadata() = default;
   ~RGWRESTMgr_Metadata() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state* const s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix) override {
index fcea7df4dc6a1e5a97511afb28150badd294bf79..7d2cea60fd1b6a7094861aca7353dfc08d7214eb 100644 (file)
@@ -16,7 +16,7 @@
 #include "rgw_role.h"
 #include "rgw_rest_oidc_provider.h"
 #include "rgw_oidc_provider.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 #define dout_subsys ceph_subsys_rgw
 
@@ -121,7 +121,7 @@ void RGWCreateOIDCProvider::execute(optional_yield y)
     return;
   }
 
-  RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_url,
+  RGWOIDCProvider provider(s->cct, store->get_ctl(), provider_url,
                             s->user->get_tenant(), client_ids, thumbprints);
   op_ret = provider.create(s, true, y);
 
@@ -140,7 +140,7 @@ void RGWCreateOIDCProvider::execute(optional_yield y)
 
 void RGWDeleteOIDCProvider::execute(optional_yield y)
 {
-  RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_arn, s->user->get_tenant());
+  RGWOIDCProvider provider(s->cct, store->get_ctl(), provider_arn, s->user->get_tenant());
   op_ret = provider.delete_obj(y);
 
   if (op_ret < 0 && op_ret != -ENOENT && op_ret != -EINVAL) {
@@ -158,7 +158,7 @@ void RGWDeleteOIDCProvider::execute(optional_yield y)
 
 void RGWGetOIDCProvider::execute(optional_yield y)
 {
-  RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_arn, s->user->get_tenant());
+  RGWOIDCProvider provider(s->cct, store->get_ctl(), provider_arn, s->user->get_tenant());
   op_ret = provider.get(s);
 
   if (op_ret < 0 && op_ret != -ENOENT && op_ret != -EINVAL) {
@@ -200,7 +200,7 @@ int RGWListOIDCProviders::verify_permission(optional_yield y)
 void RGWListOIDCProviders::execute(optional_yield y)
 {
   vector<RGWOIDCProvider> result;
-  op_ret = RGWOIDCProvider::get_providers(s, store->getRados(), s->user->get_tenant(), result);
+  op_ret = RGWOIDCProvider::get_providers(s, store, s->user->get_tenant(), result);
 
   if (op_ret == 0) {
     s->formatter->open_array_section("ListOpenIDConnectProvidersResponse");
index 17a75be0674a47a943d7b3ede821875d2de9cc10..ce59a39298fae64c97387728bf2a5cfeae08a95a 100644 (file)
@@ -69,7 +69,7 @@ public:
     dest.arn_topic = topic_name;
     // the topic ARN will be sent in the reply
     const rgw::ARN arn(rgw::Partition::aws, rgw::Service::sns, 
-        store->svc()->zone->get_zonegroup().get_name(),
+        store->get_zonegroup().get_name(),
         s->user->get_tenant(), topic_name);
     topic_arn = arn.to_string();
     return 0;
@@ -492,14 +492,14 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
     return;
   }
 
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto b = ps->get_bucket(bucket_info.bucket);
   ceph_assert(b);
   std::string data_bucket_prefix = "";
   std::string data_oid_prefix = "";
   bool push_only = true;
-  if (store->getRados()->get_sync_module()) {
-    const auto psmodule = dynamic_cast<RGWPSSyncModuleInstance*>(store->getRados()->get_sync_module().get());
+  if (static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module()) {
+    const auto psmodule = dynamic_cast<RGWPSSyncModuleInstance*>(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module().get());
     if (psmodule) {
       const auto& conf = psmodule->get_effective_conf();
       data_bucket_prefix = conf["data_bucket_prefix"];
@@ -635,7 +635,7 @@ void RGWPSDeleteNotif_ObjStore_S3::execute(optional_yield y) {
     return;
   }
 
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto b = ps->get_bucket(bucket_info.bucket);
   ceph_assert(b);
 
@@ -734,7 +734,7 @@ public:
 };
 
 void RGWPSListNotifs_ObjStore_S3::execute(optional_yield y) {
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto b = ps->get_bucket(bucket_info.bucket);
   ceph_assert(b);
   
index e94b7d44491a21d186d0f2e6f1ecc121f955ab06..545d202da626de1acfa4e3950fe63573623f4818 100644 (file)
@@ -53,7 +53,7 @@ void RGWPSCreateTopicOp::execute(optional_yield y) {
     return;
   }
 
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   op_ret = ps->create_topic(topic_name, dest, topic_arn, opaque_data, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to create topic '" << topic_name << "', ret=" << op_ret << dendl;
@@ -63,7 +63,7 @@ void RGWPSCreateTopicOp::execute(optional_yield y) {
 }
 
 void RGWPSListTopicsOp::execute(optional_yield y) {
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   op_ret = ps->get_topics(&result);
   // if there are no topics it is not considered an error
   op_ret = op_ret == -ENOENT ? 0 : op_ret;
@@ -84,7 +84,7 @@ void RGWPSGetTopicOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   op_ret = ps->get_topic(topic_name, &result);
   if (topic_has_endpoint_secret(result) && !rgw_transport_is_secure(s->cct, *(s->info.env))) {
     ldout(s->cct, 1) << "topic '" << topic_name << "' contain secret and cannot be sent over insecure transport" << dendl;
@@ -103,7 +103,7 @@ void RGWPSDeleteTopicOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   op_ret = ps->remove_topic(topic_name, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to remove topic '" << topic_name << ", ret=" << op_ret << dendl;
@@ -117,7 +117,7 @@ void RGWPSCreateSubOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto sub = ps->get_sub(sub_name);
   op_ret = sub->subscribe(topic_name, dest, y);
   if (op_ret < 0) {
@@ -132,7 +132,7 @@ void RGWPSGetSubOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto sub = ps->get_sub(sub_name);
   op_ret = sub->get_conf(&result);
   if (subscription_has_endpoint_secret(result) && !rgw_transport_is_secure(s->cct, *(s->info.env))) {
@@ -152,7 +152,7 @@ void RGWPSDeleteSubOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto sub = ps->get_sub(sub_name);
   op_ret = sub->unsubscribe(topic_name, y);
   if (op_ret < 0) {
@@ -167,7 +167,7 @@ void RGWPSAckSubEventOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto sub = ps->get_sub_with_events(sub_name);
   op_ret = sub->remove_event(s, event_id);
   if (op_ret < 0) {
@@ -182,7 +182,7 @@ void RGWPSPullSubEventsOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   sub = ps->get_sub_with_events(sub_name);
   if (!sub) {
     op_ret = -ENOENT;
@@ -204,16 +204,16 @@ int RGWPSCreateNotifOp::verify_permission(optional_yield y) {
     return ret;
   }
 
-  const auto& id = s->owner.get_id();
-
-  ret = store->getRados()->get_bucket_info(store->svc(), id.tenant, bucket_name,
-                               bucket_info, nullptr, y, nullptr);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(s->owner.get_id());
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  ret = store->get_bucket(this, user.get(), s->owner.get_id().tenant, bucket_name, &bucket, y);
   if (ret < 0) {
     ldout(s->cct, 1) << "failed to get bucket info, cannot verify ownership" << dendl;
     return ret;
   }
+  bucket_info = bucket->get_info();
 
-  if (bucket_info.owner != id) {
+  if (bucket_info.owner != s->owner.get_id()) {
     ldout(s->cct, 1) << "user doesn't own bucket, not allowed to create notification" << dendl;
     return -EPERM;
   }
@@ -226,11 +226,13 @@ int RGWPSDeleteNotifOp::verify_permission(optional_yield y) {
     return ret;
   }
 
-  ret = store->getRados()->get_bucket_info(store->svc(), s->owner.get_id().tenant, bucket_name,
-                               bucket_info, nullptr, y, nullptr);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(s->owner.get_id());
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  ret = store->get_bucket(this, user.get(), s->owner.get_id().tenant, bucket_name, &bucket, y);
   if (ret < 0) {
     return ret;
   }
+  bucket_info = bucket->get_info();
 
   if (bucket_info.owner != s->owner.get_id()) {
     ldout(s->cct, 1) << "user doesn't own bucket, cannot remove notification" << dendl;
@@ -245,11 +247,13 @@ int RGWPSListNotifsOp::verify_permission(optional_yield y) {
     return ret;
   }
 
-  ret = store->getRados()->get_bucket_info(store->svc(), s->owner.get_id().tenant, bucket_name,
-                               bucket_info, nullptr, y, nullptr);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(s->owner.get_id());
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  ret = store->get_bucket(this, user.get(), s->owner.get_id().tenant, bucket_name, &bucket, y);
   if (ret < 0) {
     return ret;
   }
+  bucket_info = bucket->get_info();
 
   if (bucket_info.owner != s->owner.get_id()) {
     ldout(s->cct, 1) << "user doesn't own bucket, cannot get notification list" << dendl;
index 773fd5f590c545a50c64a8150cc27b2e2e1bce7d..b48999c3826a231149f3cc2ab0d663dd6cbef910 100644 (file)
@@ -73,7 +73,7 @@ void RGWOp_Period_Get::execute(optional_yield y)
   period.set_id(period_id);
   period.set_epoch(epoch);
 
-  op_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, y, realm_name);
+  op_ret = period.init(store->ctx(), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm_id, y, realm_name);
   if (op_ret < 0)
     ldout(store->ctx(), 5) << "failed to read period" << dendl;
 }
@@ -96,7 +96,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   auto cct = store->ctx();
 
   // initialize the period without reading from rados
-  period.init(cct, store->svc()->sysobj, y, false);
+  period.init(cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, y, false);
 
   // decode the period from input
   const auto max_size = cct->_conf->rgw_max_put_param_size;
@@ -108,9 +108,9 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   // require period.realm_id to match our realm
-  if (period.get_realm() != store->svc()->zone->get_realm().get_id()) {
+  if (period.get_realm() != static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_realm().get_id()) {
     error_stream << "period with realm id " << period.get_realm()
-        << " doesn't match current realm " << store->svc()->zone->get_realm().get_id() << std::endl;
+        << " doesn't match current realm " << static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_realm().get_id() << std::endl;
     op_ret = -EINVAL;
     return;
   }
@@ -119,7 +119,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   // period that we haven't restarted with yet. we also don't want to modify
   // the objects in use by RGWRados
   RGWRealm realm(period.get_realm());
-  op_ret = realm.init(cct, store->svc()->sysobj, y);
+  op_ret = realm.init(cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, y);
   if (op_ret < 0) {
     lderr(cct) << "failed to read current realm: "
         << cpp_strerror(-op_ret) << dendl;
@@ -127,7 +127,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   RGWPeriod current_period;
-  op_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id(), y);
+  op_ret = current_period.init(cct, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, realm.get_id(), y);
   if (op_ret < 0) {
     lderr(cct) << "failed to read current period: "
         << cpp_strerror(-op_ret) << dendl;
@@ -144,7 +144,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   // if it's not period commit, nobody is allowed to push to the master zone
-  if (period.get_master_zone() == store->svc()->zone->get_zone_params().get_id()) {
+  if (period.get_master_zone() == store->get_zone_params().get_id()) {
     ldout(cct, 10) << "master zone rejecting period id="
         << period.get_id() << " epoch=" << period.get_epoch() << dendl;
     op_ret = -EINVAL; // XXX: error code
@@ -171,7 +171,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
     return;
   }
 
-  auto period_history = store->svc()->mdlog->get_period_history();
+  auto period_history = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->mdlog->get_period_history();
 
   // decide whether we can set_current_period() or set_latest_epoch()
   if (period.get_id() != current_period.get_id()) {
@@ -247,7 +247,7 @@ class RGWHandler_Period : public RGWHandler_Auth_S3 {
 
 class RGWRESTMgr_Period : public RGWRESTMgr {
  public:
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string&) override {
@@ -280,7 +280,7 @@ void RGWOp_Realm_Get::execute(optional_yield y)
 
   // read realm
   realm.reset(new RGWRealm(id, name));
-  op_ret = realm->init(g_ceph_context, store->svc()->sysobj, y);
+  op_ret = realm->init(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj, y);
   if (op_ret < 0)
     lderr(store->ctx()) << "failed to read realm id=" << id
         << " name=" << name << dendl;
@@ -321,10 +321,10 @@ void RGWOp_Realm_List::execute(optional_yield y)
 {
   {
     // read default realm
-    RGWRealm realm(store->ctx(), store->svc()->sysobj);
+    RGWRealm realm(store->ctx(), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj);
     [[maybe_unused]] int ret = realm.read_default_id(default_id, y);
   }
-  op_ret = store->svc()->zone->list_realms(realms);
+  op_ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->list_realms(realms);
   if (op_ret < 0)
     lderr(store->ctx()) << "failed to list realms" << dendl;
 }
@@ -364,7 +364,7 @@ RGWRESTMgr_Realm::RGWRESTMgr_Realm()
 }
 
 RGWHandler_REST*
-RGWRESTMgr_Realm::get_handler(rgw::sal::RGWRadosStore *store,
+RGWRESTMgr_Realm::get_handler(rgw::sal::RGWStore *store,
                              struct req_state*,
                               const rgw::auth::StrategyRegistry& auth_registry,
                               const std::string&)
index 84ee86b48ad919222e4db5763dd5cdb95308eedc..da8cdf8581429d25441e88b09122c931538cb68b 100644 (file)
@@ -9,7 +9,7 @@ class RGWRESTMgr_Realm : public RGWRESTMgr {
 public:
   RGWRESTMgr_Realm();
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string&) override;
index 0f66d54b83511fbc60f98137ef7864170bf16087..6693de0dbdf86b83d59c7ac27a21fd5c3f1867ad 100644 (file)
@@ -15,7 +15,7 @@
 #include "rgw_rest.h"
 #include "rgw_role.h"
 #include "rgw_rest_role.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 #define dout_subsys ceph_subsys_rgw
 
@@ -26,7 +26,7 @@ int RGWRestRole::verify_permission(optional_yield y)
   }
 
   string role_name = s->info.args.get("RoleName");
-  RGWRole role(s->cct, store->getRados()->pctl, role_name, s->user->get_tenant());
+  RGWRole role(s->cct, store->get_ctl(), role_name, s->user->get_tenant());
   if (op_ret = role.get(s, y); op_ret < 0) {
     if (op_ret == -ENOENT) {
       op_ret = -ERR_NO_ROLE_FOUND;
@@ -130,7 +130,7 @@ void RGWCreateRole::execute(optional_yield y)
   if (op_ret < 0) {
     return;
   }
-  RGWRole role(s->cct, store->getRados()->pctl, role_name, role_path, trust_policy,
+  RGWRole role(s->cct, store->get_ctl(), role_name, role_path, trust_policy,
                 s->user->get_tenant(), max_session_duration);
   op_ret = role.create(s, true, y);
 
@@ -229,7 +229,7 @@ void RGWGetRole::execute(optional_yield y)
   if (op_ret < 0) {
     return;
   }
-  RGWRole role(s->cct, store->getRados()->pctl, role_name, s->user->get_tenant());
+  RGWRole role(s->cct, store->get_ctl(), role_name, s->user->get_tenant());
   op_ret = role.get(s, y);
 
   if (op_ret == -ENOENT) {
@@ -322,7 +322,7 @@ void RGWListRoles::execute(optional_yield y)
     return;
   }
   vector<RGWRole> result;
-  op_ret = RGWRole::get_roles_by_path_prefix(s, store->getRados(), s->cct, path_prefix, s->user->get_tenant(), result, y);
+  op_ret = RGWRole::get_roles_by_path_prefix(s, store, s->cct, path_prefix, s->user->get_tenant(), result, y);
 
   if (op_ret == 0) {
     s->formatter->open_array_section("ListRolesResponse");
index a0a5de9f1de203fdf28049e8ddcaa17f92e2dd92..de8b50576abeebebe54a68b0f37d8bc94ed49cb5 100644 (file)
@@ -657,7 +657,7 @@ int RGWPutBucketTags_ObjStore_S3::get_params(optional_yield y)
   ldout(s->cct, 20) << "Read " << obj_tags.count() << "tags" << dendl;
 
   // forward bucket tags requests to meta master zone
-  if (!store->svc()->zone->is_meta_master()) {
+  if (!store->is_meta_master()) {
     /* only need to keep this data around if we're not meta master */
     in_data = std::move(data);
   }
@@ -923,13 +923,13 @@ struct ReplicationConfiguration {
       }
     };
 
-    set<rgw_zone_id> get_zone_ids_from_names(rgw::sal::RGWRadosStore *store,
+    set<rgw_zone_id> get_zone_ids_from_names(rgw::sal::RGWStore *store,
                                              const vector<string>& zone_names) const {
       set<rgw_zone_id> ids;
 
       for (auto& name : zone_names) {
         rgw_zone_id id;
-        if (store->svc()->zone->find_zone_id_by_name(name, &id)) {
+        if (static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone_id_by_name(name, &id)) {
           ids.insert(std::move(id));
         }
       }
@@ -937,13 +937,13 @@ struct ReplicationConfiguration {
       return ids;
     }
 
-    vector<string> get_zone_names_from_ids(rgw::sal::RGWRadosStore *store,
+    vector<string> get_zone_names_from_ids(rgw::sal::RGWStore *store,
                                            const set<rgw_zone_id>& zone_ids) const {
       vector<string> names;
 
       for (auto& id : zone_ids) {
         RGWZone *zone;
-        if (store->svc()->zone->find_zone(id, &zone)) {
+        if (static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->find_zone(id, &zone)) {
           names.emplace_back(zone->name);
         }
       }
@@ -1007,7 +1007,7 @@ struct ReplicationConfiguration {
       return true;
     }
 
-    int to_sync_policy_pipe(req_state *s, rgw::sal::RGWRadosStore *store,
+    int to_sync_policy_pipe(req_state *s, rgw::sal::RGWStore *store,
                             rgw_sync_bucket_pipes *pipe,
                             bool *enabled) const {
       if (!is_valid(s->cct)) {
@@ -1058,7 +1058,7 @@ struct ReplicationConfiguration {
       return 0;
     }
 
-    void from_sync_policy_pipe(rgw::sal::RGWRadosStore *store,
+    void from_sync_policy_pipe(rgw::sal::RGWStore *store,
                               const rgw_sync_bucket_pipes& pipe,
                               bool enabled) {
       id = pipe.id;
@@ -1111,7 +1111,7 @@ struct ReplicationConfiguration {
     encode_xml("Rule", rules, f);
   }
 
-  int to_sync_policy_groups(req_state *s, rgw::sal::RGWRadosStore *store,
+  int to_sync_policy_groups(req_state *s, rgw::sal::RGWStore *store,
                             vector<rgw_sync_policy_group> *result) const {
     result->resize(2);
 
@@ -1141,7 +1141,7 @@ struct ReplicationConfiguration {
     return 0;
   }
 
-  void from_sync_policy_group(rgw::sal::RGWRadosStore *store,
+  void from_sync_policy_group(rgw::sal::RGWStore *store,
                               const rgw_sync_policy_group& group) {
 
     bool enabled = (group.status == rgw_sync_policy_group::Status::ENABLED);
@@ -1222,7 +1222,7 @@ int RGWPutBucketReplication_ObjStore_S3::get_params(optional_yield y)
   }
 
   // forward requests to meta master zone
-  if (!store->svc()->zone->is_meta_master()) {
+  if (!store->is_meta_master()) {
     /* only need to keep this data around if we're not meta master */
     in_data = std::move(data);
   }
@@ -1895,7 +1895,7 @@ void RGWGetBucketLocation_ObjStore_S3::send_response()
   RGWZoneGroup zonegroup;
   string api_name;
 
-  int ret = store->svc()->zone->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
+  int ret = store->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
   if (ret >= 0) {
     api_name = zonegroup.api_name;
   } else  {
@@ -1996,7 +1996,7 @@ int RGWSetBucketVersioning_ObjStore_S3::get_params(optional_yield y)
     return -EINVAL;
   }
 
-  if (!store->svc()->zone->is_meta_master()) {
+  if (!store->is_meta_master()) {
     /* only need to keep this data around if we're not meta master */
     in_data.append(data);
   }
@@ -2173,7 +2173,7 @@ void RGWStatBucket_ObjStore_S3::send_response()
   dump_start(s);
 }
 
-static int create_s3_policy(struct req_state *s, rgw::sal::RGWRadosStore *store,
+static int create_s3_policy(struct req_state *s, rgw::sal::RGWStore *store,
                            RGWAccessControlPolicy_S3& s3policy,
                            ACLOwner& owner)
 {
@@ -2181,7 +2181,7 @@ static int create_s3_policy(struct req_state *s, rgw::sal::RGWRadosStore *store,
     if (!s->canned_acl.empty())
       return -ERR_INVALID_REQUEST;
 
-    return s3policy.create_from_headers(s, store->ctl()->user, s->info.env, owner);
+    return s3policy.create_from_headers(s, store, s->info.env, owner);
   }
 
   return s3policy.create_canned(owner, s->bucket_owner, s->canned_acl);
@@ -2538,16 +2538,6 @@ void RGWPutObj_ObjStore_S3::send_response()
   end_header(s, this);
 }
 
-static inline int get_obj_attrs(rgw::sal::RGWRadosStore *store, struct req_state *s, rgw_obj& obj, map<string, bufferlist>& attrs)
-{
-  RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
-  RGWRados::Object::Read read_op(&op_target);
-
-  read_op.params.attrs = &attrs;
-
-  return read_op.prepare(s->yield, s);
-}
-
 static inline void set_attr(map<string, bufferlist>& attrs, const char* key, const std::string& value)
 {
   bufferlist bl;
@@ -2597,16 +2587,17 @@ int RGWPutObj_ObjStore_S3::get_encrypt_filter(
   int res = 0;
   if (!multipart_upload_id.empty()) {
     RGWMPObj mp(s->object->get_name(), multipart_upload_id);
-    rgw_obj obj;
-    obj.init_ns(s->bucket->get_key(), mp.get_meta(), RGW_OBJ_NS_MULTIPART);
-    obj.set_in_extra_data(true);
-    map<string, bufferlist> xattrs;
-    res = get_obj_attrs(store, s, obj, xattrs);
+    std::unique_ptr<rgw::sal::RGWObject> obj = s->bucket->get_object(
+                                               rgw_obj_key(mp.get_meta(),
+                                                           std::string(),
+                                                           RGW_OBJ_NS_MULTIPART));
+    obj->set_in_extra_data(true);
+    res = obj->get_obj_attrs(s->obj_ctx, s->yield, this);
     if (res == 0) {
       std::unique_ptr<BlockCrypt> block_crypt;
       /* We are adding to existing object.
        * We use crypto mode that configured as if we were decrypting. */
-      res = rgw_s3_prepare_decrypt(s, xattrs, &block_crypt, crypt_http_responses);
+      res = rgw_s3_prepare_decrypt(s, obj->get_attrs(), &block_crypt, crypt_http_responses);
       if (res == 0 && block_crypt != nullptr)
         filter->reset(new RGWPutObj_BlockEncrypt(s->cct, cb, std::move(block_crypt)));
     }
@@ -2740,7 +2731,7 @@ int RGWPostObj_ObjStore_S3::get_params(optional_yield y)
 
   if (! storage_class.empty()) {
     s->dest_placement.storage_class = storage_class;
-    if (!store->svc()->zone->get_zone_params().valid_placement(s->dest_placement)) {
+    if (!store->get_zone_params().valid_placement(s->dest_placement)) {
       ldpp_dout(this, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
       err_msg = "The storage class you specified is not valid";
       return -EINVAL;
@@ -3347,7 +3338,7 @@ int RGWPutACLs_ObjStore_S3::get_params(optional_yield y)
   return ret;
 }
 
-int RGWPutACLs_ObjStore_S3::get_policy_from_state(rgw::sal::RGWRadosStore *store,
+int RGWPutACLs_ObjStore_S3::get_policy_from_state(rgw::sal::RGWStore *store,
                                                  struct req_state *s,
                                                  stringstream& ss)
 {
@@ -3513,7 +3504,7 @@ int RGWPutCORS_ObjStore_S3::get_params(optional_yield y)
   }
 
   // forward bucket cors requests to meta master zone
-  if (!store->svc()->zone->is_meta_master()) {
+  if (!store->is_meta_master()) {
     /* only need to keep this data around if we're not meta master */
     in_data.append(data);
   }
@@ -4412,7 +4403,7 @@ RGWOp *RGWHandler_REST_Bucket_S3::op_put()
   } else if (is_notification_op()) {
     return RGWHandler_REST_PSNotifs_S3::create_put_op();
   } else if (is_replication_op()) {
-    auto sync_policy_handler = store->svc()->zone->get_sync_policy_handler(nullopt);
+    auto sync_policy_handler = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_sync_policy_handler(nullopt);
     if (!sync_policy_handler ||
         sync_policy_handler->is_legacy_config()) {
       return nullptr;
@@ -4564,7 +4555,7 @@ RGWOp *RGWHandler_REST_Obj_S3::op_options()
   return new RGWOptionsCORS_ObjStore_S3;
 }
 
-int RGWHandler_REST_S3::init_from_header(rgw::sal::RGWRadosStore *store,
+int RGWHandler_REST_S3::init_from_header(rgw::sal::RGWStore *store,
                                         struct req_state* s,
                                         int default_formatter,
                                         bool configurable_format)
@@ -4640,7 +4631,7 @@ int RGWHandler_REST_S3::init_from_header(rgw::sal::RGWRadosStore *store,
   return 0;
 }
 
-static int verify_mfa(rgw::sal::RGWRadosStore *store, RGWUserInfo *user,
+static int verify_mfa(rgw::sal::RGWStore *store, RGWUserInfo *user,
                      const string& mfa_str, bool *verified, const DoutPrefixProvider *dpp, optional_yield y)
 {
   vector<string> params;
@@ -4660,7 +4651,7 @@ static int verify_mfa(rgw::sal::RGWRadosStore *store, RGWUserInfo *user,
     return -EACCES;
   }
 
-  int ret = store->svc()->cls->mfa.check_mfa(user->user_id, serial, pin, y);
+  int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->cls->mfa.check_mfa(user->user_id, serial, pin, y);
   if (ret < 0) {
     ldpp_dout(dpp, 20) << "NOTICE: failed to check MFA, serial=" << serial << dendl;
     return -EACCES;
@@ -4711,7 +4702,7 @@ int RGWHandler_REST_S3::postauth_init(optional_yield y)
   return 0;
 }
 
-int RGWHandler_REST_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *s,
+int RGWHandler_REST_S3::init(rgw::sal::RGWStore *store, struct req_state *s,
                              rgw::io::BasicClient *cio)
 {
   int ret;
@@ -4821,7 +4812,7 @@ discover_aws_flavour(const req_info& info)
  * it tries AWS v4 before AWS v2
  */
 int RGW_Auth_S3::authorize(const DoutPrefixProvider *dpp,
-                           rgw::sal::RGWRadosStore* const store,
+                           rgw::sal::RGWStore* const store,
                            const rgw::auth::StrategyRegistry& auth_registry,
                            struct req_state* const s, optional_yield y)
 {
@@ -4843,7 +4834,7 @@ int RGW_Auth_S3::authorize(const DoutPrefixProvider *dpp,
   return ret;
 }
 
-int RGWHandler_Auth_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *state,
+int RGWHandler_Auth_S3::init(rgw::sal::RGWStore *store, struct req_state *state,
                              rgw::io::BasicClient *cio)
 {
   int ret = RGWHandler_REST_S3::init_from_header(store, state, RGW_FORMAT_JSON, true);
@@ -4853,7 +4844,7 @@ int RGWHandler_Auth_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *s
   return RGWHandler_REST::init(store, state, cio);
 }
 
-RGWHandler_REST* RGWRESTMgr_S3::get_handler(rgw::sal::RGWRadosStore *store,
+RGWHandler_REST* RGWRESTMgr_S3::get_handler(rgw::sal::RGWStore *store,
                                            struct req_state* const s,
                                             const rgw::auth::StrategyRegistry& auth_registry,
                                             const std::string& frontend_prefix)
@@ -4903,14 +4894,14 @@ bool RGWHandler_REST_S3Website::web_dir() const {
     subdir_name.pop_back();
   }
 
-  rgw_obj obj(s->bucket->get_key(), subdir_name);
+  std::unique_ptr<rgw::sal::RGWObject> obj = s->bucket->get_object(rgw_obj_key(subdir_name));
 
   RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-  obj_ctx.set_atomic(obj);
-  obj_ctx.set_prefetch_data(obj);
+  obj->set_atomic(&obj_ctx);
+  obj->set_prefetch_data(&obj_ctx);
 
   RGWObjState* state = nullptr;
-  if (store->getRados()->get_obj_state(s, &obj_ctx, s->bucket->get_info(), obj, &state, false, s->yield) < 0) {
+  if (obj->get_obj_state(s, &obj_ctx, &state, s->yield) < 0) {
     return false;
   }
   if (! state->exists) {
@@ -4919,7 +4910,7 @@ bool RGWHandler_REST_S3Website::web_dir() const {
   return state->exists;
 }
 
-int RGWHandler_REST_S3Website::init(rgw::sal::RGWRadosStore *store, req_state *s,
+int RGWHandler_REST_S3Website::init(rgw::sal::RGWStore *store, req_state *s,
                                     rgw::io::BasicClient* cio)
 {
   // save the original object name before retarget() replaces it with the
index 8c59174efe0f23f805416912e90abd15e5e4d83a..5faf16fec1904faab02134e7a1859e21b99c9772 100644 (file)
@@ -355,7 +355,7 @@ public:
   RGWPutACLs_ObjStore_S3() {}
   ~RGWPutACLs_ObjStore_S3() override {}
 
-  int get_policy_from_state(rgw::sal::RGWRadosStore *store, struct req_state *s, stringstream& ss) override;
+  int get_policy_from_state(rgw::sal::RGWStore *store, struct req_state *s, stringstream& ss) override;
   void send_response() override;
   int get_params(optional_yield y) override;
 };
@@ -591,7 +591,7 @@ public:
 class RGW_Auth_S3 {
 public:
   static int authorize(const DoutPrefixProvider *dpp,
-                       rgw::sal::RGWRadosStore *store,
+                       rgw::sal::RGWStore *store,
                        const rgw::auth::StrategyRegistry& auth_registry,
                        struct req_state *s, optional_yield y);
 };
@@ -611,7 +611,7 @@ public:
   static int validate_bucket_name(const string& bucket);
   static int validate_object_name(const string& bucket);
 
-  int init(rgw::sal::RGWRadosStore *store,
+  int init(rgw::sal::RGWStore *store,
            struct req_state *s,
            rgw::io::BasicClient *cio) override;
   int authorize(const DoutPrefixProvider *dpp, optional_yield y) override {
@@ -625,7 +625,7 @@ class RGWHandler_REST_S3 : public RGWHandler_REST {
 protected:
   const rgw::auth::StrategyRegistry& auth_registry;
 public:
-  static int init_from_header(rgw::sal::RGWRadosStore *store, struct req_state *s, int default_formatter, bool configurable_format);
+  static int init_from_header(rgw::sal::RGWStore *store, struct req_state *s, int default_formatter, bool configurable_format);
 
   explicit RGWHandler_REST_S3(const rgw::auth::StrategyRegistry& auth_registry)
     : RGWHandler_REST(),
@@ -633,7 +633,7 @@ public:
     }
   ~RGWHandler_REST_S3() override = default;
 
-  int init(rgw::sal::RGWRadosStore *store,
+  int init(rgw::sal::RGWStore *store,
            struct req_state *s,
            rgw::io::BasicClient *cio) override;
   int authorize(const DoutPrefixProvider *dpp, optional_yield y) override;
@@ -765,7 +765,7 @@ public:
 
   ~RGWRESTMgr_S3() override = default;
 
-  RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST *get_handler(rgw::sal::RGWStore *store,
                               struct req_state* s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix) override;
index c363eb563b95e54f8c2f1037a31a243fd10c5338..8e92d7a8e7f6a04ffd4be8c3a1b7856acfa4438c 100644 (file)
@@ -40,7 +40,7 @@ public:
   using RGWHandler_REST_S3::RGWHandler_REST_S3;
   ~RGWHandler_REST_S3Website() override = default;
 
-  int init(rgw::sal::RGWRadosStore *store, req_state *s, rgw::io::BasicClient* cio) override;
+  int init(rgw::sal::RGWStore *store, req_state *s, rgw::io::BasicClient* cio) override;
   int error_handler(int err_no, string *error_content, optional_yield y) override;
 };
 
index 693edf1ca540bceaa61df74326f9e62ceed0cf31..03920b4766dcb69e57920a1ac236cd913942e448 100644 (file)
@@ -582,7 +582,7 @@ void RGWSTSAssumeRole::execute(optional_yield y)
 }
 
 int RGW_Auth_STS::authorize(const DoutPrefixProvider *dpp,
-                            rgw::sal::RGWRadosStore *store,
+                            rgw::sal::RGWStore *store,
                             const rgw::auth::StrategyRegistry& auth_registry,
                             struct req_state *s, optional_yield y)
 {
@@ -628,7 +628,7 @@ RGWOp *RGWHandler_REST_STS::op_post()
   return nullptr;
 }
 
-int RGWHandler_REST_STS::init(rgw::sal::RGWRadosStore *store,
+int RGWHandler_REST_STS::init(rgw::sal::RGWStore *store,
                               struct req_state *s,
                               rgw::io::BasicClient *cio)
 {
@@ -693,7 +693,7 @@ int RGWHandler_REST_STS::init_from_header(struct req_state* s,
 }
 
 RGWHandler_REST*
-RGWRESTMgr_STS::get_handler(rgw::sal::RGWRadosStore *store,
+RGWRESTMgr_STS::get_handler(rgw::sal::RGWStore *store,
                            struct req_state* const s,
                            const rgw::auth::StrategyRegistry& auth_registry,
                            const std::string& frontend_prefix)
index 810ff242d734f53f757adf2e8a3fcb51ecdb6f84..797ce204c1fc57b3972344be0ce3a8d1fd42d9c0 100644 (file)
@@ -171,7 +171,7 @@ public:
 class RGW_Auth_STS {
 public:
   static int authorize(const DoutPrefixProvider *dpp,
-                       rgw::sal::RGWRadosStore *store,
+                       rgw::sal::RGWStore *store,
                        const rgw::auth::StrategyRegistry& auth_registry,
                        struct req_state *s, optional_yield y);
 };
@@ -191,7 +191,7 @@ public:
       post_body(post_body) {}
   ~RGWHandler_REST_STS() override = default;
 
-  int init(rgw::sal::RGWRadosStore *store,
+  int init(rgw::sal::RGWStore *store,
            struct req_state *s,
            rgw::io::BasicClient *cio) override;
   int authorize(const DoutPrefixProvider* dpp, optional_yield y) override;
@@ -209,7 +209,7 @@ public:
     return this;
   }
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry&,
                                const std::string&) override;
index b3d221cbd7f99cf3afc0dd1a16767f49cc2f51de..d8b137701383d92ed223791a280ebdb7f1230f01 100644 (file)
@@ -27,7 +27,7 @@
 #include "rgw_process.h"
 
 #include "rgw_zone.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 #include "services/svc_zone.h"
 
@@ -221,14 +221,14 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_data(rgw::sal::RGWBucketList&
   }
 }
 
-void RGWListBuckets_ObjStore_SWIFT::dump_bucket_entry(const rgw::sal::RGWBucket& obj)
+void RGWListBuckets_ObjStore_SWIFT::dump_bucket_entry(const rgw::sal::RGWBucket& bucket)
 {
   s->formatter->open_object_section("container");
-  s->formatter->dump_string("name", obj.get_name());
+  s->formatter->dump_string("name", bucket.get_name());
 
   if (need_stats) {
-    s->formatter->dump_int("count", obj.get_count());
-    s->formatter->dump_int("bytes", obj.get_size());
+    s->formatter->dump_int("count", bucket.get_count());
+    s->formatter->dump_int("bytes", bucket.get_size());
   }
 
   s->formatter->close_section();
@@ -545,7 +545,7 @@ static void dump_container_metadata(struct req_state *s,
 void RGWStatAccount_ObjStore_SWIFT::execute(optional_yield y)
 {
   RGWStatAccount_ObjStore::execute(y);
-  op_ret = store->ctl()->user->get_attrs_by_uid(s, s->user->get_id(), &attrs, s->yield);
+  op_ret = s->user->read_attrs(s, s->yield, &attrs);
 }
 
 void RGWStatAccount_ObjStore_SWIFT::send_response()
@@ -584,7 +584,7 @@ void RGWStatBucket_ObjStore_SWIFT::send_response()
 }
 
 static int get_swift_container_settings(req_state * const s,
-                                        rgw::sal::RGWRadosStore * const store,
+                                        rgw::sal::RGWStore * const store,
                                         RGWAccessControlPolicy * const policy,
                                         bool * const has_policy,
                                         uint32_t * rw_mask,
@@ -598,7 +598,7 @@ static int get_swift_container_settings(req_state * const s,
 
   if (read_list || write_list) {
     RGWAccessControlPolicy_SWIFT swift_policy(s->cct);
-    const auto r = swift_policy.create(s, store->ctl()->user,
+    const auto r = swift_policy.create(s, store,
                                        s->user->get_id(),
                                        s->user->get_display_name(),
                                        read_list,
@@ -711,7 +711,7 @@ int RGWCreateBucket_ObjStore_SWIFT::get_params(optional_yield y)
     policy.create_default(s->user->get_id(), s->user->get_display_name());
   }
 
-  location_constraint = store->svc()->zone->get_zonegroup().api_name;
+  location_constraint = store->get_zonegroup().api_name;
   get_rmattrs_from_headers(s, CONT_PUT_ATTR_PREFIX,
                            CONT_REMOVE_ATTR_PREFIX, rmattr_names);
   placement_rule.init(s->info.env->get("HTTP_X_STORAGE_POLICY", ""), s->info.storage_class);
@@ -844,49 +844,38 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) {
   string bucket_name = path.substr(pos_init, pos_sep - pos_init);
   string obj_name = path.substr(pos_sep + 1);
 
-  rgw_bucket bucket;
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
 
   if (bucket_name.compare(s->bucket->get_name()) != 0) {
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> bucket_attrs;
-    r = store->getRados()->get_bucket_info(store->svc(), s->user->get_id().tenant,
-                              bucket_name, bucket_info, nullptr,
-                              s->yield, s, &bucket_attrs);
+    r = store->get_bucket(s, s->user.get(), s->user->get_id().tenant, bucket_name, &bucket, s->yield);
     if (r < 0) {
       ldpp_dout(this, 0) << "could not get bucket info for bucket="
                         << bucket_name << dendl;
       return r;
     }
-    bucket = bucket_info.bucket;
   } else {
-    bucket = s->bucket->get_key();
+    bucket = s->bucket->clone();
   }
 
   /* fetch the stored size of the seg (or error if not valid) */
-  rgw_obj_key slo_key(obj_name);
-  rgw_obj slo_seg(bucket, slo_key);
+  std::unique_ptr<rgw::sal::RGWObject> slo_seg = bucket->get_object(rgw_obj_key(obj_name));
 
   /* no prefetch */
   RGWObjectCtx obj_ctx(store);
-  obj_ctx.set_atomic(slo_seg);
-
-  RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), obj_ctx, slo_seg);
-  RGWRados::Object::Read read_op(&op_target);
+  slo_seg->set_atomic(&obj_ctx);
 
   bool compressed;
   RGWCompressionInfo cs_info;
-  map<std::string, buffer::list> attrs;
   uint64_t size_bytes{0};
 
-  read_op.params.attrs = &attrs;
-  read_op.params.obj_size = &size_bytes;
-
-  r = read_op.prepare(s->yield, s);
+  r = slo_seg->get_obj_attrs(&obj_ctx, s->yield, s);
   if (r < 0) {
     return r;
   }
 
-  r = rgw_compression_info_from_attrset(attrs, compressed, cs_info);
+  size_bytes = slo_seg->get_obj_size();
+
+  r = rgw_compression_info_from_attrset(slo_seg->get_attrs(), compressed, cs_info);
   if (r < 0) {
     return -EIO;
   }
@@ -1051,7 +1040,7 @@ void RGWPutObj_ObjStore_SWIFT::send_response()
 }
 
 static int get_swift_account_settings(req_state * const s,
-                                      rgw::sal::RGWRadosStore * const store,
+                                      rgw::sal::RGWStore * const store,
                                       RGWAccessControlPolicy_SWIFTAcct * const policy,
                                       bool * const has_policy)
 {
@@ -1060,7 +1049,7 @@ static int get_swift_account_settings(req_state * const s,
   const char * const acl_attr = s->info.env->get("HTTP_X_ACCOUNT_ACCESS_CONTROL");
   if (acl_attr) {
     RGWAccessControlPolicy_SWIFTAcct swift_acct_policy(s->cct);
-    const bool r = swift_acct_policy.create(s, store->ctl()->user,
+    const bool r = swift_acct_policy.create(s, store,
                                      s->user->get_id(),
                                      s->user->get_display_name(),
                                      string(acl_attr));
@@ -1858,7 +1847,7 @@ void RGWInfo_ObjStore_SWIFT::execute(optional_yield y)
       s->formatter->close_section();
     }
     else {
-      pair.second.list_data(*(s->formatter), s->cct->_conf, *store->getRados());
+      pair.second.list_data(*(s->formatter), s->cct->_conf, store);
     }
   }
 
@@ -1878,7 +1867,7 @@ void RGWInfo_ObjStore_SWIFT::send_response()
 
 void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
                                               const ConfigProxy& config,
-                                              RGWRados& store)
+                                              rgw::sal::RGWStore* store)
 {
   formatter.open_object_section("swift");
   formatter.dump_int("max_file_size", config->rgw_max_put_size);
@@ -1907,7 +1896,7 @@ void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
   }
 
   formatter.open_array_section("policies");
-  const RGWZoneGroup& zonegroup = store.svc.zone->get_zonegroup();
+  const RGWZoneGroup& zonegroup = store->get_zonegroup();
 
   for (const auto& placement_targets : zonegroup.placement_targets) {
     formatter.open_object_section("policy");
@@ -1926,7 +1915,7 @@ void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
 
 void RGWInfo_ObjStore_SWIFT::list_tempauth_data(Formatter& formatter,
                                                  const ConfigProxy& config,
-                                                 RGWRados& store)
+                                                 rgw::sal::RGWStore* store)
 {
   formatter.open_object_section("tempauth");
   formatter.dump_bool("account_acls", true);
@@ -1934,7 +1923,7 @@ void RGWInfo_ObjStore_SWIFT::list_tempauth_data(Formatter& formatter,
 }
 void RGWInfo_ObjStore_SWIFT::list_tempurl_data(Formatter& formatter,
                                                 const ConfigProxy& config,
-                                                RGWRados& store)
+                                                rgw::sal::RGWStore* store)
 {
   formatter.open_object_section("tempurl");
   formatter.open_array_section("methods");
@@ -1949,7 +1938,7 @@ void RGWInfo_ObjStore_SWIFT::list_tempurl_data(Formatter& formatter,
 
 void RGWInfo_ObjStore_SWIFT::list_slo_data(Formatter& formatter,
                                             const ConfigProxy& config,
-                                            RGWRados& store)
+                                            rgw::sal::RGWStore* store)
 {
   formatter.open_object_section("slo");
   formatter.dump_int("max_manifest_segments", config->rgw_max_slo_entries);
@@ -1976,7 +1965,7 @@ bool RGWInfo_ObjStore_SWIFT::is_expired(const std::string& expires, const DoutPr
 }
 
 
-void RGWFormPost::init(rgw::sal::RGWRadosStore* const store,
+void RGWFormPost::init(rgw::sal::RGWStore* const store,
                        req_state* const s,
                        RGWHandler* const dialect_handler)
 {
@@ -2077,14 +2066,13 @@ void RGWFormPost::get_owner_info(const req_state* const s,
    * now. It will be initialized in RGWHandler_REST_SWIFT::postauth_init(). */
   const string& bucket_name = s->init_state.url_bucket;
 
-  auto user_ctl = store->ctl()->user;
+  std::unique_ptr<rgw::sal::RGWUser> user;
 
   /* TempURL in Formpost only requires that bucket name is specified. */
   if (bucket_name.empty()) {
     throw -EPERM;
   }
 
-  string bucket_tenant;
   if (!s->account_name.empty()) {
     RGWUserInfo uinfo;
     bool found = false;
@@ -2092,36 +2080,38 @@ void RGWFormPost::get_owner_info(const req_state* const s,
     const rgw_user uid(s->account_name);
     if (uid.tenant.empty()) {
       const rgw_user tenanted_uid(uid.id, uid.id);
+      user = store->get_user(tenanted_uid);
 
-      if (user_ctl->get_info_by_uid(s, tenanted_uid, &uinfo, s->yield) >= 0) {
+      if (user->load_by_id(s, s->yield) >= 0) {
         /* Succeeded. */
-        bucket_tenant = uinfo.user_id.tenant;
         found = true;
       }
     }
 
-    if (!found && user_ctl->get_info_by_uid(s, uid, &uinfo, s->yield) < 0) {
-      throw -EPERM;
-    } else {
-      bucket_tenant = uinfo.user_id.tenant;
+    if (!found) {
+      user = store->get_user(uid);
+      if (user->load_by_id(s, s->yield) < 0) {
+       throw -EPERM;
+      }
     }
   }
 
   /* Need to get user info of bucket owner. */
-  RGWBucketInfo bucket_info;
-  int ret = store->getRados()->get_bucket_info(store->svc(),
-                                   bucket_tenant, bucket_name,
-                                   bucket_info, nullptr, s->yield, s);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  int ret = store->get_bucket(s, user.get(), user->get_tenant(), bucket_name, &bucket, s->yield);
   if (ret < 0) {
     throw ret;
   }
 
-  ldpp_dout(this, 20) << "temp url user (bucket owner): " << bucket_info.owner
+  ldpp_dout(this, 20) << "temp url user (bucket owner): " << bucket->get_info().owner
                  << dendl;
 
-  if (user_ctl->get_info_by_uid(s, bucket_info.owner, &owner_info, s->yield) < 0) {
+  user = store->get_user(bucket->get_info().owner);
+  if (user->load_by_id(s, s->yield) < 0) {
     throw -EPERM;
   }
+
+  owner_info = user->get_info();
 }
 
 int RGWFormPost::get_params(optional_yield y)
@@ -2353,7 +2343,7 @@ int RGWSwiftWebsiteHandler::serve_errordoc(const int http_ret,
 
   class RGWGetErrorPage : public RGWGetObj_ObjStore_SWIFT {
   public:
-    RGWGetErrorPage(rgw::sal::RGWRadosStore* const store,
+    RGWGetErrorPage(rgw::sal::RGWStore* const store,
                     RGWHandler_REST* const handler,
                     req_state* const s,
                     const int http_ret) {
@@ -2562,15 +2552,15 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
     subdir_name.pop_back();
   }
 
-  rgw::sal::RGWRadosObject obj(store, rgw_obj_key(std::move(subdir_name)), s->bucket.get());
+  std::unique_ptr<rgw::sal::RGWObject> obj = s->bucket->get_object(rgw_obj_key(std::move(subdir_name)));
 
   /* First, get attrset of the object we'll try to retrieve. */
   RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-  obj.set_atomic(&obj_ctx);
-  obj.set_prefetch_data(&obj_ctx);
+  obj->set_atomic(&obj_ctx);
+  obj->set_prefetch_data(&obj_ctx);
 
   RGWObjState* state = nullptr;
-  if (obj.get_obj_state(s, &obj_ctx, *s->bucket, &state, s->yield, false)) {
+  if (obj->get_obj_state(s, &obj_ctx, &state, s->yield, false)) {
     return false;
   }
 
@@ -2593,14 +2583,14 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
 
 bool RGWSwiftWebsiteHandler::is_index_present(const std::string& index) const
 {
-  rgw::sal::RGWRadosObject obj(store, rgw_obj_key(index), s->bucket.get());
+  std::unique_ptr<rgw::sal::RGWObject> obj = s->bucket->get_object(rgw_obj_key(index));
 
   RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-  obj.set_atomic(&obj_ctx);
-  obj.set_prefetch_data(&obj_ctx);
+  obj->set_atomic(&obj_ctx);
+  obj->set_prefetch_data(&obj_ctx);
 
   RGWObjState* state = nullptr;
-  if (obj.get_obj_state(s, &obj_ctx, *s->bucket, &state, s->yield, false)) {
+  if (obj->get_obj_state(s, &obj_ctx, &state, s->yield, false)) {
     return false;
   }
 
@@ -2907,7 +2897,7 @@ static void next_tok(string& str, string& tok, char delim)
   }
 }
 
-int RGWHandler_REST_SWIFT::init_from_header(rgw::sal::RGWRadosStore* store,
+int RGWHandler_REST_SWIFT::init_from_header(rgw::sal::RGWStore* store,
                                            struct req_state* const s,
                                             const std::string& frontend_prefix)
 {
@@ -3033,7 +3023,7 @@ int RGWHandler_REST_SWIFT::init_from_header(rgw::sal::RGWRadosStore* store,
   return 0;
 }
 
-int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state* s,
+int RGWHandler_REST_SWIFT::init(rgw::sal::RGWStore* store, struct req_state* s,
                                rgw::io::BasicClient *cio)
 {
   struct req_init_state *t = &s->init_state;
@@ -3080,7 +3070,7 @@ int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state
 }
 
 RGWHandler_REST*
-RGWRESTMgr_SWIFT::get_handler(rgw::sal::RGWRadosStore* store,
+RGWRESTMgr_SWIFT::get_handler(rgw::sal::RGWStore* store,
                              struct req_state* const s,
                               const rgw::auth::StrategyRegistry& auth_registry,
                               const std::string& frontend_prefix)
@@ -3105,7 +3095,7 @@ RGWRESTMgr_SWIFT::get_handler(rgw::sal::RGWRadosStore* store,
 }
 
 RGWHandler_REST* RGWRESTMgr_SWIFT_Info::get_handler(
-  rgw::sal::RGWRadosStore* store,
+  rgw::sal::RGWStore* store,
   struct req_state* const s,
   const rgw::auth::StrategyRegistry& auth_registry,
   const std::string& frontend_prefix)
index 01f25b101ad82a0f9189d01ddd8c08b9bfd7081e..48d972d219f23bca4f0bb8cacf723c0a9bcd12dd 100644 (file)
@@ -235,7 +235,7 @@ protected:
   struct info
   {
     bool is_admin_info;
-    function<void (Formatter&, const ConfigProxy&, RGWRados&)> list_data;
+    function<void (Formatter&, const ConfigProxy&, rgw::sal::RGWStore*)> list_data;
   };
 
   static const vector<pair<string, struct info>> swift_info;
@@ -245,10 +245,10 @@ public:
 
   void execute(optional_yield y) override;
   void send_response() override;
-  static void list_swift_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
-  static void list_tempauth_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
-  static void list_tempurl_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
-  static void list_slo_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
+  static void list_swift_data(Formatter& formatter, const ConfigProxy& config, rgw::sal::RGWStore* store);
+  static void list_tempauth_data(Formatter& formatter, const ConfigProxy& config, rgw::sal::RGWStore* store);
+  static void list_tempurl_data(Formatter& formatter, const ConfigProxy& config, rgw::sal::RGWStore* store);
+  static void list_slo_data(Formatter& formatter, const ConfigProxy& config, rgw::sal::RGWStore* store);
   static bool is_expired(const std::string& expires, const DoutPrefixProvider* dpp);
 };
 
@@ -273,7 +273,7 @@ public:
   RGWFormPost() = default;
   ~RGWFormPost() = default;
 
-  void init(rgw::sal::RGWRadosStore* store,
+  void init(rgw::sal::RGWStore* store,
             req_state* s,
             RGWHandler* dialect_handler) override;
 
@@ -344,7 +344,7 @@ public:
 
 
 class RGWSwiftWebsiteHandler {
-  rgw::sal::RGWRadosStore* const store;
+  rgw::sal::RGWStore* const store;
   req_state* const s;
   RGWHandler_REST* const handler;
 
@@ -359,7 +359,7 @@ class RGWSwiftWebsiteHandler {
   RGWOp* get_ws_index_op();
   RGWOp* get_ws_listing_op();
 public:
-  RGWSwiftWebsiteHandler(rgw::sal::RGWRadosStore* const store,
+  RGWSwiftWebsiteHandler(rgw::sal::RGWStore* const store,
                          req_state* const s,
                          RGWHandler_REST* const handler)
     : store(store),
@@ -385,7 +385,7 @@ protected:
     return false;
   }
 
-  static int init_from_header(rgw::sal::RGWRadosStore* store, struct req_state* s,
+  static int init_from_header(rgw::sal::RGWStore* store, struct req_state* s,
                               const std::string& frontend_prefix);
 public:
   explicit RGWHandler_REST_SWIFT(const rgw::auth::Strategy& auth_strategy)
@@ -395,7 +395,7 @@ public:
 
   int validate_bucket_name(const string& bucket);
 
-  int init(rgw::sal::RGWRadosStore *store, struct req_state *s, rgw::io::BasicClient *cio) override;
+  int init(rgw::sal::RGWStore *store, struct req_state *s, rgw::io::BasicClient *cio) override;
   int authorize(const DoutPrefixProvider *dpp, optional_yield y) override;
   int postauth_init(optional_yield y) override;
 
@@ -443,7 +443,7 @@ public:
     return website_handler->retarget_bucket(op, new_op);
   }
 
-  int init(rgw::sal::RGWRadosStore* const store,
+  int init(rgw::sal::RGWStore* const store,
            struct req_state* const s,
            rgw::io::BasicClient* const cio) override {
     website_handler = boost::in_place<RGWSwiftWebsiteHandler>(store, s, this);
@@ -482,7 +482,7 @@ public:
     return website_handler->retarget_object(op, new_op);
   }
 
-  int init(rgw::sal::RGWRadosStore* const store,
+  int init(rgw::sal::RGWStore* const store,
            struct req_state* const s,
            rgw::io::BasicClient* const cio) override {
     website_handler = boost::in_place<RGWSwiftWebsiteHandler>(store, s, this);
@@ -502,7 +502,7 @@ public:
   RGWRESTMgr_SWIFT() = default;
   ~RGWRESTMgr_SWIFT() override = default;
 
-  RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST *get_handler(rgw::sal::RGWStore *store,
                               struct req_state *s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix) override;
@@ -536,7 +536,7 @@ public:
     return new RGWGetCrossDomainPolicy_ObjStore_SWIFT();
   }
 
-  int init(rgw::sal::RGWRadosStore* const store,
+  int init(rgw::sal::RGWStore* const store,
            struct req_state* const state,
            rgw::io::BasicClient* const cio) override {
     state->dialect = "swift";
@@ -574,7 +574,7 @@ public:
   RGWRESTMgr_SWIFT_CrossDomain() = default;
   ~RGWRESTMgr_SWIFT_CrossDomain() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state* const s,
                                const rgw::auth::StrategyRegistry&,
                                const std::string&) override {
@@ -593,7 +593,7 @@ public:
     return new RGWGetHealthCheck_ObjStore_SWIFT();
   }
 
-  int init(rgw::sal::RGWRadosStore* const store,
+  int init(rgw::sal::RGWStore* const store,
            struct req_state* const state,
            rgw::io::BasicClient* const cio) override {
     state->dialect = "swift";
@@ -631,7 +631,7 @@ public:
   RGWRESTMgr_SWIFT_HealthCheck() = default;
   ~RGWRESTMgr_SWIFT_HealthCheck() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state* const s,
                                const rgw::auth::StrategyRegistry&,
                                const std::string&) override {
@@ -650,7 +650,7 @@ public:
     return new RGWInfo_ObjStore_SWIFT();
   }
 
-  int init(rgw::sal::RGWRadosStore* const store,
+  int init(rgw::sal::RGWStore* const store,
            struct req_state* const state,
            rgw::io::BasicClient* const cio) override {
     state->dialect = "swift";
@@ -678,7 +678,7 @@ public:
   RGWRESTMgr_SWIFT_Info() = default;
   ~RGWRESTMgr_SWIFT_Info() override = default;
 
-  RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST *get_handler(rgw::sal::RGWStore *store,
                               struct req_state* s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix) override;
index e550a412227affaed1ad42bb40058e2dbd7714a1..08b102aa70b31e121715104816291fbd4fb64699 100644 (file)
@@ -4,7 +4,7 @@
 #include "rgw_op.h"
 #include "rgw_usage.h"
 #include "rgw_rest_usage.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 #include "include/str_list.h"
 
@@ -34,7 +34,12 @@ void RGWOp_Usage_Get::execute(optional_yield y) {
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   RESTArgs::get_string(s, "bucket", bucket_name, &bucket_name);
-  rgw_user uid(uid_str);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(uid_str));
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+
+  if (!bucket_name.empty()) {
+    store->get_bucket(nullptr, user.get(), std::string(), bucket_name, &bucket, null_yield);
+  }
 
   RESTArgs::get_epoch(s, "start", 0, &start);
   RESTArgs::get_epoch(s, "end", (uint64_t)-1, &end);
@@ -53,7 +58,7 @@ void RGWOp_Usage_Get::execute(optional_yield y) {
     }
   }
 
-  op_ret = RGWUsage::show(store->getRados(), uid, bucket_name, start, end, show_entries, show_summary, &categories, flusher);
+  op_ret = RGWUsage::show(this, store, user.get(), bucket.get(), start, end, show_entries, show_summary, &categories, flusher);
 }
 
 class RGWOp_Usage_Delete : public RGWRESTOp {
@@ -76,12 +81,17 @@ void RGWOp_Usage_Delete::execute(optional_yield y) {
 
   RESTArgs::get_string(s, "uid", uid_str, &uid_str);
   RESTArgs::get_string(s, "bucket", bucket_name, &bucket_name);
-  rgw_user uid(uid_str);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(uid_str));
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+
+  if (!bucket_name.empty()) {
+    store->get_bucket(nullptr, user.get(), std::string(), bucket_name, &bucket, null_yield);
+  }
 
   RESTArgs::get_epoch(s, "start", 0, &start);
   RESTArgs::get_epoch(s, "end", (uint64_t)-1, &end);
 
-  if (uid.empty() &&
+  if (rgw::sal::RGWUser::empty(user.get()) &&
       !bucket_name.empty() &&
       !start &&
       end == (uint64_t)-1) {
@@ -93,7 +103,7 @@ void RGWOp_Usage_Delete::execute(optional_yield y) {
     }
   }
 
-  op_ret = RGWUsage::trim(store->getRados(), uid, bucket_name, start, end);
+  op_ret = RGWUsage::trim(this, store, user.get(), bucket.get(), start, end);
 }
 
 RGWOp *RGWHandler_Usage::op_get()
index 5952fb076218b78692b59b20871a5dad89a4495e..fdfcb699860aa838266dd0dc6f494ce987d93c35 100644 (file)
@@ -25,7 +25,7 @@ public:
   RGWRESTMgr_Usage() = default;
   ~RGWRESTMgr_Usage() override = default;
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore* store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore* store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string&) override {
index aa6dda3a9d50bffbedb619208a5115a222629bdd..9c53adef585a31e7d5e2e32f7de31f1b79c7ba0a 100644 (file)
@@ -6,7 +6,7 @@
 #include "rgw_op.h"
 #include "rgw_user.h"
 #include "rgw_rest_user.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 
 #include "include/str_list.h"
 #include "include/ceph_assert.h"
@@ -210,7 +210,7 @@ void RGWOp_User_Create::execute(optional_yield y)
   if (!default_placement_str.empty()) {
     rgw_placement_rule target_rule;
     target_rule.from_str(default_placement_str);
-    if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) {
+    if (!store->get_zone_params().valid_placement(target_rule)) {
       ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
       op_ret = -EINVAL;
       return;
@@ -352,7 +352,7 @@ void RGWOp_User_Modify::execute(optional_yield y)
   if (!default_placement_str.empty()) {
     rgw_placement_rule target_rule;
     target_rule.from_str(default_placement_str);
-    if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) {
+    if (!store->get_zone_params().valid_placement(target_rule)) {
       ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
       op_ret = -EINVAL;
       return;
index f0a1b65770014c00d5ac6915b710674ab72f3445..14624558e19ca3da8d397d6ceaefc206d38aea67 100644 (file)
@@ -27,7 +27,7 @@ public:
   RGWRESTMgr_User() = default;
   ~RGWRESTMgr_User() override = default;
 
-  RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST *get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string&) override {
index bc9810e50984186cc627ceb263048f96186bea69..53aed9eeb0777175944bc784f18e729079309f99 100644 (file)
@@ -15,7 +15,7 @@
 #include "rgw_op.h"
 #include "rgw_rest.h"
 #include "rgw_rest_user_policy.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
 #include "services/svc_zone.h"
 
 #define dout_subsys ceph_subsys_rgw
@@ -118,16 +118,16 @@ void RGWPutUserPolicy::execute(optional_yield y)
 
   bufferlist bl = bufferlist::static_from_string(policy);
 
-  RGWUserInfo info;
-  rgw_user user_id(user_name);
-  op_ret = store->ctl()->user->get_info_by_uid(s, user_id, &info, s->yield);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(user_name));
+
+  op_ret = user->load_by_id(s, s->yield);
   if (op_ret < 0) {
     op_ret = -ERR_NO_SUCH_ENTITY;
     return;
   }
 
-  map<string, bufferlist> uattrs;
-  op_ret = store->ctl()->user->get_attrs_by_uid(s, user_id, &uattrs, s->yield);
+  rgw::sal::RGWAttrs uattrs;
+  op_ret = user->read_attrs(s, s->yield, &uattrs);
   if (op_ret == -ENOENT) {
     op_ret = -ERR_NO_SUCH_ENTITY;
     return;
@@ -153,10 +153,10 @@ void RGWPutUserPolicy::execute(optional_yield y)
     uattrs[RGW_ATTR_USER_POLICY] = in_bl;
 
     RGWObjVersionTracker objv_tracker;
-    op_ret = store->ctl()->user->store_info(s, info, s->yield,
-                                         RGWUserCtl::PutParams()
-                                         .set_objv_tracker(&objv_tracker)
-                                         .set_attrs(&uattrs));
+    op_ret = user->store_info(s, s->yield,
+                             RGWUserCtl::PutParams()
+                             .set_objv_tracker(&objv_tracker)
+                             .set_attrs(&uattrs));
     if (op_ret < 0) {
       op_ret = -ERR_INTERNAL_ERROR;
     }
@@ -200,9 +200,9 @@ void RGWGetUserPolicy::execute(optional_yield y)
     return;
   }
 
-  rgw_user user_id(user_name);
-  map<string, bufferlist> uattrs;
-  op_ret = store->ctl()->user->get_attrs_by_uid(s, user_id, &uattrs, s->yield);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(user_name));
+  rgw::sal::RGWAttrs uattrs;
+  op_ret = user->read_attrs(s, s->yield, &uattrs);
   if (op_ret == -ENOENT) {
     ldpp_dout(this, 0) << "ERROR: attrs not found for user" << user_name << dendl;
     op_ret = -ERR_NO_SUCH_ENTITY;
@@ -264,9 +264,9 @@ void RGWListUserPolicies::execute(optional_yield y)
     return;
   }
 
-  rgw_user user_id(user_name);
-  map<string, bufferlist> uattrs;
-  op_ret = store->ctl()->user->get_attrs_by_uid(s, user_id, &uattrs, s->yield);
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(user_name));
+  rgw::sal::RGWAttrs uattrs;
+  op_ret = user->read_attrs(s, s->yield, &uattrs);
   if (op_ret == -ENOENT) {
     ldpp_dout(this, 0) << "ERROR: attrs not found for user" << user_name << dendl;
     op_ret = -ERR_NO_SUCH_ENTITY;
@@ -326,17 +326,20 @@ void RGWDeleteUserPolicy::execute(optional_yield y)
     return;
   }
 
-  RGWUserInfo info;
-  map<string, bufferlist> uattrs;
-  rgw_user user_id(user_name);
-  op_ret = store->ctl()->user->get_info_by_uid(s, user_id, &info, s->yield,
-                                            RGWUserCtl::GetParams()
-                                            .set_attrs(&uattrs));
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(rgw_user(user_name));
+  op_ret = user->load_by_id(s, s->yield);
   if (op_ret < 0) {
     op_ret = -ERR_NO_SUCH_ENTITY;
     return;
   }
 
+  rgw::sal::RGWAttrs uattrs;
+  op_ret = user->read_attrs(this, s->yield, &uattrs);
+  if (op_ret == -ENOENT) {
+    op_ret = -ERR_NO_SUCH_ENTITY;
+    return;
+  }
+
   ceph::bufferlist in_data;
   op_ret = store->forward_request_to_master(s->user.get(), nullptr, in_data, nullptr, s->info, y);
   if (op_ret < 0) {
@@ -361,11 +364,11 @@ void RGWDeleteUserPolicy::execute(optional_yield y)
       uattrs[RGW_ATTR_USER_POLICY] = in_bl;
 
       RGWObjVersionTracker objv_tracker;
-      op_ret = store->ctl()->user->store_info(s, info, s->yield,
-                                           RGWUserCtl::PutParams()
-                                           .set_old_info(&info)
-                                           .set_objv_tracker(&objv_tracker)
-                                           .set_attrs(&uattrs));
+      op_ret = user->store_info(s, s->yield,
+                               RGWUserCtl::PutParams()
+                               .set_old_info(&user->get_info())
+                               .set_objv_tracker(&objv_tracker)
+                               .set_attrs(&uattrs));
       if (op_ret < 0) {
         op_ret = -ERR_INTERNAL_ERROR;
       }
index 52374a4193c150fff45c91c329e403a6899c5005..1dc7c1231984a90c1a0b2a35469645989c728236 100644 (file)
@@ -442,15 +442,15 @@ void RGWRole::update_trust_policy(string& trust_policy)
   this->trust_policy = trust_policy;
 }
 
-int RGWRole::get_roles_by_path_prefix(const DoutPrefixProvider *dpp, 
-                                      RGWRados *store,
+int RGWRole::get_roles_by_path_prefix(const DoutPrefixProvider *dpp,
+                                     rgw::sal::RGWStore *store,
                                       CephContext *cct,
                                       const string& path_prefix,
                                       const string& tenant,
                                       vector<RGWRole>& roles,
                                      optional_yield y)
 {
-  auto pool = store->svc.zone->get_zone_params().roles_pool;
+  auto pool = store->get_zone_params().roles_pool;
   string prefix;
 
   // List all roles if path prefix is empty
@@ -492,7 +492,7 @@ int RGWRole::get_roles_by_path_prefix(const DoutPrefixProvider *dpp,
       //Get id from info oid prefix + id
       string id = it.substr(pos + role_oid_prefix.length());
 
-      RGWRole role(cct, store->pctl);
+      RGWRole role(cct, store->get_ctl());
       role.set_id(id);
       int ret = role.read_info(dpp, y);
       if (ret < 0) {
index 9e7ab57c2849e2edc611921cf7e83684b4bc4d0c..c8642253cbf730f9960dbdc870c8840f024d7c15 100644 (file)
@@ -157,8 +157,8 @@ public:
   static const string& get_names_oid_prefix();
   static const string& get_info_oid_prefix();
   static const string& get_path_oid_prefix();
-  static int get_roles_by_path_prefix(const DoutPrefixProvider *dpp, 
-                                      RGWRados *store,
+  static int get_roles_by_path_prefix(const DoutPrefixProvider *dpp,
+                                     rgw::sal::RGWStore *store,
                                       CephContext *cct,
                                       const string& path_prefix,
                                       const string& tenant,
index e9a4b385bd95b848952050e1f2aa215826ac9738..f44aa13917208a0b5059b53b4ff151711c009240 100644 (file)
 #include <unistd.h>
 #include <sstream>
 
+#include "common/errno.h"
+
 #include "rgw_sal.h"
+#include "rgw_sal_rados.h"
 
 #define dout_subsys ceph_subsys_rgw
 
+extern "C" {
+extern rgw::sal::RGWStore* newRGWStore(void);
+}
+
+rgw::sal::RGWStore *RGWStoreManager::init_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, const std::string svc, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache)
+{
+  rgw::sal::RGWStore *store = nullptr;
+  if (svc.compare("rados") == 0) {
+    store = newRGWStore();
+    RGWRados *rados = static_cast<rgw::sal::RGWRadosStore *>(store)->getRados();
+
+    if ((*rados).set_use_cache(use_cache)
+                .set_run_gc_thread(use_gc_thread)
+                .set_run_lc_thread(use_lc_thread)
+                .set_run_quota_threads(quota_threads)
+                .set_run_sync_thread(run_sync_thread)
+                .set_run_reshard_thread(run_reshard_thread)
+                .initialize(cct, dpp) < 0) {
+      delete store; store = nullptr;
+    }
+  }
+
+  return store;
+}
+
+rgw::sal::RGWStore *RGWStoreManager::init_raw_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, const std::string svc)
+{
+  rgw::sal::RGWStore *store = nullptr;
+  if (svc.compare("rados") == 0) {
+    store = newRGWStore();
+    RGWRados *rados = static_cast<rgw::sal::RGWRadosStore *>(store)->getRados();
+
+    rados->set_context(cct);
+
+    int ret = rados->init_svc(true, dpp);
+    if (ret < 0) {
+      ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl;
+      delete store; store = nullptr;
+      return store;
+    }
+
+    if (rados->init_rados() < 0) {
+      delete store; store = nullptr;
+    }
+  }
+
+  return store;
+}
+
+void RGWStoreManager::close_storage(rgw::sal::RGWStore *store)
+{
+  if (!store)
+    return;
+
+  store->finalize();
+
+  delete store;
+}
index bfa8dfea1fafe58277d063a44b6ea0eb7c1c9f7f..1f115a445e4beb71fc0a58fc5a9055242ddb2d4e 100644 (file)
@@ -16,6 +16,8 @@
 #pragma once
 
 #include "rgw_user.h"
+#include "rgw_notify_event_type.h"
+#include "rgw_putobj.h"
 
 class RGWGetDataCB;
 struct RGWObjState;
@@ -23,6 +25,20 @@ class RGWAccessListFilter;
 class RGWLC;
 class RGWObjManifest;
 struct RGWZoneGroup;
+struct RGWZoneParams;
+struct RGWRealm;
+struct RGWCtl;
+struct rgw_user_bucket;
+class RGWUsageBatch;
+class RGWCoroutinesManagerRegistry;
+class RGWListRawObjsCtx;
+class RGWBucketSyncPolicyHandler;
+using RGWBucketSyncPolicyHandlerRef = std::shared_ptr<RGWBucketSyncPolicyHandler>;
+class RGWDataSyncStatusManager;
+namespace rgw {
+  class Aio;
+  namespace IAM { struct Policy; }
+}
 
 struct RGWUsageIter {
   string read_iter;
@@ -46,6 +62,32 @@ struct RGWClusterStat {
   uint64_t num_objects;
 };
 
+class RGWGetBucketStats_CB : public RefCountedObject {
+protected:
+  rgw_bucket bucket;
+  map<RGWObjCategory, RGWStorageStats> *stats;
+public:
+  explicit RGWGetBucketStats_CB(const rgw_bucket& _bucket) : bucket(_bucket), stats(NULL) {}
+  ~RGWGetBucketStats_CB() override {}
+  virtual void handle_response(int r) = 0;
+  virtual void set_response(map<RGWObjCategory, RGWStorageStats> *_stats) {
+    stats = _stats;
+  }
+};
+
+class RGWGetUserStats_CB : public RefCountedObject {
+protected:
+  rgw_user user;
+  RGWStorageStats stats;
+public:
+  explicit RGWGetUserStats_CB(const rgw_user& _user) : user(_user) {}
+  ~RGWGetUserStats_CB() override {}
+  virtual void handle_response(int r) = 0;
+  virtual void set_response(RGWStorageStats& _stats) {
+    stats = _stats;
+  }
+};
+
 
 namespace rgw { namespace sal {
 
@@ -57,6 +99,9 @@ class RGWObject;
 class RGWBucketList;
 struct MPSerializer;
 class Lifecycle;
+class Notification;
+class GCChain;
+class Writer;
 
 enum AttrsMod {
   ATTRSMOD_NONE    = 0,
@@ -64,6 +109,16 @@ enum AttrsMod {
   ATTRSMOD_MERGE   = 2
 };
 
+/**
+ * Base class for AIO completions
+ */
+class Completions {
+  public:
+    Completions() {}
+    virtual ~Completions() = default;
+    virtual int drain() = 0;
+};
+
 using RGWAttrs = std::map<std::string, ceph::buffer::list>;
 
 class RGWStore {
@@ -72,6 +127,9 @@ class RGWStore {
     virtual ~RGWStore() = default;
 
     virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u) = 0;
+    virtual int get_user(const DoutPrefixProvider *dpp, const RGWAccessKey& key, optional_yield y, std::unique_ptr<RGWUser>* user) = 0;
+    virtual int get_user_by_email(const DoutPrefixProvider *dpp, const std::string& email, optional_yield y, std::unique_ptr<RGWUser>* user) = 0;
+    virtual int get_user_by_swift(const DoutPrefixProvider *dpp, const std::string& user_str, optional_yield y, std::unique_ptr<RGWUser>* user) = 0;
     virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) = 0;
     virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y) = 0;
     virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket) = 0;
@@ -92,7 +150,6 @@ class RGWStore {
                            req_info& req_info,
                            std::unique_ptr<RGWBucket>* bucket,
                            optional_yield y) = 0;
-    virtual RGWBucketList* list_buckets(void) = 0;
     virtual bool is_meta_master() = 0;
     virtual int forward_request_to_master(RGWUser* user, obj_version *objv,
                                          bufferlist& in_data, JSONParser *jp, req_info& info,
@@ -101,16 +158,53 @@ class RGWStore {
                         optional_yield y) = 0;
     virtual const RGWZoneGroup& get_zonegroup() = 0;
     virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) = 0;
+    virtual const RGWZoneParams& get_zone_params() = 0;
+    virtual const rgw_zone_id& get_zone_id() = 0;
+    virtual const RGWRealm& get_realm() = 0;
     virtual int cluster_stat(RGWClusterStat& stats) = 0;
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) = 0;
+    virtual std::unique_ptr<Completions> get_completions(void) = 0;
+    virtual std::unique_ptr<Notification> get_notification(rgw::sal::RGWObject* obj, struct req_state* s, rgw::notify::EventType event_type) = 0;
+    virtual std::unique_ptr<GCChain> get_gc_chain(rgw::sal::RGWObject* obj) = 0;
+    virtual std::unique_ptr<Writer> get_writer(Aio *aio, rgw::sal::RGWBucket* bucket,
+              RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
+              const DoutPrefixProvider *dpp, optional_yield y) = 0;
     virtual RGWLC* get_rgwlc(void) = 0;
+    virtual RGWCtl* get_ctl(void) = 0;
+    virtual RGWCoroutinesManagerRegistry* get_cr_registry() = 0;
     virtual int delete_raw_obj(const rgw_raw_obj& obj) = 0;
+    virtual int delete_raw_obj_aio(const rgw_raw_obj& obj, Completions* aio) = 0;
     virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) = 0;
     virtual int get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) = 0;
 
-    virtual void finalize(void)=0;
-
-    virtual CephContext *ctx(void)=0;
+    virtual int log_usage(map<rgw_user_bucket, RGWUsageBatch>& usage_info) = 0;
+    virtual int log_op(string& oid, bufferlist& bl) = 0;
+    virtual int register_to_service_map(const string& daemon_type,
+                                       const map<string, string>& meta) = 0;
+    virtual void get_quota(RGWQuotaInfo& bucket_quota, RGWQuotaInfo& user_quota) = 0;
+    virtual int list_raw_objects(const rgw_pool& pool, const string& prefix_filter,
+                                int max, RGWListRawObjsCtx& ctx, std::list<string>& oids,
+                                bool *is_truncated) = 0;
+    virtual int set_buckets_enabled(const DoutPrefixProvider *dpp, vector<rgw_bucket>& buckets, bool enabled) = 0;
+    virtual uint64_t get_new_req_id() = 0;
+    virtual int get_sync_policy_handler(const DoutPrefixProvider *dpp,
+                                       std::optional<rgw_zone_id> zone,
+                                       std::optional<rgw_bucket> bucket,
+                                       RGWBucketSyncPolicyHandlerRef *phandler,
+                                       optional_yield y) = 0;
+    virtual RGWDataSyncStatusManager* get_data_sync_manager(const rgw_zone_id& source_zone) = 0;
+    virtual void wakeup_meta_sync_shards(set<int>& shard_ids) = 0;
+    virtual void wakeup_data_sync_shards(const rgw_zone_id& source_zone, map<int, set<string> >& shard_ids) = 0;
+    virtual int clear_usage() = 0;
+    virtual int read_all_usage(uint64_t start_epoch, uint64_t end_epoch,
+                              uint32_t max_entries, bool *is_truncated,
+                              RGWUsageIter& usage_iter,
+                              map<rgw_user_bucket, rgw_usage_log_entry>& usage) = 0;
+    virtual int trim_all_usage(uint64_t start_epoch, uint64_t end_epoch) = 0;
+    virtual int get_config_key_val(string name, bufferlist *bl) = 0;
+    virtual void finalize(void) = 0;
+
+    virtual CephContext *ctx(void) = 0;
     
     // get the location of where lua packages are installed
     virtual const std::string& get_luarocks_path() const = 0;
@@ -126,25 +220,41 @@ class RGWUser {
     RGWUser() : info() {}
     RGWUser(const rgw_user& _u) : info() { info.user_id = _u; }
     RGWUser(const RGWUserInfo& _i) : info(_i) {}
+    RGWUser(RGWUser& _o) = default;
     virtual ~RGWUser() = default;
 
-    virtual int list_buckets(const DoutPrefixProvider *dpp, 
-                             const std::string& marker, const std::string& end_marker,
+    virtual std::unique_ptr<RGWUser> clone() = 0;
+    virtual int list_buckets(const DoutPrefixProvider *dpp,
+                            const std::string& marker, const std::string& end_marker,
                             uint64_t max, bool need_stats, RGWBucketList& buckets,
                             optional_yield y) = 0;
     virtual RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time) = 0;
     friend class RGWBucket;
     virtual std::string& get_display_name() { return info.display_name; }
 
-    std::string& get_tenant() { return info.user_id.tenant; }
+    const std::string& get_tenant() { return info.user_id.tenant; }
+    void set_tenant(std::string& _t) { info.user_id.tenant = _t; }
+    const std::string& get_ns() { return info.user_id.ns; }
+    void set_ns(std::string& _ns) { info.user_id.ns = _ns; }
     const rgw_user& get_id() const { return info.user_id; }
     uint32_t get_type() const { return info.type; }
     int32_t get_max_buckets() const { return info.max_buckets; }
     const RGWUserCaps& get_caps() const { return info.caps; }
     static bool empty(RGWUser* u) { return (!u || u->info.user_id.id.empty()); }
+    virtual int read_attrs(const DoutPrefixProvider *dpp, optional_yield y, RGWAttrs* uattrs, RGWObjVersionTracker* tracker = nullptr) = 0;
+    virtual int read_stats(optional_yield y, RGWStorageStats* stats,
+                          ceph::real_time *last_stats_sync = nullptr,
+                          ceph::real_time *last_stats_update = nullptr) = 0;
+    virtual int read_stats_async(RGWGetUserStats_CB *cb) = 0;
+    virtual int complete_flush_stats(optional_yield y) = 0;
+    virtual int read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
+                          bool *is_truncated, RGWUsageIter& usage_iter,
+                          map<rgw_user_bucket, rgw_usage_log_entry>& usage) = 0;
+    virtual int trim_usage(uint64_t start_epoch, uint64_t end_epoch) = 0;
 
     /* Placeholders */
-    virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y) = 0;
+    virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::GetParams& params = {}) = 0;
+    virtual int store_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::PutParams& params = {}) = 0;
 
     /* dang temporary; will be removed when User is complete */
     rgw_user& get_user() { return info.user_id; }
@@ -191,7 +301,7 @@ class RGWBucket {
       RGWAccessListFilter *filter{nullptr};
       bool list_versions{false};
       bool allow_unordered{false};
-      int shard_id{-1};
+      int shard_id{RGW_NO_SHARD};
     };
     struct ListResults {
       vector<rgw_bucket_dir_entry> objs;
@@ -201,6 +311,8 @@ class RGWBucket {
     };
 
     RGWBucket() : ent(), info(), owner(nullptr), attrs(), bucket_version() {}
+    RGWBucket(RGWUser* _u) :
+      ent(), info(), owner(_u), attrs(), bucket_version() { }
     RGWBucket(const rgw_bucket& _b) :
       ent(), info(), owner(nullptr), attrs(), bucket_version() { ent.bucket = _b; info.bucket = _b; }
     RGWBucket(const RGWBucketEnt& _e) :
@@ -215,7 +327,6 @@ class RGWBucket {
       ent(), info(_i), owner(_u), attrs(), bucket_version() { ent.bucket = info.bucket;  ent.placement_rule = info.placement_rule;}
     virtual ~RGWBucket() = default;
 
-    virtual int load_by_name(const DoutPrefixProvider *dpp, const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) = 0;
     virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& key) = 0;
     virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) = 0;
     virtual RGWObject* create_object(const rgw_obj_key& key /* Attributes */) = 0;
@@ -225,19 +336,22 @@ class RGWBucket {
     virtual RGWAccessControlPolicy& get_acl(void) = 0;
     virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) = 0;
     virtual int get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) = 0;
-    virtual int get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id,
+    virtual int get_bucket_stats(int shard_id,
                                 std::string *bucket_ver, std::string *master_ver,
                                 std::map<RGWObjCategory, RGWStorageStats>& stats,
                                 std::string *max_marker = nullptr,
                                 bool *syncstopped = nullptr) = 0;
+    virtual int get_bucket_stats_async(int shard_id, RGWGetBucketStats_CB *ctx) = 0;
     virtual int read_bucket_stats(const DoutPrefixProvider *dpp, optional_yield y) = 0;
     virtual int sync_user_stats(optional_yield y) = 0;
     virtual int update_container_stats(const DoutPrefixProvider *dpp) = 0;
     virtual int check_bucket_shards(const DoutPrefixProvider *dpp) = 0;
-    virtual int link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y) = 0;
-    virtual int unlink(RGWUser* new_user, optional_yield y) = 0;
-    virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y, const DoutPrefixProvider *dpp) = 0;
+    virtual int link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y, bool update_entrypoint = true, RGWObjVersionTracker* objv = nullptr) = 0;
+    virtual int unlink(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y, bool update_entrypoint = true) = 0;
+    virtual int chown(const DoutPrefixProvider *dpp, RGWUser* new_user, RGWUser* old_user, optional_yield y, const std::string* marker = nullptr) = 0;
     virtual int put_instance_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time mtime) = 0;
+    virtual int remove_entrypoint(const DoutPrefixProvider *dpp, RGWObjVersionTracker* objv, optional_yield y) = 0;
+    virtual int remove_instance_info(const DoutPrefixProvider *dpp, RGWObjVersionTracker* objv, optional_yield y) = 0;
     virtual bool is_owner(RGWUser* user) = 0;
     virtual RGWUser* get_owner(void) { return owner; };
     virtual ACLOwner get_acl_owner(void) { return ACLOwner(info.owner); };
@@ -248,6 +362,12 @@ class RGWBucket {
     virtual int read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
                           bool *is_truncated, RGWUsageIter& usage_iter,
                           map<rgw_user_bucket, rgw_usage_log_entry>& usage) = 0;
+    virtual int trim_usage(uint64_t start_epoch, uint64_t end_epoch) = 0;
+    virtual int remove_objs_from_index(std::list<rgw_obj_index_key>& objs_to_unlink) = 0;
+    virtual int check_index(std::map<RGWObjCategory, RGWStorageStats>& existing_stats, std::map<RGWObjCategory, RGWStorageStats>& calculated_stats) = 0;
+    virtual int rebuild_index() = 0;
+    virtual int set_tag_timeout(uint64_t timeout) = 0;
+    virtual int purge_instance(const DoutPrefixProvider *dpp) = 0;
 
     bool empty() const { return info.bucket.name.empty(); }
     const std::string& get_name() const { return info.bucket.name; }
@@ -294,6 +414,16 @@ class RGWBucket {
       return out;
     }
 
+    bool operator==(const RGWBucket& b) const {
+      return (info.bucket.tenant == b.info.bucket.tenant) &&
+            (info.bucket.name == b.info.bucket.name) &&
+            (info.bucket.bucket_id == b.info.bucket.bucket_id);
+    }
+    bool operator!=(const RGWBucket& b) const {
+      return (info.bucket.tenant != b.info.bucket.tenant) ||
+            (info.bucket.name != b.info.bucket.name) ||
+            (info.bucket.bucket_id != b.info.bucket.bucket_id);
+    }
 
     friend class RGWBucketList;
   protected:
@@ -382,7 +512,7 @@ class RGWObject {
        const bufferlist* data{nullptr};
        RGWObjManifest* manifest{nullptr};
        const string* ptag{nullptr};
-       list<rgw_obj_index_key>* remove_objs{nullptr};
+       std::list<rgw_obj_index_key>* remove_objs{nullptr};
        ceph::real_time set_mtime;
        ACLOwner owner;
        RGWObjCategory category{RGWObjCategory::Main};
@@ -407,6 +537,46 @@ class RGWObject {
       //virtual int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive) = 0;
     };
 
+    struct DeleteOp {
+      struct Params {
+        ACLOwner bucket_owner;
+        ACLOwner obj_owner;
+        int versioning_status{0};
+        uint64_t olh_epoch{0};
+        string marker_version_id;
+        uint32_t bilog_flags{0};
+        list<rgw_obj_index_key> *remove_objs{nullptr};
+        ceph::real_time expiration_time;
+        ceph::real_time unmod_since;
+        ceph::real_time mtime;
+        bool high_precision_time{false};
+        rgw_zone_set *zones_trace{nullptr};
+       bool abortmp{false};
+       uint64_t parts_accounted_size{0};
+      } params;
+
+      struct Result {
+        bool delete_marker{false};
+        string version_id;
+      } result;
+
+      virtual ~DeleteOp() = default;
+
+      virtual int delete_obj(const DoutPrefixProvider *dpp, optional_yield y) = 0;
+    };
+
+    struct StatOp {
+      struct Result {
+       RGWObject* obj;
+        RGWObjManifest* manifest;
+      } result;
+
+      virtual ~StatOp() = default;
+
+      virtual int stat_async() = 0;
+      virtual int wait() = 0;
+    };
+
     RGWObject()
       : key(),
       bucket(nullptr),
@@ -432,12 +602,9 @@ class RGWObject {
 
     virtual ~RGWObject() = default;
 
-    virtual int read(off_t offset, off_t length, std::iostream& stream) = 0;
-    virtual int write(off_t offset, off_t length, std::iostream& stream) = 0;
-    virtual int delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, ACLOwner obj_owner,
-                             ACLOwner bucket_owner, ceph::real_time unmod_since,
-                             bool high_precision_time, uint64_t epoch,
-                             std::string& version_id, optional_yield y) = 0;
+    virtual int delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, optional_yield y) = 0;
+    virtual int delete_obj_aio(const DoutPrefixProvider *dpp, RGWObjState *astate, Completions* aio,
+                              bool keep_index_consistent, optional_yield y) = 0;
     virtual int copy_object(RGWObjectCtx& obj_ctx, RGWUser* user,
                req_info *info, const rgw_zone_id& source_zone,
                rgw::sal::RGWObject* dest_object, rgw::sal::RGWBucket* dest_bucket,
@@ -461,7 +628,7 @@ class RGWObject {
     bool empty() const { return key.empty(); }
     const std::string &get_name() const { return key.name; }
 
-    virtual int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = false) = 0;
+    virtual int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWObjState **state, optional_yield y, bool follow_olh = false) = 0;
     virtual int set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj = NULL) = 0;
     virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj = NULL) = 0;
     virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp) = 0;
@@ -520,8 +687,15 @@ class RGWObject {
     /* OPs */
     virtual std::unique_ptr<ReadOp> get_read_op(RGWObjectCtx*) = 0;
     virtual std::unique_ptr<WriteOp> get_write_op(RGWObjectCtx*) = 0;
+    virtual std::unique_ptr<DeleteOp> get_delete_op(RGWObjectCtx*) = 0;
+    virtual std::unique_ptr<StatOp> get_stat_op(RGWObjectCtx*) = 0;
 
     /* OMAP */
+    virtual int omap_get_vals(const string& marker, uint64_t count,
+                             std::map<string, bufferlist> *m,
+                             bool *pmore, optional_yield y) = 0;
+    virtual int omap_get_all(std::map<string, bufferlist> *m,
+                            optional_yield y) = 0;
     virtual int omap_get_vals_by_keys(const std::string& oid,
                              const std::set<std::string>& keys,
                              RGWAttrs *vals) = 0;
@@ -616,5 +790,91 @@ public:
   virtual LCSerializer* get_serializer(const std::string& lock_name, const std::string& oid, const std::string& cookie) = 0;
 };
 
+class Notification {
+protected:
+  RGWObject* obj;
+  rgw::notify::EventType event_type;
+
+  public:
+    Notification(RGWObject* _obj, rgw::notify::EventType _type) : obj(_obj), event_type(_type) {}
+    virtual ~Notification() = default;
+
+    virtual int publish_reserve(RGWObjTags* obj_tags = nullptr) = 0;
+    virtual int publish_commit(const DoutPrefixProvider *dpp, uint64_t size,
+                              const ceph::real_time& mtime, const std::string& etag) = 0;
+};
+
+class GCChain {
+protected:
+  RGWObject* obj;
+
+  public:
+    GCChain(RGWObject* _obj) : obj(_obj) {}
+    virtual ~GCChain() = default;
+
+    virtual void update(RGWObjManifest* manifest) = 0;
+    virtual int send(const std::string& tag) = 0;
+    virtual void delete_inline(const std::string& tag) = 0;
+};
+
+using RawObjSet = std::set<rgw_raw_obj>;
+
+class Writer : public rgw::putobj::DataProcessor {
+protected:
+  Aio *const aio;
+  rgw::sal::RGWBucket* bucket;
+  RGWObjectCtx& obj_ctx;
+  std::unique_ptr<rgw::sal::RGWObject> head_obj;
+  RawObjSet written; // set of written objects for deletion
+  const DoutPrefixProvider *dpp;
+  optional_yield y;
+
+ public:
+  Writer(Aio *aio,
+             rgw::sal::RGWBucket* bucket,
+              RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
+              const DoutPrefixProvider *dpp, optional_yield y)
+    : aio(aio), bucket(bucket),
+      obj_ctx(obj_ctx), head_obj(std::move(_head_obj)), dpp(dpp), y(y)
+  {}
+  Writer(Writer&& r)
+    : aio(r.aio), bucket(r.bucket),
+      obj_ctx(r.obj_ctx), head_obj(std::move(r.head_obj)), dpp(r.dpp), y(r.y)
+  {}
+
+  ~Writer() = default;
+
+  // change the current stripe object
+  virtual int set_stripe_obj(const rgw_raw_obj& obj) = 0;
+
+  // write the data as an exclusive create and wait for it to complete
+  virtual int write_exclusive(const bufferlist& data) = 0;
+
+  virtual int drain() = 0;
+
+  // when the operation completes successfully, clear the set of written objects
+  // so they aren't deleted on destruction
+  virtual void clear_written() { written.clear(); }
+
+};
+
 } } // namespace rgw::sal
 
+class RGWStoreManager {
+public:
+  RGWStoreManager() {}
+  static rgw::sal::RGWStore *get_storage(const DoutPrefixProvider *dpp, CephContext *cct, const std::string svc, bool use_gc_thread, bool use_lc_thread, bool quota_threads,
+                               bool run_sync_thread, bool run_reshard_thread, bool use_cache = true) {
+    rgw::sal::RGWStore *store = init_storage_provider(dpp, cct, svc, use_gc_thread, use_lc_thread,
+        quota_threads, run_sync_thread, run_reshard_thread, use_cache);
+    return store;
+  }
+  static rgw::sal::RGWStore *get_raw_storage(const DoutPrefixProvider *dpp, CephContext *cct, const std::string svc) {
+    rgw::sal::RGWStore *store = init_raw_storage_provider(dpp, cct, svc);
+    return store;
+  }
+  static rgw::sal::RGWStore *init_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, const std::string svc, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache);
+  static rgw::sal::RGWStore *init_raw_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, const std::string svc);
+  static void close_storage(rgw::sal::RGWStore *store);
+
+};
index a37df7d147c2bdfbd4cf083ad51fc69c8069b4c2..6ef10b9b65c63e89927d3913f87497541b91e9f0 100644 (file)
 #include "rgw_bucket.h"
 #include "rgw_multi.h"
 #include "rgw_acl_s3.h"
+#include "rgw_aio.h"
 
 #include "rgw_zone.h"
 #include "rgw_rest_conn.h"
+#include "rgw_service.h"
 #include "services/svc_sys_obj.h"
 #include "services/svc_zone.h"
 #include "services/svc_tier_rados.h"
+#include "services/svc_quota.h"
+#include "rgw/services/svc_config_key.h"
 #include "cls/rgw/cls_rgw_client.h"
 
 #include "rgw_pubsub.h"
 
 namespace rgw::sal {
 
-int RGWRadosUser::list_buckets(const DoutPrefixProvider *dpp, const string& marker, const string& end_marker,
-                              uint64_t max, bool need_stats, RGWBucketList &buckets,
-                              optional_yield y)
+static int decode_policy(CephContext *cct,
+                         bufferlist& bl,
+                         RGWAccessControlPolicy *policy)
+{
+  auto iter = bl.cbegin();
+  try {
+    policy->decode(iter);
+  } catch (buffer::error& err) {
+    ldout(cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
+    return -EIO;
+  }
+  if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 15>()) {
+    ldout(cct, 15) << __func__ << " Read AccessControlPolicy";
+    RGWAccessControlPolicy_S3 *s3policy = static_cast<RGWAccessControlPolicy_S3 *>(policy);
+    s3policy->to_xml(*_dout);
+    *_dout << dendl;
+  }
+  return 0;
+}
+
+static int rgw_op_get_bucket_policy_from_attr(const DoutPrefixProvider *dpp,
+                                             RGWRadosStore *store,
+                                             RGWUser& user,
+                                             RGWAttrs& bucket_attrs,
+                                             RGWAccessControlPolicy *policy,
+                                             optional_yield y)
+{
+  auto aiter = bucket_attrs.find(RGW_ATTR_ACL);
+
+  if (aiter != bucket_attrs.end()) {
+    int ret = decode_policy(store->ctx(), aiter->second, policy);
+    if (ret < 0)
+      return ret;
+  } else {
+    ldout(store->ctx(), 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl;
+    /* object exists, but policy is broken */
+    int r = user.load_by_id(dpp, y);
+    if (r < 0)
+      return r;
+
+    policy->create_default(user.get_user(), user.get_display_name());
+  }
+  return 0;
+}
+
+static int process_completed(const AioResultList& completed, RawObjSet *written)
+{
+  std::optional<int> error;
+  for (auto& r : completed) {
+    if (r.result >= 0) {
+      written->insert(r.obj.get_ref().obj);
+    } else if (!error) { // record first error code
+      error = r.result;
+    }
+  }
+  return error.value_or(0);
+}
+
+int RadosCompletions::drain()
+{
+  int ret = 0;
+  while (!handles.empty()) {
+    librados::AioCompletion *handle = handles.front();
+    handles.pop_front();
+    handle->wait_for_complete();
+    int r = handle->get_return_value();
+    handle->release();
+    if (r < 0) {
+      ret = r;
+    }
+  }
+  return ret;
+}
+
+int RGWRadosUser::list_buckets(const DoutPrefixProvider *dpp, const string& marker,
+                              const string& end_marker, uint64_t max, bool need_stats,
+                              RGWBucketList &buckets, optional_yield y)
 {
   RGWUserBuckets ulist;
   bool is_truncated = false;
@@ -69,15 +147,54 @@ RGWBucket* RGWRadosUser::create_bucket(rgw_bucket& bucket,
   return NULL;
 }
 
-int RGWRadosUser::load_by_id(const DoutPrefixProvider *dpp, optional_yield y)
+int RGWRadosUser::read_attrs(const DoutPrefixProvider *dpp, optional_yield y, RGWAttrs* uattrs, RGWObjVersionTracker* tracker)
+{
+  return store->ctl()->user->get_attrs_by_uid(dpp, get_id(), uattrs, y, tracker);
+}
 
+int RGWRadosUser::read_stats(optional_yield y, RGWStorageStats* stats,
+                            ceph::real_time *last_stats_sync,
+                            ceph::real_time *last_stats_update)
 {
-    return store->ctl()->user->get_info_by_uid(dpp, info.user_id, &info, y);
+  return store->ctl()->user->read_stats(get_id(), stats, y, last_stats_sync, last_stats_update);
 }
 
-std::unique_ptr<RGWObject> RGWRadosStore::get_object(const rgw_obj_key& k)
+int RGWRadosUser::read_stats_async(RGWGetUserStats_CB *cb)
 {
-  return std::unique_ptr<RGWObject>(new RGWRadosObject(this, k));
+  return store->ctl()->user->read_stats_async(get_id(), cb);
+}
+
+int RGWRadosUser::complete_flush_stats(optional_yield y)
+{
+  return store->ctl()->user->complete_flush_stats(get_id(), y);
+}
+
+int RGWRadosUser::read_usage(uint64_t start_epoch, uint64_t end_epoch,
+                              uint32_t max_entries, bool *is_truncated,
+                              RGWUsageIter& usage_iter,
+                              map<rgw_user_bucket, rgw_usage_log_entry>& usage)
+{
+  std::string bucket_name;
+  return store->getRados()->read_usage(get_id(), bucket_name, start_epoch,
+                                      end_epoch, max_entries, is_truncated,
+                                      usage_iter, usage);
+}
+
+int RGWRadosUser::trim_usage(uint64_t start_epoch, uint64_t end_epoch)
+{
+  std::string bucket_name;
+
+  return store->getRados()->trim_usage(get_id(), bucket_name, start_epoch, end_epoch);
+}
+
+int RGWRadosUser::load_by_id(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::GetParams& params)
+{
+    return store->ctl()->user->get_info_by_uid(dpp, info.user_id, &info, y, params);
+}
+
+int RGWRadosUser::store_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::PutParams& params)
+{
+    return store->ctl()->user->store_info(dpp, info, y, params);
 }
 
 /* Placeholder */
@@ -118,7 +235,7 @@ int RGWRadosBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_chi
     for (const auto& obj : results.objs) {
       rgw_obj_key key(obj.key);
       /* xxx dang */
-      ret = rgw_remove_object(dpp, store, info, info.bucket, key);
+      ret = rgw_remove_object(dpp, store, this, key);
       if (ret < 0 && ret != -ENOENT) {
        return ret;
       }
@@ -127,7 +244,7 @@ int RGWRadosBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_chi
 
   /* If there's a prefix, then we are aborting multiparts as well */
   if (!prefix.empty()) {
-    ret = abort_bucket_multiparts(dpp, store, store->ctx(), info, prefix, delimiter);
+    ret = abort_bucket_multiparts(dpp, store, store->ctx(), this, prefix, delimiter);
     if (ret < 0) {
       return ret;
     }
@@ -182,14 +299,24 @@ int RGWRadosBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_chi
 int RGWRadosBucket::get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y)
 {
   auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
+  int ret;
+
   RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx);
   RGWObjVersionTracker ep_ot;
-  int ret = store->ctl()->bucket->read_bucket_info(info.bucket, &info, y, dpp,
+  if (info.bucket.bucket_id.empty()) {
+    ret = store->ctl()->bucket->read_bucket_info(info.bucket, &info, y, dpp,
                                      RGWBucketCtl::BucketInstance::GetParams()
                                      .set_mtime(&mtime)
                                      .set_attrs(&attrs)
                                       .set_bectx_params(bectx_params),
                                      &ep_ot);
+  } else {
+    ret  = store->ctl()->bucket->read_bucket_instance_info(info.bucket, &info, y, dpp,
+                                     RGWBucketCtl::BucketInstance::GetParams()
+                                     .set_mtime(&mtime)
+                                     .set_attrs(&attrs)
+                                     .set_bectx_params(bectx_params));
+  }
   if (ret == 0) {
     bucket_version = ep_ot.read_version;
     ent.placement_rule = info.placement_rule;
@@ -197,26 +324,17 @@ int RGWRadosBucket::get_bucket_info(const DoutPrefixProvider *dpp, optional_yiel
   return ret;
 }
 
-int RGWRadosBucket::load_by_name(const DoutPrefixProvider *dpp, const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y)
-{
-  info.bucket.tenant = tenant;
-  info.bucket.name = bucket_name;
-  info.bucket.bucket_id = bucket_instance_id;
-  ent.bucket = info.bucket;
-
-  if (bucket_instance_id.empty()) {
-    return get_bucket_info(dpp, y);
-  }
-
-  return store->getRados()->get_bucket_instance_info(*rctx, info.bucket, info, NULL, &attrs, y, dpp);
-}
-
-int RGWRadosBucket::get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id,
+int RGWRadosBucket::get_bucket_stats(int shard_id,
                                     std::string *bucket_ver, std::string *master_ver,
                                     std::map<RGWObjCategory, RGWStorageStats>& stats,
                                     std::string *max_marker, bool *syncstopped)
 {
-  return store->getRados()->get_bucket_stats(bucket_info, shard_id, bucket_ver, master_ver, stats, max_marker, syncstopped);
+  return store->getRados()->get_bucket_stats(info, shard_id, bucket_ver, master_ver, stats, max_marker, syncstopped);
+}
+
+int RGWRadosBucket::get_bucket_stats_async(int shard_id, RGWGetBucketStats_CB *ctx)
+{
+  return store->getRados()->get_bucket_stats_async(get_info(), shard_id, ctx);
 }
 
 int RGWRadosBucket::read_bucket_stats(const DoutPrefixProvider *dpp, optional_yield y)
@@ -264,7 +382,7 @@ int RGWRadosBucket::check_bucket_shards(const DoutPrefixProvider *dpp)
       return store->getRados()->check_bucket_shards(info, info.bucket, get_count(), dpp);
 }
 
-int RGWRadosBucket::link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y)
+int RGWRadosBucket::link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y, bool update_entrypoint, RGWObjVersionTracker* objv)
 {
   RGWBucketEntryPoint ep;
   ep.bucket = info.bucket;
@@ -274,21 +392,32 @@ int RGWRadosBucket::link(const DoutPrefixProvider *dpp, RGWUser* new_user, optio
   RGWAttrs ep_attrs;
   rgw_ep_info ep_data{ep, ep_attrs};
 
-  return store->ctl()->bucket->link_bucket(new_user->get_user(), info.bucket,
-                                          ceph::real_time(), y, dpp, true, &ep_data);
+  int r = store->ctl()->bucket->link_bucket(new_user->get_user(), info.bucket,
+                                           get_creation_time(), y, dpp, update_entrypoint,
+                                           &ep_data);
+  if (r < 0)
+    return r;
+
+  if (objv)
+    *objv = ep_data.ep_objv;
+
+  return r;
 }
 
-int RGWRadosBucket::unlink(RGWUser* new_user, optional_yield y)
+int RGWRadosBucket::unlink(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y, bool update_entrypoint)
 {
-  return -1;
+  return store->ctl()->bucket->unlink_bucket(new_user->get_id(), info.bucket, y, dpp, update_entrypoint);
 }
 
-int RGWRadosBucket::chown(RGWUser* new_user, RGWUser* old_user, optional_yield y, const DoutPrefixProvider *dpp)
+int RGWRadosBucket::chown(const DoutPrefixProvider *dpp, RGWUser* new_user, RGWUser* old_user, optional_yield y, const std::string* marker)
 {
   string obj_marker;
 
-  return store->ctl()->bucket->chown(store, info, new_user->get_user(),
-                          old_user->get_display_name(), obj_marker, y, dpp);
+  if (marker == nullptr)
+    marker = &obj_marker;
+
+  return store->ctl()->bucket->chown(store, this, new_user->get_user(),
+                          old_user->get_display_name(), *marker, y, dpp);
 }
 
 int RGWRadosBucket::put_instance_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time _mtime)
@@ -297,6 +426,20 @@ int RGWRadosBucket::put_instance_info(const DoutPrefixProvider *dpp, bool exclus
   return store->getRados()->put_bucket_instance_info(info, exclusive, mtime, &attrs, dpp);
 }
 
+int RGWRadosBucket::remove_entrypoint(const DoutPrefixProvider *dpp, RGWObjVersionTracker* objv, optional_yield y)
+{
+  return store->ctl()->bucket->remove_bucket_entrypoint_info(get_key(), y, dpp,
+                                           RGWBucketCtl::Bucket::RemoveParams()
+                                           .set_objv_tracker(objv));
+}
+
+int RGWRadosBucket::remove_instance_info(const DoutPrefixProvider *dpp, RGWObjVersionTracker* objv, optional_yield y)
+{
+  return store->ctl()->bucket->remove_bucket_instance_info(get_key(), info, y, dpp,
+                                           RGWBucketCtl::BucketInstance::RemoveParams()
+                                           .set_objv_tracker(objv));
+}
+
 /* Make sure to call get_bucket_info() if you need it first */
 bool RGWRadosBucket::is_owner(RGWUser* user)
 {
@@ -331,9 +474,56 @@ int RGWRadosBucket::read_usage(uint64_t start_epoch, uint64_t end_epoch,
                               RGWUsageIter& usage_iter,
                               map<rgw_user_bucket, rgw_usage_log_entry>& usage)
 {
-    return store->getRados()->read_usage(owner->get_id(), get_name(), start_epoch,
-                                        end_epoch, max_entries, is_truncated,
-                                        usage_iter, usage);
+  return store->getRados()->read_usage(owner->get_id(), get_name(), start_epoch,
+                                      end_epoch, max_entries, is_truncated,
+                                      usage_iter, usage);
+}
+
+int RGWRadosBucket::trim_usage(uint64_t start_epoch, uint64_t end_epoch)
+{
+  return store->getRados()->trim_usage(owner->get_id(), get_name(), start_epoch, end_epoch);
+}
+
+int RGWRadosBucket::remove_objs_from_index(std::list<rgw_obj_index_key>& objs_to_unlink)
+{
+  return store->getRados()->remove_objs_from_index(info, objs_to_unlink);
+}
+
+int RGWRadosBucket::check_index(std::map<RGWObjCategory, RGWStorageStats>& existing_stats, std::map<RGWObjCategory, RGWStorageStats>& calculated_stats)
+{
+  return store->getRados()->bucket_check_index(info, &existing_stats, &calculated_stats);
+}
+
+int RGWRadosBucket::rebuild_index()
+{
+  return store->getRados()->bucket_rebuild_index(info);
+}
+
+int RGWRadosBucket::set_tag_timeout(uint64_t timeout)
+{
+  return store->getRados()->cls_obj_set_bucket_tag_timeout(info, timeout);
+}
+
+int RGWRadosBucket::purge_instance(const DoutPrefixProvider *dpp)
+{
+  int max_shards = (info.layout.current_index.layout.normal.num_shards > 0 ? info.layout.current_index.layout.normal.num_shards : 1);
+  for (int i = 0; i < max_shards; i++) {
+    RGWRados::BucketShard bs(store->getRados());
+    int shard_id = (info.layout.current_index.layout.normal.num_shards > 0  ? i : -1);
+    int ret = bs.init(info.bucket, shard_id, info.layout.current_index, nullptr, dpp);
+    if (ret < 0) {
+      cerr << "ERROR: bs.init(bucket=" << info.bucket << ", shard=" << shard_id
+           << "): " << cpp_strerror(-ret) << std::endl;
+      return ret;
+    }
+    ret = store->getRados()->bi_remove(bs);
+    if (ret < 0) {
+      cerr << "ERROR: failed to remove bucket index object: "
+           << cpp_strerror(-ret) << std::endl;
+      return ret;
+    }
+  }
+  return 0;
 }
 
 int RGWRadosBucket::set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy &acl, optional_yield y)
@@ -364,6 +554,9 @@ int RGWRadosBucket::list(const DoutPrefixProvider *dpp, ListParams& params, int
   list_op.params.marker = params.marker;
   list_op.params.ns = params.ns;
   list_op.params.end_marker = params.end_marker;
+  list_op.params.ns = params.ns;
+  list_op.params.enforce_ns = params.enforce_ns;
+  list_op.params.filter = params.filter;
   list_op.params.list_versions = params.list_versions;
   list_op.params.allow_unordered = params.allow_unordered;
 
@@ -380,148 +573,572 @@ std::unique_ptr<RGWUser> RGWRadosStore::get_user(const rgw_user &u)
   return std::unique_ptr<RGWUser>(new RGWRadosUser(this, u));
 }
 
-//RGWBucket *RGWRadosStore::create_bucket(RGWUser &u, const rgw_bucket &b)
-//{
-  //if (!bucket) {
-    //bucket = new RGWRadosBucket(this, u, b);
-  //}
-//
-  //return bucket;
-//}
-//
-void RGWRadosStore::finalize(void)
+int RGWRadosStore::get_user(const DoutPrefixProvider *dpp, const RGWAccessKey& key, optional_yield y, std::unique_ptr<RGWUser>* user)
 {
-  if (rados)
-    rados->finalize();
-}
+  RGWUserInfo uinfo;
+  RGWUser *u;
 
-int RGWObject::range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end)
-{
-  if (ofs < 0) {
-    ofs += obj_size;
-    if (ofs < 0)
-      ofs = 0;
-    end = obj_size - 1;
-  } else if (end < 0) {
-    end = obj_size - 1;
-  }
+  int r = ctl()->user->get_info_by_access_key(dpp, key.id, &uinfo, y);
+  if (r < 0)
+    return r;
 
-  if (obj_size > 0) {
-    if (ofs >= (off_t)obj_size) {
-      return -ERANGE;
-    }
-    if (end >= (off_t)obj_size) {
-      end = obj_size - 1;
-    }
-  }
+  u = new RGWRadosUser(this, uinfo);
+  if (!u)
+    return -ENOMEM;
+
+  user->reset(u);
   return 0;
 }
 
-int RGWRadosObject::get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh)
+int RGWRadosStore::get_user_by_email(const DoutPrefixProvider *dpp, const std::string& email, optional_yield y, std::unique_ptr<RGWUser>* user)
 {
-  rgw_obj obj(bucket.get_key(), key.name);
+  RGWUserInfo uinfo;
+  RGWUser *u;
 
-  return store->getRados()->get_obj_state(dpp, rctx, bucket.get_info(), obj, state, follow_olh, y);
-}
+  int r = ctl()->user->get_info_by_email(dpp, email, &uinfo, y);
+  if (r < 0)
+    return r;
 
-int RGWRadosObject::read_attrs(RGWRados::Object::Read &read_op, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj *target_obj)
-{
-  read_op.params.attrs = &attrs;
-  read_op.params.target_obj = target_obj;
-  read_op.params.obj_size = &obj_size;
-  read_op.params.lastmod = &mtime;
+  u = new RGWRadosUser(this, uinfo);
+  if (!u)
+    return -ENOMEM;
 
-  return read_op.prepare(y, dpp);
+  user->reset(u);
+  return 0;
 }
 
-int RGWRadosObject::set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj)
+int RGWRadosStore::get_user_by_swift(const DoutPrefixProvider *dpp, const std::string& user_str, optional_yield y, std::unique_ptr<RGWUser>* user)
 {
-  RGWAttrs empty;
-  rgw_obj target = get_obj();
+  RGWUserInfo uinfo;
+  RGWUser *u;
 
-  if (!target_obj)
-    target_obj = &target;
-
-  return store->getRados()->set_attrs(dpp, rctx,
-                       bucket->get_info(),
-                       *target_obj,
-                       setattrs ? *setattrs : empty,
-                       delattrs ? delattrs : nullptr,
-                       y);
-}
+  int r = ctl()->user->get_info_by_swift(dpp, user_str, &uinfo, y);
+  if (r < 0)
+    return r;
 
-int RGWRadosObject::get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj)
-{
-  RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rctx, get_obj());
-  RGWRados::Object::Read read_op(&op_target);
+  u = new RGWRadosUser(this, uinfo);
+  if (!u)
+    return -ENOMEM;
 
-  return read_attrs(read_op, y, dpp, target_obj);
+  user->reset(u);
+  return 0;
 }
 
-int RGWRadosObject::modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp)
+std::unique_ptr<RGWObject> RGWRadosStore::get_object(const rgw_obj_key& k)
 {
-  rgw_obj target = get_obj();
-  int r = get_obj_attrs(rctx, y, dpp, &target);
-  if (r < 0) {
-    return r;
-  }
-  set_atomic(rctx);
-  attrs[attr_name] = attr_val;
-  return set_obj_attrs(dpp, rctx, &attrs, nullptr, y, &target);
+  return std::unique_ptr<RGWObject>(new RGWRadosObject(this, k));
 }
 
-int RGWRadosObject::delete_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const char *attr_name, optional_yield y)
+int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y)
 {
-  RGWAttrs rmattr;
-  bufferlist bl;
+  int ret;
+  RGWBucket* bp;
 
-  set_atomic(rctx);
-  rmattr[attr_name] = bl;
-  return set_obj_attrs(dpp, rctx, nullptr, &rmattr, y);
+  bp = new RGWRadosBucket(this, b, u);
+  ret = bp->get_bucket_info(dpp, y);
+  if (ret < 0) {
+    delete bp;
+    return ret;
+  }
+
+  bucket->reset(bp);
+  return 0;
 }
 
-int RGWRadosObject::copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket,
-                                 RGWObject* dest_obj,
-                                 uint16_t olh_epoch,
-                                 std::string* petag,
-                                 const DoutPrefixProvider *dpp,
-                                 optional_yield y)
+int RGWRadosStore::get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket)
 {
-  RGWAttrs attrset;
-  RGWRados::Object op_target(store->getRados(), dest_bucket->get_info(), rctx, get_obj());
-  RGWRados::Object::Read read_op(&op_target);
-
-  int ret = read_attrs(read_op, y, dpp);
-  if (ret < 0)
-    return ret;
-
-  attrset = attrs;
+  RGWBucket* bp;
 
-  attrset.erase(RGW_ATTR_ID_TAG);
-  attrset.erase(RGW_ATTR_TAIL_TAG);
+  bp = new RGWRadosBucket(this, i, u);
+  /* Don't need to fetch the bucket info, use the provided one */
 
-  return store->getRados()->copy_obj_data(rctx, dest_bucket,
-                                         dest_bucket->get_info().placement_rule, read_op,
-                                         obj_size - 1, dest_obj, NULL, mtime, attrset, 0,
-                                         real_time(), NULL, dpp, y);
+  bucket->reset(bp);
+  return 0;
 }
 
-void RGWRadosObject::set_atomic(RGWObjectCtx *rctx) const
+int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const std::string& tenant, const std::string& name, std::unique_ptr<RGWBucket>* bucket, optional_yield y)
 {
-  rgw_obj obj = get_obj();
-  store->getRados()->set_atomic(rctx, obj);
-}
+  rgw_bucket b;
 
-void RGWRadosObject::set_prefetch_data(RGWObjectCtx *rctx)
-{
-  rgw_obj obj = get_obj();
-  store->getRados()->set_prefetch_data(rctx, obj);
+  b.tenant = tenant;
+  b.name = name;
+
+  return get_bucket(dpp, u, b, bucket, y);
 }
 
-bool RGWRadosObject::is_expired() {
-  auto iter = attrs.find(RGW_ATTR_DELETE_AT);
-  if (iter != attrs.end()) {
-    utime_t delete_at;
+int RGWRadosStore::create_bucket(const DoutPrefixProvider *dpp,
+                                RGWUser& u, const rgw_bucket& b,
+                                const string& zonegroup_id,
+                                rgw_placement_rule& placement_rule,
+                                string& swift_ver_location,
+                                const RGWQuotaInfo * pquota_info,
+                                const RGWAccessControlPolicy& policy,
+                                RGWAttrs& attrs,
+                                RGWBucketInfo& info,
+                                obj_version& ep_objv,
+                                bool exclusive,
+                                bool obj_lock_enabled,
+                                bool *existed,
+                                req_info& req_info,
+                                std::unique_ptr<RGWBucket>* bucket_out,
+                                optional_yield y)
+{
+  int ret;
+  bufferlist in_data;
+  RGWBucketInfo master_info;
+  rgw_bucket *pmaster_bucket;
+  uint32_t *pmaster_num_shards;
+  real_time creation_time;
+  std::unique_ptr<RGWBucket> bucket;
+  obj_version objv, *pobjv = NULL;
+
+  /* If it exists, look it up; otherwise create it */
+  ret = get_bucket(dpp, &u, b, &bucket, y);
+  if (ret < 0 && ret != -ENOENT)
+    return ret;
+
+  if (ret != -ENOENT) {
+    RGWAccessControlPolicy old_policy(ctx());
+    *existed = true;
+    if (swift_ver_location.empty()) {
+      swift_ver_location = bucket->get_info().swift_ver_location;
+    }
+    placement_rule.inherit_from(bucket->get_info().placement_rule);
+
+    // don't allow changes to the acl policy
+    int r = rgw_op_get_bucket_policy_from_attr(dpp, this, u, bucket->get_attrs(),
+                                              &old_policy, y);
+    if (r >= 0 && old_policy != policy) {
+      bucket_out->swap(bucket);
+      return -EEXIST;
+    }
+  } else {
+    bucket = std::unique_ptr<RGWBucket>(new RGWRadosBucket(this, b, &u));
+    *existed = false;
+    bucket->set_attrs(attrs);
+  }
+
+  if (!svc()->zone->is_meta_master()) {
+    JSONParser jp;
+    ret = forward_request_to_master(&u, NULL, in_data, &jp, req_info, y);
+    if (ret < 0) {
+      return ret;
+    }
+
+    JSONDecoder::decode_json("entry_point_object_ver", ep_objv, &jp);
+    JSONDecoder::decode_json("object_ver", objv, &jp);
+    JSONDecoder::decode_json("bucket_info", master_info, &jp);
+    ldpp_dout(dpp, 20) << "parsed: objv.tag=" << objv.tag << " objv.ver=" << objv.ver << dendl;
+    std::time_t ctime = ceph::real_clock::to_time_t(master_info.creation_time);
+    ldpp_dout(dpp, 20) << "got creation time: << " << std::put_time(std::localtime(&ctime), "%F %T") << dendl;
+    pmaster_bucket= &master_info.bucket;
+    creation_time = master_info.creation_time;
+    pmaster_num_shards = &master_info.layout.current_index.layout.normal.num_shards;
+    pobjv = &objv;
+    if (master_info.obj_lock_enabled()) {
+      info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
+    }
+  } else {
+    pmaster_bucket = NULL;
+    pmaster_num_shards = NULL;
+    if (obj_lock_enabled)
+      info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
+  }
+
+  std::string zid = zonegroup_id;
+  if (zid.empty()) {
+    zid = svc()->zone->get_zonegroup().get_id();
+  }
+
+  if (*existed) {
+    rgw_placement_rule selected_placement_rule;
+    ret = svc()->zone->select_bucket_placement(u.get_info(),
+                                              zid, placement_rule,
+                                              &selected_placement_rule, nullptr, y);
+    if (selected_placement_rule != info.placement_rule) {
+      ret = -EEXIST;
+      bucket_out->swap(bucket);
+      return ret;
+    }
+  } else {
+
+    ret = getRados()->create_bucket(u.get_info(), bucket->get_key(),
+                                   zid, placement_rule, swift_ver_location, pquota_info,
+                                   attrs, info, pobjv, &ep_objv, creation_time,
+                                   pmaster_bucket, pmaster_num_shards, y, dpp,
+                                   exclusive);
+    if (ret == -EEXIST) {
+      *existed = true;
+      ret = 0;
+    } else if (ret != 0) {
+      return ret;
+    }
+  }
+
+  bucket->set_version(ep_objv);
+  bucket->get_info() = info;
+
+  bucket_out->swap(bucket);
+
+  return ret;
+}
+
+bool RGWRadosStore::is_meta_master()
+{
+  return svc()->zone->is_meta_master();
+}
+
+int RGWRadosStore::forward_request_to_master(RGWUser* user, obj_version *objv,
+                                            bufferlist& in_data,
+                                            JSONParser *jp, req_info& info,
+                                            optional_yield y)
+{
+  if (is_meta_master()) {
+    /* We're master, don't forward */
+    return 0;
+  }
+
+  if (!svc()->zone->get_master_conn()) {
+    ldout(ctx(), 0) << "rest connection is invalid" << dendl;
+    return -EINVAL;
+  }
+  ldout(ctx(), 0) << "sending request to master zonegroup" << dendl;
+  bufferlist response;
+  string uid_str = user->get_id().to_str();
+#define MAX_REST_RESPONSE (128 * 1024) // we expect a very small response
+  int ret = svc()->zone->get_master_conn()->forward(rgw_user(uid_str), info,
+                                                    objv, MAX_REST_RESPONSE,
+                                                   &in_data, &response, y);
+  if (ret < 0)
+    return ret;
+
+  ldout(ctx(), 20) << "response: " << response.c_str() << dendl;
+  if (jp && !jp->parse(response.c_str(), response.length())) {
+    ldout(ctx(), 0) << "failed parsing response from master zonegroup" << dendl;
+    return -EINVAL;
+  }
+
+  return 0;
+}
+
+int RGWRadosStore::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, optional_yield y)
+{
+  return rados->defer_gc(dpp, rctx, bucket->get_info(), obj->get_obj(), y);
+}
+
+const RGWZoneGroup& RGWRadosStore::get_zonegroup()
+{
+  return svc()->zone->get_zonegroup();
+}
+
+int RGWRadosStore::get_zonegroup(const string& id, RGWZoneGroup& zonegroup)
+{
+  return svc()->zone->get_zonegroup(id, zonegroup);
+}
+
+const RGWZoneParams& RGWRadosStore::get_zone_params()
+{
+  return svc()->zone->get_zone_params();
+}
+
+const rgw_zone_id& RGWRadosStore::get_zone_id()
+{
+  return svc()->zone->zone_id();
+}
+
+const RGWRealm& RGWRadosStore::get_realm()
+{
+  return svc()->zone->get_realm();
+}
+
+int RGWRadosStore::cluster_stat(RGWClusterStat& stats)
+{
+  rados_cluster_stat_t rados_stats;
+  int ret;
+
+  ret = rados->get_rados_handle()->cluster_stat(rados_stats);
+  if (ret < 0)
+    return ret;
+
+  stats.kb = rados_stats.kb;
+  stats.kb_used = rados_stats.kb_used;
+  stats.kb_avail = rados_stats.kb_avail;
+  stats.num_objects = rados_stats.num_objects;
+
+  return ret;
+}
+
+std::unique_ptr<Lifecycle> RGWRadosStore::get_lifecycle(void)
+{
+  return std::unique_ptr<Lifecycle>(new RadosLifecycle(this));
+}
+
+std::unique_ptr<Completions> RGWRadosStore::get_completions(void)
+{
+  return std::unique_ptr<Completions>(new RadosCompletions());
+}
+
+std::unique_ptr<Notification> RGWRadosStore::get_notification(rgw::sal::RGWObject* obj,
+                                                           struct req_state* s,
+                                                           rgw::notify::EventType event_type)
+{
+  return std::unique_ptr<Notification>(new RadosNotification(this, obj, s, event_type));
+}
+
+std::unique_ptr<GCChain> RGWRadosStore::get_gc_chain(rgw::sal::RGWObject* obj)
+{
+  return std::unique_ptr<GCChain>(new RadosGCChain(this, obj));
+}
+
+std::unique_ptr<Writer> RGWRadosStore::get_writer(Aio *aio, rgw::sal::RGWBucket* bucket,
+              RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
+              const DoutPrefixProvider *dpp, optional_yield y)
+{
+  return std::unique_ptr<Writer>(new RadosWriter(aio, this, bucket, obj_ctx, std::move(_head_obj), dpp, y));
+}
+
+int RGWRadosStore::delete_raw_obj(const rgw_raw_obj& obj)
+{
+  return rados->delete_raw_obj(obj);
+}
+
+int RGWRadosStore::delete_raw_obj_aio(const rgw_raw_obj& obj, Completions* aio)
+{
+  RadosCompletions *raio = static_cast<RadosCompletions*>(aio);
+
+  return rados->delete_raw_obj_aio(obj, raio->handles);
+}
+
+void RGWRadosStore::get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj)
+{
+    rados->obj_to_raw(placement_rule, obj, raw_obj);
+}
+
+int RGWRadosStore::get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size)
+{
+  return rados->get_max_chunk_size(obj.pool, chunk_size, dpp);
+}
+
+int RGWRadosStore::log_usage(map<rgw_user_bucket, RGWUsageBatch>& usage_info)
+{
+    return rados->log_usage(usage_info);
+}
+
+int RGWRadosStore::log_op(string& oid, bufferlist& bl)
+{
+  rgw_raw_obj obj(svc()->zone->get_zone_params().log_pool, oid);
+
+  int ret = rados->append_async(obj, bl.length(), bl);
+  if (ret == -ENOENT) {
+    ret = rados->create_pool(svc()->zone->get_zone_params().log_pool);
+    if (ret < 0)
+      return ret;
+    // retry
+    ret = rados->append_async(obj, bl.length(), bl);
+  }
+
+  return ret;
+}
+
+int RGWRadosStore::register_to_service_map(const string& daemon_type,
+                                          const map<string, string>& meta)
+{
+  return rados->register_to_service_map(daemon_type, meta);
+}
+
+void RGWRadosStore::get_quota(RGWQuotaInfo& bucket_quota, RGWQuotaInfo& user_quota)
+{
+    bucket_quota = svc()->quota->get_bucket_quota();
+    user_quota = svc()->quota->get_user_quota();
+}
+
+int RGWRadosStore::list_raw_objects(const rgw_pool& pool, const string& prefix_filter,
+                                   int max, RGWListRawObjsCtx& ctx, list<string>& oids,
+                                   bool *is_truncated)
+{
+    return rados->list_raw_objects(pool, prefix_filter, max, ctx, oids, is_truncated);
+}
+
+int RGWRadosStore::set_buckets_enabled(const DoutPrefixProvider *dpp, vector<rgw_bucket>& buckets, bool enabled)
+{
+    return rados->set_buckets_enabled(buckets, enabled, dpp);
+}
+
+int RGWRadosStore::get_sync_policy_handler(const DoutPrefixProvider *dpp,
+                                          std::optional<rgw_zone_id> zone,
+                                          std::optional<rgw_bucket> bucket,
+                                          RGWBucketSyncPolicyHandlerRef *phandler,
+                                          optional_yield y)
+{
+  return ctl()->bucket->get_sync_policy_handler(zone, bucket, phandler, y, dpp);
+}
+
+RGWDataSyncStatusManager* RGWRadosStore::get_data_sync_manager(const rgw_zone_id& source_zone)
+{
+  return rados->get_data_sync_manager(source_zone);
+}
+
+int RGWRadosStore::read_all_usage(uint64_t start_epoch, uint64_t end_epoch,
+                                 uint32_t max_entries, bool *is_truncated,
+                                 RGWUsageIter& usage_iter,
+                                 map<rgw_user_bucket, rgw_usage_log_entry>& usage)
+{
+  rgw_user uid;
+  std::string bucket_name;
+
+  return rados->read_usage(uid, bucket_name, start_epoch, end_epoch, max_entries,
+                          is_truncated, usage_iter, usage);
+}
+
+int RGWRadosStore::trim_all_usage(uint64_t start_epoch, uint64_t end_epoch)
+{
+  rgw_user uid;
+  std::string bucket_name;
+
+  return rados->trim_usage(uid, bucket_name, start_epoch, end_epoch);
+}
+
+int RGWRadosStore::get_config_key_val(string name, bufferlist *bl)
+{
+  return svc()->config_key->get(name, true, bl);
+}
+
+void RGWRadosStore::finalize(void)
+{
+  if (rados)
+    rados->finalize();
+}
+
+int RGWRadosStore::get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx)
+{
+  return rados->get_obj_head_ioctx(bucket_info, obj, ioctx);
+}
+
+int RGWObject::range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end)
+{
+  if (ofs < 0) {
+    ofs += obj_size;
+    if (ofs < 0)
+      ofs = 0;
+    end = obj_size - 1;
+  } else if (end < 0) {
+    end = obj_size - 1;
+  }
+
+  if (obj_size > 0) {
+    if (ofs >= (off_t)obj_size) {
+      return -ERANGE;
+    }
+    if (end >= (off_t)obj_size) {
+      end = obj_size - 1;
+    }
+  }
+  return 0;
+}
+
+int RGWRadosObject::get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWObjState **state, optional_yield y, bool follow_olh)
+{
+  return store->getRados()->get_obj_state(dpp, rctx, bucket->get_info(), get_obj(), state, follow_olh, y);
+}
+
+int RGWRadosObject::read_attrs(const DoutPrefixProvider *dpp, RGWRados::Object::Read &read_op, optional_yield y, rgw_obj *target_obj)
+{
+  read_op.params.attrs = &attrs;
+  read_op.params.target_obj = target_obj;
+  read_op.params.obj_size = &obj_size;
+  read_op.params.lastmod = &mtime;
+
+  return read_op.prepare(y, dpp);
+}
+
+int RGWRadosObject::set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj)
+{
+  RGWAttrs empty;
+  rgw_obj target = get_obj();
+
+  if (!target_obj)
+    target_obj = &target;
+
+  return store->getRados()->set_attrs(dpp, rctx,
+                       bucket->get_info(),
+                       *target_obj,
+                       setattrs ? *setattrs : empty,
+                       delattrs ? delattrs : nullptr,
+                       y);
+}
+
+int RGWRadosObject::get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj)
+{
+  RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rctx, get_obj());
+  RGWRados::Object::Read read_op(&op_target);
+
+  return read_attrs(dpp, read_op, y, target_obj);
+}
+
+int RGWRadosObject::modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp)
+{
+  rgw_obj target = get_obj();
+  int r = get_obj_attrs(rctx, y, dpp, &target);
+  if (r < 0) {
+    return r;
+  }
+  set_atomic(rctx);
+  attrs[attr_name] = attr_val;
+  return set_obj_attrs(dpp, rctx, &attrs, nullptr, y, &target);
+}
+
+int RGWRadosObject::delete_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const char *attr_name, optional_yield y)
+{
+  RGWAttrs rmattr;
+  bufferlist bl;
+
+  set_atomic(rctx);
+  rmattr[attr_name] = bl;
+  return set_obj_attrs(dpp, rctx, nullptr, &rmattr, y);
+}
+
+int RGWRadosObject::copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket,
+                                 RGWObject* dest_obj,
+                                 uint16_t olh_epoch,
+                                 std::string* petag,
+                                 const DoutPrefixProvider *dpp,
+                                 optional_yield y)
+{
+  RGWAttrs attrset;
+  RGWRados::Object op_target(store->getRados(), dest_bucket->get_info(), rctx, get_obj());
+  RGWRados::Object::Read read_op(&op_target);
+
+  int ret = read_attrs(dpp, read_op, y);
+  if (ret < 0)
+    return ret;
+
+  attrset = attrs;
+
+  attrset.erase(RGW_ATTR_ID_TAG);
+  attrset.erase(RGW_ATTR_TAIL_TAG);
+
+  return store->getRados()->copy_obj_data(rctx, dest_bucket,
+                                         dest_bucket->get_info().placement_rule, read_op,
+                                         obj_size - 1, dest_obj, NULL, mtime, attrset, 0,
+                                         real_time(), NULL, dpp, y);
+}
+
+void RGWRadosObject::set_atomic(RGWObjectCtx *rctx) const
+{
+  rgw_obj obj = get_obj();
+  store->getRados()->set_atomic(rctx, obj);
+}
+
+void RGWRadosObject::set_prefetch_data(RGWObjectCtx *rctx)
+{
+  rgw_obj obj = get_obj();
+  store->getRados()->set_prefetch_data(rctx, obj);
+}
+
+bool RGWRadosObject::is_expired() {
+  auto iter = attrs.find(RGW_ATTR_DELETE_AT);
+  if (iter != attrs.end()) {
+    utime_t delete_at;
     try {
       auto bufit = iter->second.cbegin();
       decode(delete_at, bufit);
@@ -555,6 +1172,29 @@ void RGWRadosObject::get_raw_obj(rgw_raw_obj* raw_obj)
   store->getRados()->obj_to_raw((bucket->get_info()).placement_rule, get_obj(), raw_obj);
 }
 
+int RGWRadosObject::omap_get_vals(const string& marker, uint64_t count,
+                                 std::map<string, bufferlist> *m,
+                                 bool *pmore, optional_yield y)
+{
+  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
+  rgw_raw_obj raw_obj;
+  get_raw_obj(&raw_obj);
+  auto sysobj = obj_ctx.get_obj(raw_obj);
+
+  return sysobj.omap().get_vals(marker, count, m, pmore, y);
+}
+
+int RGWRadosObject::omap_get_all(std::map<string, bufferlist> *m,
+                                optional_yield y)
+{
+  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
+  rgw_raw_obj raw_obj;
+  get_raw_obj(&raw_obj);
+  auto sysobj = obj_ctx.get_obj(raw_obj);
+
+  return sysobj.omap().get_all(m, y);
+}
+
 int RGWRadosObject::omap_get_vals_by_keys(const std::string& oid,
                                          const std::set<std::string>& keys,
                                          RGWAttrs *vals)
@@ -692,25 +1332,106 @@ int RGWRadosObject::RadosReadOp::get_attr(const DoutPrefixProvider *dpp, const c
   return parent_op.get_attr(dpp, name, dest, y);
 }
 
-int RGWRadosObject::delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, ACLOwner obj_owner, ACLOwner bucket_owner, ceph::real_time unmod_since, bool high_precision_time, uint64_t epoch, string& version_id, optional_yield y)
+std::unique_ptr<RGWObject::DeleteOp> RGWRadosObject::get_delete_op(RGWObjectCtx *ctx)
+{
+  return std::unique_ptr<RGWObject::DeleteOp>(new RGWRadosObject::RadosDeleteOp(this, ctx));
+}
+
+RGWRadosObject::RadosDeleteOp::RadosDeleteOp(RGWRadosObject *_source, RGWObjectCtx *_rctx) :
+       source(_source),
+       rctx(_rctx),
+       op_target(_source->store->getRados(),
+                 _source->get_bucket()->get_info(),
+                 *static_cast<RGWObjectCtx *>(rctx),
+                 _source->get_obj()),
+       parent_op(&op_target)
+{ }
+
+int RGWRadosObject::RadosDeleteOp::delete_obj(const DoutPrefixProvider *dpp, optional_yield y)
+{
+  parent_op.params.bucket_owner = params.bucket_owner.get_id();
+  parent_op.params.versioning_status = params.versioning_status;
+  parent_op.params.obj_owner = params.obj_owner;
+  parent_op.params.olh_epoch = params.olh_epoch;
+  parent_op.params.marker_version_id = params.marker_version_id;
+  parent_op.params.bilog_flags = params.bilog_flags;
+  parent_op.params.remove_objs = params.remove_objs;
+  parent_op.params.expiration_time = params.expiration_time;
+  parent_op.params.unmod_since = params.unmod_since;
+  parent_op.params.mtime = params.mtime;
+  parent_op.params.high_precision_time = params.high_precision_time;
+  parent_op.params.zones_trace = params.zones_trace;
+  parent_op.params.abortmp = params.abortmp;
+  parent_op.params.parts_accounted_size = params.parts_accounted_size;
+
+  int ret = parent_op.delete_obj(y, dpp);
+  if (ret < 0)
+    return ret;
+
+  result.delete_marker = parent_op.result.delete_marker;
+  result.version_id = parent_op.result.version_id;
+
+  return ret;
+}
+
+int RGWRadosObject::delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, optional_yield y)
 {
-  int ret = 0;
   RGWRados::Object del_target(store->getRados(), bucket->get_info(), *obj_ctx, get_obj());
   RGWRados::Object::Delete del_op(&del_target);
 
-  del_op.params.olh_epoch = epoch;
-  del_op.params.marker_version_id = version_id;
-  del_op.params.bucket_owner = bucket_owner.get_id();
+  del_op.params.bucket_owner = bucket->get_info().owner;
   del_op.params.versioning_status = bucket->get_info().versioning_status();
-  del_op.params.obj_owner = obj_owner;
-  del_op.params.unmod_since = unmod_since;
-  del_op.params.high_precision_time = high_precision_time;
 
-  ret = del_op.delete_obj(y, dpp);
-  if (ret >= 0) {
-    delete_marker = del_op.result.delete_marker;
-    version_id = del_op.result.version_id;
-  }
+  return del_op.delete_obj(y, dpp);
+}
+
+int RGWRadosObject::delete_obj_aio(const DoutPrefixProvider *dpp, RGWObjState *astate,
+                                  Completions* aio, bool keep_index_consistent,
+                                  optional_yield y)
+{
+  RadosCompletions* raio = static_cast<RadosCompletions*>(aio);
+
+  return store->getRados()->delete_obj_aio(dpp, get_obj(), bucket->get_info(), astate,
+                                          raio->handles, keep_index_consistent, y);
+}
+
+std::unique_ptr<RGWObject::StatOp> RGWRadosObject::get_stat_op(RGWObjectCtx *ctx)
+{
+  return std::unique_ptr<RGWObject::StatOp>(new RGWRadosObject::RadosStatOp(this, ctx));
+}
+
+RGWRadosObject::RadosStatOp::RadosStatOp(RGWRadosObject *_source, RGWObjectCtx *_rctx) :
+       source(_source),
+       rctx(_rctx),
+       op_target(_source->store->getRados(),
+                 _source->get_bucket()->get_info(),
+                 *static_cast<RGWObjectCtx *>(rctx),
+                 _source->get_obj()),
+       parent_op(&op_target)
+{ }
+
+int RGWRadosObject::RadosStatOp::stat_async()
+{
+  return parent_op.stat_async();
+}
+
+int RGWRadosObject::RadosStatOp::wait()
+{
+  result.obj = source;
+  int ret =  parent_op.wait();
+  if (ret < 0)
+    return ret;
+
+  source->obj_size = parent_op.result.size;
+  source->mtime = ceph::real_clock::from_timespec(parent_op.result.mtime);
+  source->attrs = parent_op.result.attrs;
+  source->key = parent_op.result.obj.key;
+  source->in_extra_data = parent_op.result.obj.in_extra_data;
+  source->index_hash_source = parent_op.result.obj.index_hash_source;
+  if (parent_op.result.manifest)
+    result.manifest = &(*parent_op.result.manifest);
+  else
+    result.manifest = nullptr;
 
   return ret;
 }
@@ -761,385 +1482,97 @@ int RGWRadosObject::copy_object(RGWObjectCtx& obj_ctx,
                                     if_match,
                                     if_nomatch,
                                     static_cast<RGWRados::AttrsMod>(attrs_mod),
-                                    copy_if_newer,
-                                    attrs,
-                                    category,
-                                    olh_epoch,
-                                    (delete_at ? *delete_at : real_time()),
-                                    version_id,
-                                    tag,
-                                    etag,
-                                    progress_cb,
-                                    progress_data,
-                                    dpp,
-                                    y);
-}
-
-int RGWRadosObject::RadosReadOp::iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y)
-{
-  return parent_op.iterate(dpp, ofs, end, cb, y);
-}
-
-std::unique_ptr<RGWObject::WriteOp> RGWRadosObject::get_write_op(RGWObjectCtx* ctx)
-{
-  return std::unique_ptr<RGWObject::WriteOp>(new RGWRadosObject::RadosWriteOp(this, ctx));
-}
-
-RGWRadosObject::RadosWriteOp::RadosWriteOp(RGWRadosObject* _source, RGWObjectCtx* _rctx) :
-       source(_source),
-       rctx(_rctx),
-       op_target(_source->store->getRados(),
-                 _source->get_bucket()->get_info(),
-                 *static_cast<RGWObjectCtx *>(rctx),
-                 _source->get_obj()),
-       parent_op(&op_target)
-{ }
-
-int RGWRadosObject::RadosWriteOp::prepare(optional_yield y)
-{
-  op_target.set_versioning_disabled(params.versioning_disabled);
-  parent_op.meta.mtime = params.mtime;
-  parent_op.meta.rmattrs = params.rmattrs;
-  parent_op.meta.data = params.data;
-  parent_op.meta.manifest = params.manifest;
-  parent_op.meta.ptag = params.ptag;
-  parent_op.meta.remove_objs = params.remove_objs;
-  parent_op.meta.set_mtime = params.set_mtime;
-  parent_op.meta.owner = params.owner.get_id();
-  parent_op.meta.category = params.category;
-  parent_op.meta.flags = params.flags;
-  parent_op.meta.if_match = params.if_match;
-  parent_op.meta.if_nomatch = params.if_nomatch;
-  parent_op.meta.olh_epoch = params.olh_epoch;
-  parent_op.meta.delete_at = params.delete_at;
-  parent_op.meta.canceled = params.canceled;
-  parent_op.meta.user_data = params.user_data;
-  parent_op.meta.zones_trace = params.zones_trace;
-  parent_op.meta.modify_tail = params.modify_tail;
-  parent_op.meta.completeMultipart = params.completeMultipart;
-  parent_op.meta.appendable = params.appendable;
-
-  return 0;
-}
-
-int RGWRadosObject::RadosWriteOp::write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, optional_yield y)
-{
-  int ret = parent_op.write_meta(dpp, size, accounted_size, *params.attrs, y);
-  params.canceled = parent_op.meta.canceled;
-
-  return ret;
-}
-
-int RGWRadosObject::swift_versioning_restore(RGWObjectCtx* obj_ctx,
-                                            bool& restored,
-                                            const DoutPrefixProvider *dpp)
-{
-  return store->getRados()->swift_versioning_restore(*obj_ctx,
-                                                    bucket->get_owner()->get_id(),
-                                                    bucket,
-                                                    this,
-                                                    restored,
-                                                    dpp);
-}
-
-int RGWRadosObject::swift_versioning_copy(RGWObjectCtx* obj_ctx,
-                                         const DoutPrefixProvider *dpp,
-                                         optional_yield y)
-{
-  return store->getRados()->swift_versioning_copy(*obj_ctx,
-                                        bucket->get_info().owner,
-                                        bucket,
-                                        this,
-                                        dpp,
-                                        y);
-}
-
-int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y)
-{
-  int ret;
-  RGWBucket* bp;
-
-  bp = new RGWRadosBucket(this, b, u);
-  ret = bp->get_bucket_info(dpp, y);
-  if (ret < 0) {
-    delete bp;
-    return ret;
-  }
-
-  bucket->reset(bp);
-  return 0;
-}
-
-int RGWRadosStore::get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket)
-{
-  RGWBucket* bp;
-
-  bp = new RGWRadosBucket(this, i, u);
-  /* Don't need to fetch the bucket info, use the provided one */
-
-  bucket->reset(bp);
-  return 0;
-}
-
-int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* bucket, optional_yield y)
-{
-  rgw_bucket b;
-
-  b.tenant = tenant;
-  b.name = name;
-
-  return get_bucket(dpp, u, b, bucket, y);
-}
-
-static int decode_policy(CephContext *cct,
-                         bufferlist& bl,
-                         RGWAccessControlPolicy *policy)
-{
-  auto iter = bl.cbegin();
-  try {
-    policy->decode(iter);
-  } catch (buffer::error& err) {
-    ldout(cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
-    return -EIO;
-  }
-  if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 15>()) {
-    ldout(cct, 15) << __func__ << " Read AccessControlPolicy";
-    RGWAccessControlPolicy_S3 *s3policy = static_cast<RGWAccessControlPolicy_S3 *>(policy);
-    s3policy->to_xml(*_dout);
-    *_dout << dendl;
-  }
-  return 0;
-}
-
-static int rgw_op_get_bucket_policy_from_attr(const DoutPrefixProvider *dpp, RGWRadosStore *store,
-                                             RGWUser& user,
-                                             RGWAttrs& bucket_attrs,
-                                             RGWAccessControlPolicy *policy,
-                                             optional_yield y)
-{
-  auto aiter = bucket_attrs.find(RGW_ATTR_ACL);
-
-  if (aiter != bucket_attrs.end()) {
-    int ret = decode_policy(store->ctx(), aiter->second, policy);
-    if (ret < 0)
-      return ret;
-  } else {
-    ldout(store->ctx(), 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl;
-    /* object exists, but policy is broken */
-    int r = user.load_by_id(dpp, y);
-    if (r < 0)
-      return r;
-
-    policy->create_default(user.get_user(), user.get_display_name());
-  }
-  return 0;
-}
-
-bool RGWRadosStore::is_meta_master()
-{
-  return svc()->zone->is_meta_master();
-}
-
-int RGWRadosStore::forward_request_to_master(RGWUser* user, obj_version *objv,
-                                            bufferlist& in_data,
-                                            JSONParser *jp, req_info& info,
-                                            optional_yield y)
-{
-  if (is_meta_master()) {
-    /* We're master, don't forward */
-    return 0;
-  }
-
-  if (!svc()->zone->get_master_conn()) {
-    ldout(ctx(), 0) << "rest connection is invalid" << dendl;
-    return -EINVAL;
-  }
-  ldout(ctx(), 0) << "sending request to master zonegroup" << dendl;
-  bufferlist response;
-  string uid_str = user->get_id().to_str();
-#define MAX_REST_RESPONSE (128 * 1024) // we expect a very small response
-  int ret = svc()->zone->get_master_conn()->forward(rgw_user(uid_str), info,
-                                                    objv, MAX_REST_RESPONSE,
-                                                   &in_data, &response, y);
-  if (ret < 0)
-    return ret;
-
-  ldout(ctx(), 20) << "response: " << response.c_str() << dendl;
-  if (jp && !jp->parse(response.c_str(), response.length())) {
-    ldout(ctx(), 0) << "failed parsing response from master zonegroup" << dendl;
-    return -EINVAL;
-  }
-
-  return 0;
+                                    copy_if_newer,
+                                    attrs,
+                                    category,
+                                    olh_epoch,
+                                    (delete_at ? *delete_at : real_time()),
+                                    version_id,
+                                    tag,
+                                    etag,
+                                    progress_cb,
+                                    progress_data,
+                                    dpp,
+                                    y);
 }
 
-int RGWRadosStore::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, optional_yield y)
+int RGWRadosObject::RadosReadOp::iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y)
 {
-  return rados->defer_gc(dpp, rctx, bucket->get_info(), obj->get_obj(), y);
+  return parent_op.iterate(dpp, ofs, end, cb, y);
 }
 
-const RGWZoneGroup& RGWRadosStore::get_zonegroup()
+std::unique_ptr<RGWObject::WriteOp> RGWRadosObject::get_write_op(RGWObjectCtx* ctx)
 {
-  return rados->svc.zone->get_zonegroup();
+  return std::unique_ptr<RGWObject::WriteOp>(new RGWRadosObject::RadosWriteOp(this, ctx));
 }
 
-int RGWRadosStore::get_zonegroup(const string& id, RGWZoneGroup& zonegroup)
-{
-  return rados->svc.zone->get_zonegroup(id, zonegroup);
-}
+RGWRadosObject::RadosWriteOp::RadosWriteOp(RGWRadosObject* _source, RGWObjectCtx* _rctx) :
+       source(_source),
+       rctx(_rctx),
+       op_target(_source->store->getRados(),
+                 _source->get_bucket()->get_info(),
+                 *static_cast<RGWObjectCtx *>(rctx),
+                 _source->get_obj()),
+       parent_op(&op_target)
+{ }
 
-int RGWRadosStore::cluster_stat(RGWClusterStat& stats)
+int RGWRadosObject::RadosWriteOp::prepare(optional_yield y)
 {
-  rados_cluster_stat_t rados_stats;
-  int ret;
-
-  ret = rados->get_rados_handle()->cluster_stat(rados_stats);
-  if (ret < 0)
-    return ret;
-
-  stats.kb = rados_stats.kb;
-  stats.kb_used = rados_stats.kb_used;
-  stats.kb_avail = rados_stats.kb_avail;
-  stats.num_objects = rados_stats.num_objects;
+  op_target.set_versioning_disabled(params.versioning_disabled);
+  parent_op.meta.mtime = params.mtime;
+  parent_op.meta.rmattrs = params.rmattrs;
+  parent_op.meta.data = params.data;
+  parent_op.meta.manifest = params.manifest;
+  parent_op.meta.ptag = params.ptag;
+  parent_op.meta.remove_objs = params.remove_objs;
+  parent_op.meta.set_mtime = params.set_mtime;
+  parent_op.meta.owner = params.owner.get_id();
+  parent_op.meta.category = params.category;
+  parent_op.meta.flags = params.flags;
+  parent_op.meta.if_match = params.if_match;
+  parent_op.meta.if_nomatch = params.if_nomatch;
+  parent_op.meta.olh_epoch = params.olh_epoch;
+  parent_op.meta.delete_at = params.delete_at;
+  parent_op.meta.canceled = params.canceled;
+  parent_op.meta.user_data = params.user_data;
+  parent_op.meta.zones_trace = params.zones_trace;
+  parent_op.meta.modify_tail = params.modify_tail;
+  parent_op.meta.completeMultipart = params.completeMultipart;
+  parent_op.meta.appendable = params.appendable;
 
-  return ret;
+  return 0;
 }
 
-int RGWRadosStore::create_bucket(const DoutPrefixProvider *dpp, 
-                                 RGWUser& u, const rgw_bucket& b,
-                                const string& zonegroup_id,
-                                rgw_placement_rule& placement_rule,
-                                string& swift_ver_location,
-                                const RGWQuotaInfo * pquota_info,
-                                const RGWAccessControlPolicy& policy,
-                                RGWAttrs& attrs,
-                                RGWBucketInfo& info,
-                                obj_version& ep_objv,
-                                bool exclusive,
-                                bool obj_lock_enabled,
-                                bool *existed,
-                                req_info& req_info,
-                                std::unique_ptr<RGWBucket>* bucket_out,
-                                optional_yield y)
+int RGWRadosObject::RadosWriteOp::write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, optional_yield y)
 {
-  int ret;
-  bufferlist in_data;
-  RGWBucketInfo master_info;
-  rgw_bucket *pmaster_bucket;
-  uint32_t *pmaster_num_shards;
-  real_time creation_time;
-  std::unique_ptr<RGWBucket> bucket;
-  obj_version objv, *pobjv = NULL;
-
-  /* If it exists, look it up; otherwise create it */
-  ret = get_bucket(dpp, &u, b, &bucket, y);
-  if (ret < 0 && ret != -ENOENT)
-    return ret;
-
-  if (ret != -ENOENT) {
-    RGWAccessControlPolicy old_policy(ctx());
-    *existed = true;
-    if (swift_ver_location.empty()) {
-      swift_ver_location = bucket->get_info().swift_ver_location;
-    }
-    placement_rule.inherit_from(bucket->get_info().placement_rule);
-
-    // don't allow changes to the acl policy
-    int r = rgw_op_get_bucket_policy_from_attr(dpp, this, u, bucket->get_attrs(),
-                                              &old_policy, y);
-    if (r >= 0 && old_policy != policy) {
-      bucket_out->swap(bucket);
-      return -EEXIST;
-    }
-  } else {
-    bucket = std::unique_ptr<RGWBucket>(new RGWRadosBucket(this, b, &u));
-    *existed = false;
-    bucket->set_attrs(attrs);
-  }
-
-  if (!svc()->zone->is_meta_master()) {
-    JSONParser jp;
-    ret = forward_request_to_master(&u, NULL, in_data, &jp, req_info, y);
-    if (ret < 0) {
-      return ret;
-    }
-
-    JSONDecoder::decode_json("entry_point_object_ver", ep_objv, &jp);
-    JSONDecoder::decode_json("object_ver", objv, &jp);
-    JSONDecoder::decode_json("bucket_info", master_info, &jp);
-    ldpp_dout(dpp, 20) << "parsed: objv.tag=" << objv.tag << " objv.ver=" << objv.ver << dendl;
-    std::time_t ctime = ceph::real_clock::to_time_t(master_info.creation_time);
-    ldpp_dout(dpp, 20) << "got creation time: << " << std::put_time(std::localtime(&ctime), "%F %T") << dendl;
-    pmaster_bucket= &master_info.bucket;
-    creation_time = master_info.creation_time;
-    pmaster_num_shards = &master_info.layout.current_index.layout.normal.num_shards;
-    pobjv = &objv;
-    if (master_info.obj_lock_enabled()) {
-      info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
-    }
-  } else {
-    pmaster_bucket = NULL;
-    pmaster_num_shards = NULL;
-    if (obj_lock_enabled)
-      info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
-  }
-
-  std::string zid = zonegroup_id;
-  if (zid.empty()) {
-    zid = svc()->zone->get_zonegroup().get_id();
-  }
-
-  if (*existed) {
-    rgw_placement_rule selected_placement_rule;
-    ret = svc()->zone->select_bucket_placement(u.get_info(),
-                                              zid, placement_rule,
-                                              &selected_placement_rule, nullptr, y);
-    if (selected_placement_rule != info.placement_rule) {
-      ret = -EEXIST;
-      bucket_out->swap(bucket);
-      return ret;
-    }
-  } else {
-
-    ret = getRados()->create_bucket(u.get_info(), bucket->get_key(),
-                                   zid, placement_rule, swift_ver_location,
-                                   pquota_info, attrs,
-                                   info, pobjv, &ep_objv, creation_time,
-                                   pmaster_bucket, pmaster_num_shards, y, dpp, exclusive);
-    if (ret == -EEXIST) {
-      *existed = true;
-      ret = 0;
-    } else if (ret != 0) {
-      return ret;
-    }
-  }
-
-  bucket->set_version(ep_objv);
-  bucket->get_info() = info;
-
-  bucket_out->swap(bucket);
+  int ret = parent_op.write_meta(dpp, size, accounted_size, *params.attrs, y);
+  params.canceled = parent_op.meta.canceled;
 
   return ret;
 }
 
-std::unique_ptr<Lifecycle> RGWRadosStore::get_lifecycle(void)
-{
-  return std::unique_ptr<Lifecycle>(new RadosLifecycle(this));
-}
-
-int RGWRadosStore::delete_raw_obj(const rgw_raw_obj& obj)
-{
-  return rados->delete_raw_obj(obj);
-}
-
-void RGWRadosStore::get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj)
+int RGWRadosObject::swift_versioning_restore(RGWObjectCtx* obj_ctx,
+                                            bool& restored,
+                                            const DoutPrefixProvider *dpp)
 {
-    rados->obj_to_raw(placement_rule, obj, raw_obj);
+  return store->getRados()->swift_versioning_restore(*obj_ctx,
+                                                    bucket->get_owner()->get_id(),
+                                                    bucket,
+                                                    this,
+                                                    restored,
+                                                    dpp);
 }
 
-int RGWRadosStore::get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size)
+int RGWRadosObject::swift_versioning_copy(RGWObjectCtx* obj_ctx,
+                                         const DoutPrefixProvider *dpp,
+                                         optional_yield y)
 {
-  return rados->get_max_chunk_size(obj.pool, chunk_size, dpp);
+  return store->getRados()->swift_versioning_copy(*obj_ctx,
+                                        bucket->get_info().owner,
+                                        bucket,
+                                        this,
+                                        dpp,
+                                        y);
 }
 
 MPRadosSerializer::MPRadosSerializer(RGWRadosStore* store, RGWRadosObject* obj, const std::string& lock_name) :
@@ -1273,66 +1706,145 @@ LCSerializer* RadosLifecycle::get_serializer(const std::string& lock_name, const
   return new LCRadosSerializer(store, oid, lock_name, cookie);
 }
 
-} // namespace rgw::sal
-
-rgw::sal::RGWRadosStore *RGWStoreManager::init_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache)
+int RadosNotification::publish_reserve(RGWObjTags* obj_tags)
 {
-  RGWRados *rados = new RGWRados;
-  rgw::sal::RGWRadosStore *store = new rgw::sal::RGWRadosStore();
+  return rgw::notify::publish_reserve(event_type, res, obj_tags);
+}
 
-  store->setRados(rados);
-  rados->set_store(store);
-
-  if ((*rados).set_use_cache(use_cache)
-              .set_run_gc_thread(use_gc_thread)
-              .set_run_lc_thread(use_lc_thread)
-              .set_run_quota_threads(quota_threads)
-              .set_run_sync_thread(run_sync_thread)
-              .set_run_reshard_thread(run_reshard_thread)
-              .initialize(cct, dpp) < 0) {
-    delete store;
-    return NULL;
-  }
+int RadosNotification::publish_commit(const DoutPrefixProvider *dpp, uint64_t size,
+                                    const ceph::real_time& mtime, const std::string& etag)
+{
+  return rgw::notify::publish_commit(obj, size, mtime, etag, event_type, res, dpp);
+}
 
-  return store;
+void RadosGCChain::update(RGWObjManifest* manifest)
+{
+  rgw_obj target = obj->get_obj();
+  store->getRados()->update_gc_chain(target, *manifest, &chain);
 }
 
-rgw::sal::RGWRadosStore *RGWStoreManager::init_raw_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct)
+int RadosGCChain::send(const std::string& tag)
 {
-  RGWRados *rados = new RGWRados;
-  rgw::sal::RGWRadosStore *store = new rgw::sal::RGWRadosStore();
+  return store->getRados()->send_chain_to_gc(chain, tag);
+}
 
-  store->setRados(rados);
-  rados->set_store(store);
+void RadosGCChain::delete_inline(const std::string& tag)
+{
+  store->getRados()->delete_objs_inline(chain, tag);
+}
 
-  rados->set_context(cct);
+int RadosWriter::set_stripe_obj(const rgw_raw_obj& raw_obj)
+{
+  stripe_obj = store->svc()->rados->obj(raw_obj);
+  return stripe_obj.open();
+}
 
-  int ret = rados->init_svc(true, dpp);
-  if (ret < 0) {
-    ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl;
-    delete store;
-    return nullptr;
+int RadosWriter::process(bufferlist&& bl, uint64_t offset)
+{
+  bufferlist data = std::move(bl);
+  const uint64_t cost = data.length();
+  if (cost == 0) { // no empty writes, use aio directly for creates
+    return 0;
   }
-
-  if (rados->init_rados() < 0) {
-    delete store;
-    return nullptr;
+  librados::ObjectWriteOperation op;
+  if (offset == 0) {
+    op.write_full(data);
+  } else {
+    op.write(offset, data);
   }
+  constexpr uint64_t id = 0; // unused
+  auto c = aio->get(stripe_obj, Aio::librados_op(std::move(op), y), cost, id);
+  return process_completed(c, &written);
+}
 
-  return store;
+int RadosWriter::write_exclusive(const bufferlist& data)
+{
+  const uint64_t cost = data.length();
+
+  librados::ObjectWriteOperation op;
+  op.create(true); // exclusive create
+  op.write_full(data);
+
+  constexpr uint64_t id = 0; // unused
+  auto c = aio->get(stripe_obj, Aio::librados_op(std::move(op), y), cost, id);
+  auto d = aio->drain();
+  c.splice(c.end(), d);
+  return process_completed(c, &written);
 }
 
-int rgw::sal::RGWRadosStore::get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx)
+int RadosWriter::drain()
 {
-  return rados->get_obj_head_ioctx(bucket_info, obj, ioctx);
+  return process_completed(aio->drain(), &written);
+}
+
+RadosWriter::~RadosWriter()
+{
+  // wait on any outstanding aio completions
+  process_completed(aio->drain(), &written);
+
+  bool need_to_remove_head = false;
+  std::optional<rgw_raw_obj> raw_head;
+  if (!rgw::sal::RGWObject::empty(head_obj.get())) {
+    raw_head.emplace();
+    head_obj->get_raw_obj(&*raw_head);
+  }
+
+  /**
+   * We should delete the object in the "multipart" namespace to avoid race condition.
+   * Such race condition is caused by the fact that the multipart object is the gatekeeper of a multipart
+   * upload, when it is deleted, a second upload would start with the same suffix("2/"), therefore, objects
+   * written by the second upload may be deleted by the first upload.
+   * details is describled on #11749
+   *
+   * The above comment still stands, but instead of searching for a specific object in the multipart
+   * namespace, we just make sure that we remove the object that is marked as the head object after
+   * we remove all the other raw objects. Note that we use different call to remove the head object,
+   * as this one needs to go via the bucket index prepare/complete 2-phase commit scheme.
+   */
+  for (const auto& obj : written) {
+    if (raw_head && obj == *raw_head) {
+      ldpp_dout(dpp, 5) << "NOTE: we should not process the head object (" << obj << ") here" << dendl;
+      need_to_remove_head = true;
+      continue;
+    }
+
+    int r = store->delete_raw_obj(obj);
+    if (r < 0 && r != -ENOENT) {
+      ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << obj << "), leaked" << dendl;
+    }
+  }
+
+  if (need_to_remove_head) {
+    ldpp_dout(dpp, 5) << "NOTE: we are going to process the head obj (" << *raw_head << ")" << dendl;
+    std::unique_ptr<rgw::sal::RGWObject::DeleteOp> del_op = head_obj->get_delete_op(&obj_ctx);
+    del_op->params.bucket_owner = bucket->get_acl_owner();
+
+    int r = del_op->delete_obj(dpp, y);
+    if (r < 0 && r != -ENOENT) {
+      ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << *raw_head << "), leaked" << dendl;
+    }
+  }
 }
 
-void RGWStoreManager::close_storage(rgw::sal::RGWRadosStore *store)
+} // namespace rgw::sal
+
+extern "C" {
+
+void *newRGWStore(void)
 {
-  if (!store)
-    return;
+  rgw::sal::RGWRadosStore *store = new rgw::sal::RGWRadosStore();
+  if (store) {
+    RGWRados *rados = new RGWRados();
+
+    if (!rados) {
+      delete store; store = nullptr;
+    } else {
+      store->setRados(rados);
+      rados->set_store(store);
+    }
+  }
 
-  store->finalize();
+  return store;
+}
 
-  delete store;
 }
index 43ea4197e1e3846f09078fdb7cb85bbf8e97296e..9cf5bec8092ff3d0a829453311ef8b59b6cc49c0 100644 (file)
 
 #include "rgw_sal.h"
 #include "rgw_rados.h"
+#include "rgw_notify.h"
 #include "cls/lock/cls_lock_client.h"
 
 namespace rgw { namespace sal {
 
 class RGWRadosStore;
 
+class RadosCompletions : public Completions {
+  public:
+    std::list<librados::AioCompletion*> handles;
+    RadosCompletions() {}
+    ~RadosCompletions() = default;
+    virtual int drain() override;
+};
+
 class RGWRadosUser : public RGWUser {
   private:
     RGWRadosStore *store;
@@ -31,15 +40,30 @@ class RGWRadosUser : public RGWUser {
     RGWRadosUser(RGWRadosStore *_st, const rgw_user& _u) : RGWUser(_u), store(_st) { }
     RGWRadosUser(RGWRadosStore *_st, const RGWUserInfo& _i) : RGWUser(_i), store(_st) { }
     RGWRadosUser(RGWRadosStore *_st) : store(_st) { }
+    RGWRadosUser(RGWRadosUser& _o) = default;
     RGWRadosUser() {}
 
+    virtual std::unique_ptr<RGWUser> clone() override {
+      return std::unique_ptr<RGWUser>(new RGWRadosUser(*this));
+    }
     int list_buckets(const DoutPrefixProvider *dpp, const std::string& marker, const std::string& end_marker,
                     uint64_t max, bool need_stats, RGWBucketList& buckets,
                     optional_yield y) override;
-    RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time);
+    virtual RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time) override;
+    virtual int read_attrs(const DoutPrefixProvider *dpp, optional_yield y, RGWAttrs* uattrs, RGWObjVersionTracker* tracker) override;
+    virtual int read_stats(optional_yield y, RGWStorageStats* stats,
+                          ceph::real_time *last_stats_sync = nullptr,
+                          ceph::real_time *last_stats_update = nullptr) override;
+    virtual int read_stats_async(RGWGetUserStats_CB *cb) override;
+    virtual int complete_flush_stats(optional_yield y) override;
+    virtual int read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
+                          bool *is_truncated, RGWUsageIter& usage_iter,
+                          map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
+    virtual int trim_usage(uint64_t start_epoch, uint64_t end_epoch) override;
 
     /* Placeholders */
-    virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y);
+    virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::GetParams& params = {}) override;
+    virtual int store_info(const DoutPrefixProvider *dpp, optional_yield y, const RGWUserCtl::PutParams& params = {}) override;
 
     friend class RGWRadosBucket;
 };
@@ -83,6 +107,33 @@ class RGWRadosObject : public RGWObject {
       //virtual int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive) override;
     };
 
+    struct RadosDeleteOp : public DeleteOp {
+    private:
+      RGWRadosObject* source;
+      RGWObjectCtx* rctx;
+      RGWRados::Object op_target;
+      RGWRados::Object::Delete parent_op;
+
+    public:
+      RadosDeleteOp(RGWRadosObject* _source, RGWObjectCtx* _rctx);
+
+      virtual int delete_obj(const DoutPrefixProvider *dpp, optional_yield y) override;
+    };
+
+    struct RadosStatOp : public StatOp {
+    private:
+      RGWRadosObject* source;
+      RGWObjectCtx* rctx;
+      RGWRados::Object op_target;
+      RGWRados::Object::Stat parent_op;
+
+    public:
+      RadosStatOp(RGWRadosObject* _source, RGWObjectCtx* _rctx);
+
+      virtual int stat_async() override;
+      virtual int wait() override;
+    };
+
     RGWRadosObject() = default;
 
     RGWRadosObject(RGWRadosStore *_st, const rgw_obj_key& _k)
@@ -97,12 +148,9 @@ class RGWRadosObject : public RGWObject {
     }
     RGWRadosObject(RGWRadosObject& _o) = default;
 
-    int read(off_t offset, off_t length, std::iostream& stream) { return length; }
-    int write(off_t offset, off_t length, std::iostream& stream) { return length; }
-    virtual int delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, ACLOwner obj_owner,
-                             ACLOwner bucket_owner, ceph::real_time unmod_since,
-                             bool high_precision_time, uint64_t epoch,
-                             std::string& version_id,optional_yield y) override;
+    virtual int delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, optional_yield y) override;
+    virtual int delete_obj_aio(const DoutPrefixProvider *dpp, RGWObjState *astate, Completions* aio,
+                              bool keep_index_consistent, optional_yield y) override;
     virtual int copy_object(RGWObjectCtx& obj_ctx, RGWUser* user,
                req_info *info, const rgw_zone_id& source_zone,
                rgw::sal::RGWObject* dest_object, rgw::sal::RGWBucket* dest_bucket,
@@ -118,12 +166,12 @@ class RGWRadosObject : public RGWObject {
                string *version_id, string *tag, string *etag,
                void (*progress_cb)(off_t, void *), void *progress_data,
                const DoutPrefixProvider *dpp, optional_yield y) override;
-    RGWAccessControlPolicy& get_acl(void) { return acls; }
-    int set_acl(const RGWAccessControlPolicy& acl) { acls = acl; return 0; }
-    virtual void set_atomic(RGWObjectCtx *rctx) const;
-    virtual void set_prefetch_data(RGWObjectCtx *rctx);
+    virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
+    virtual int set_acl(const RGWAccessControlPolicy& acl) override { acls = acl; return 0; }
+    virtual void set_atomic(RGWObjectCtx *rctx) const override;
+    virtual void set_prefetch_data(RGWObjectCtx *rctx) override;
 
-    virtual int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = true) override;
+    virtual int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWObjState **state, optional_yield y, bool follow_olh = true) override;
     virtual int set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj = NULL) override;
     virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj = NULL) override;
     virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp) override;
@@ -133,7 +181,7 @@ class RGWRadosObject : public RGWObject {
     virtual void gen_rand_obj_instance_name() override;
     virtual void raw_obj_to_obj(const rgw_raw_obj& raw_obj) override;
     virtual void get_raw_obj(rgw_raw_obj* raw_obj) override;
-    virtual std::unique_ptr<RGWObject> clone() {
+    virtual std::unique_ptr<RGWObject> clone() override {
       return std::unique_ptr<RGWObject>(new RGWRadosObject(*this));
     }
     virtual MPSerializer* get_serializer(const std::string& lock_name) override;
@@ -162,8 +210,15 @@ class RGWRadosObject : public RGWObject {
     /* OPs */
     virtual std::unique_ptr<ReadOp> get_read_op(RGWObjectCtx *) override;
     virtual std::unique_ptr<WriteOp> get_write_op(RGWObjectCtx *) override;
+    virtual std::unique_ptr<DeleteOp> get_delete_op(RGWObjectCtx*) override;
+    virtual std::unique_ptr<StatOp> get_stat_op(RGWObjectCtx*) override;
 
     /* OMAP */
+    virtual int omap_get_vals(const string& marker, uint64_t count,
+                             std::map<string, bufferlist> *m,
+                             bool *pmore, optional_yield y) override;
+    virtual int omap_get_all(std::map<string, bufferlist> *m,
+                            optional_yield y) override;
     virtual int omap_get_vals_by_keys(const std::string& oid,
                              const std::set<std::string>& keys,
                              RGWAttrs *vals) override;
@@ -171,7 +226,7 @@ class RGWRadosObject : public RGWObject {
                                    bool must_exist, optional_yield y) override;
 
   private:
-    int read_attrs(RGWRados::Object::Read &read_op, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj *target_obj = nullptr);
+    int read_attrs(const DoutPrefixProvider *dpp, RGWRados::Object::Read &read_op, optional_yield y, rgw_obj *target_obj = nullptr);
 };
 
 class RGWRadosBucket : public RGWBucket {
@@ -185,6 +240,12 @@ class RGWRadosBucket : public RGWBucket {
         acls() {
     }
 
+    RGWRadosBucket(RGWRadosStore *_st, RGWUser* _u)
+      : RGWBucket(_u),
+       store(_st),
+        acls() {
+    }
+
     RGWRadosBucket(RGWRadosStore *_st, const rgw_bucket& _b)
       : RGWBucket(_b),
        store(_st),
@@ -223,28 +284,29 @@ class RGWRadosBucket : public RGWBucket {
 
     ~RGWRadosBucket() { }
 
-    virtual int load_by_name(const DoutPrefixProvider *dpp, const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) override;
     virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) override;
-    RGWBucketList* list(void) { return new RGWBucketList(); }
     virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) override;
     RGWObject* create_object(const rgw_obj_key& key /* Attributes */) override;
     virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) override;
-    RGWAccessControlPolicy& get_acl(void) { return acls; }
+    virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
     virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
     virtual int get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) override;
-    virtual int get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id,
+    virtual int get_bucket_stats(int shard_id,
                                 std::string *bucket_ver, std::string *master_ver,
                                 std::map<RGWObjCategory, RGWStorageStats>& stats,
                                 std::string *max_marker = nullptr,
                                 bool *syncstopped = nullptr) override;
+    virtual int get_bucket_stats_async(int shard_id, RGWGetBucketStats_CB *ctx) override;
     virtual int read_bucket_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
     virtual int sync_user_stats(optional_yield y) override;
     virtual int update_container_stats(const DoutPrefixProvider *dpp) override;
     virtual int check_bucket_shards(const DoutPrefixProvider *dpp) override;
-    virtual int link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y) override;
-    virtual int unlink(RGWUser* new_user, optional_yield y) override;
-    virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y, const DoutPrefixProvider *dpp) override;
+    virtual int link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y, bool update_entrypoint, RGWObjVersionTracker* objv) override;
+    virtual int unlink(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y, bool update_entrypoint = true) override;
+    virtual int chown(const DoutPrefixProvider *dpp, RGWUser* new_user, RGWUser* old_user, optional_yield y, const std::string* marker = nullptr) override;
     virtual int put_instance_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time mtime) override;
+    virtual int remove_entrypoint(const DoutPrefixProvider *dpp, RGWObjVersionTracker* objv, optional_yield y) override;
+    virtual int remove_instance_info(const DoutPrefixProvider *dpp, RGWObjVersionTracker* objv, optional_yield y) override;
     virtual bool is_owner(RGWUser* user) override;
     virtual int check_empty(const DoutPrefixProvider *dpp, optional_yield y) override;
     virtual int check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, optional_yield y, bool check_size_only = false) override;
@@ -253,7 +315,13 @@ class RGWRadosBucket : public RGWBucket {
     virtual int read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
                           bool *is_truncated, RGWUsageIter& usage_iter,
                           map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
-    virtual std::unique_ptr<RGWBucket> clone() {
+    virtual int trim_usage(uint64_t start_epoch, uint64_t end_epoch) override;
+    virtual int remove_objs_from_index(std::list<rgw_obj_index_key>& objs_to_unlink) override;
+    virtual int check_index(std::map<RGWObjCategory, RGWStorageStats>& existing_stats, std::map<RGWObjCategory, RGWStorageStats>& calculated_stats) override;
+    virtual int rebuild_index() override;
+    virtual int set_tag_timeout(uint64_t timeout) override;
+    virtual int purge_instance(const DoutPrefixProvider *dpp) override;
+    virtual std::unique_ptr<RGWBucket> clone() override {
       return std::make_unique<RGWRadosBucket>(*this);
     }
 
@@ -274,7 +342,10 @@ class RGWRadosStore : public RGWStore {
       delete rados;
     }
 
-    virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u);
+    virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u) override;
+    virtual int get_user(const DoutPrefixProvider *dpp, const RGWAccessKey& key, optional_yield y, std::unique_ptr<RGWUser>* user) override;
+    virtual int get_user_by_email(const DoutPrefixProvider *dpp, const std::string& email, optional_yield y, std::unique_ptr<RGWUser>* user) override;
+    virtual int get_user_by_swift(const DoutPrefixProvider *dpp, const std::string& user_str, optional_yield y, std::unique_ptr<RGWUser>* user) override;
     virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) override;
     virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y) override;
     virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket) override;
@@ -294,8 +365,7 @@ class RGWRadosStore : public RGWStore {
                            bool *existed,
                            req_info& req_info,
                            std::unique_ptr<RGWBucket>* bucket,
-                           optional_yield y);
-    virtual RGWBucketList* list_buckets(void) { return new RGWBucketList(); }
+                           optional_yield y) override;
     virtual bool is_meta_master() override;
     virtual int forward_request_to_master(RGWUser* user, obj_version *objv,
                                          bufferlist& in_data, JSONParser *jp, req_info& info,
@@ -304,13 +374,66 @@ class RGWRadosStore : public RGWStore {
                         optional_yield y) override;
     virtual const RGWZoneGroup& get_zonegroup() override;
     virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) override;
+    virtual const RGWZoneParams& get_zone_params() override;
+    virtual const rgw_zone_id& get_zone_id() override;
+    virtual const RGWRealm& get_realm() override;
     virtual int cluster_stat(RGWClusterStat& stats) override;
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
-    virtual RGWLC* get_rgwlc(void) { return rados->get_lc(); }
+    virtual std::unique_ptr<Completions> get_completions(void) override;
+    virtual std::unique_ptr<Notification> get_notification(rgw::sal::RGWObject* obj, struct req_state* s, rgw::notify::EventType event_type) override;
+    virtual std::unique_ptr<GCChain> get_gc_chain(rgw::sal::RGWObject* obj) override;
+    virtual std::unique_ptr<Writer> get_writer(Aio *aio, rgw::sal::RGWBucket* bucket,
+              RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
+              const DoutPrefixProvider *dpp, optional_yield y) override;
+    virtual RGWLC* get_rgwlc(void) override { return rados->get_lc(); }
+    virtual RGWCtl* get_ctl(void) override { return rados->pctl; }
+    virtual RGWCoroutinesManagerRegistry* get_cr_registry() override { return rados->get_cr_registry(); }
     virtual int delete_raw_obj(const rgw_raw_obj& obj) override;
+    virtual int delete_raw_obj_aio(const rgw_raw_obj& obj, Completions* aio) override;
     virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) override;
     virtual int get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) override;
 
+    virtual int log_usage(map<rgw_user_bucket, RGWUsageBatch>& usage_info) override;
+    virtual int log_op(string& oid, bufferlist& bl) override;
+    virtual int register_to_service_map(const string& daemon_type,
+                               const map<string, string>& meta) override;
+    virtual void get_quota(RGWQuotaInfo& bucket_quota, RGWQuotaInfo& user_quota) override;
+    virtual int list_raw_objects(const rgw_pool& pool, const string& prefix_filter,
+                                int max, RGWListRawObjsCtx& ctx, std::list<string>& oids,
+                                bool *is_truncated) override;
+    virtual int set_buckets_enabled(const DoutPrefixProvider *dpp, vector<rgw_bucket>& buckets, bool enabled) override;
+    virtual uint64_t get_new_req_id() override { return rados->get_new_req_id(); }
+    virtual int get_sync_policy_handler(const DoutPrefixProvider *dpp,
+                                       std::optional<rgw_zone_id> zone,
+                                       std::optional<rgw_bucket> bucket,
+                                       RGWBucketSyncPolicyHandlerRef *phandler,
+                                       optional_yield y) override;
+    virtual RGWDataSyncStatusManager* get_data_sync_manager(const rgw_zone_id& source_zone) override;
+    virtual void wakeup_meta_sync_shards(set<int>& shard_ids) override { rados->wakeup_meta_sync_shards(shard_ids); }
+    virtual void wakeup_data_sync_shards(const rgw_zone_id& source_zone, map<int, set<string> >& shard_ids) override { rados->wakeup_data_sync_shards(source_zone, shard_ids); }
+    virtual int clear_usage() override { return rados->clear_usage(); }
+    virtual int read_all_usage(uint64_t start_epoch, uint64_t end_epoch,
+                              uint32_t max_entries, bool *is_truncated,
+                              RGWUsageIter& usage_iter,
+                              map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
+    virtual int trim_all_usage(uint64_t start_epoch, uint64_t end_epoch) override;
+    virtual int get_config_key_val(string name, bufferlist *bl) override;
+    virtual void finalize(void) override;
+
+    virtual CephContext *ctx(void) override { return rados->ctx(); }
+
+    virtual const std::string& get_luarocks_path() const override {
+      return luarocks_path;
+    }
+
+    virtual void set_luarocks_path(const std::string& path) override {
+      luarocks_path = path;
+    }
+
+    /* Unique to RGWRadosStore */
+    int get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj,
+                          librados::IoCtx *ioctx);
+
     void setRados(RGWRados * st) { rados = st; }
     RGWRados *getRados(void) { return rados; }
 
@@ -320,22 +443,6 @@ class RGWRadosStore : public RGWStore {
     const RGWCtl *ctl() const { return &rados->ctl; }
 
     void setUserCtl(RGWUserCtl *_ctl) { user_ctl = _ctl; }
-
-    void finalize(void) override;
-
-    virtual CephContext *ctx(void) { return rados->ctx(); }
-
-
-    int get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj,
-                          librados::IoCtx *ioctx);
-
-    const std::string& get_luarocks_path() const override {
-      return luarocks_path;
-    }
-
-    void set_luarocks_path(const std::string& path) override {
-      luarocks_path = path;
-    }
 };
 
 class MPRadosSerializer : public MPSerializer {
@@ -347,7 +454,7 @@ public:
   MPRadosSerializer(RGWRadosStore* store, RGWRadosObject* obj, const std::string& lock_name);
 
   virtual int try_lock(utime_t dur, optional_yield y) override;
-  int unlock() {
+  virtual int unlock() override {
     return lock.unlock(&ioctx, oid);
   }
 };
@@ -361,7 +468,7 @@ public:
   LCRadosSerializer(RGWRadosStore* store, const std::string& oid, const std::string& lock_name, const std::string& cookie);
 
   virtual int try_lock(utime_t dur, optional_yield y) override;
-  int unlock() {
+  virtual int unlock() override {
     return lock.unlock(ioctx, oid);
   }
 };
@@ -383,23 +490,57 @@ public:
   virtual LCSerializer* get_serializer(const std::string& lock_name, const std::string& oid, const std::string& cookie) override;
 };
 
-} } // namespace rgw::sal
+class RadosNotification : public Notification {
+  RGWRadosStore* store;
+  rgw::notify::reservation_t res;
 
-class RGWStoreManager {
-public:
-  RGWStoreManager() {}
-  static rgw::sal::RGWRadosStore *get_storage(const DoutPrefixProvider *dpp, CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads,
-                              bool run_sync_thread, bool run_reshard_thread, bool use_cache = true) {
-    rgw::sal::RGWRadosStore *store = init_storage_provider(dpp, cct, use_gc_thread, use_lc_thread,
-       quota_threads, run_sync_thread, run_reshard_thread, use_cache);
-    return store;
-  }
-  static rgw::sal::RGWRadosStore *get_raw_storage(const DoutPrefixProvider *dpp, CephContext *cct) {
-    rgw::sal::RGWRadosStore *rados = init_raw_storage_provider(dpp, cct);
-    return rados;
-  }
-  static rgw::sal::RGWRadosStore *init_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache);
-  static rgw::sal::RGWRadosStore *init_raw_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct);
-  static void close_storage(rgw::sal::RGWRadosStore *store);
+  public:
+    RadosNotification(RGWRadosStore* _store, RGWObject* _obj, req_state* _s, rgw::notify::EventType _type) : Notification(_obj, _type), store(_store), res(_store, _s, _obj) { }
+    ~RadosNotification() = default;
+
+    virtual int publish_reserve(RGWObjTags* obj_tags = nullptr) override;
+    virtual int publish_commit(const DoutPrefixProvider *dpp, uint64_t size,
+                              const ceph::real_time& mtime, const std::string& etag) override;
+};
+
+class RadosGCChain : public GCChain {
+protected:
+  RGWRadosStore* store;
+  cls_rgw_obj_chain chain;
+
+  public:
+    RadosGCChain(RGWRadosStore* _store, RGWObject* _obj) : GCChain(_obj), store(_store) {}
+    ~RadosGCChain() = default;
+
+    virtual void update(RGWObjManifest* manifest) override;
+    virtual int send(const std::string& tag) override;
+    virtual void delete_inline(const std::string& tag) override;
+};
+
+class RadosWriter : public Writer {
+  rgw::sal::RGWRadosStore* store;
+  RGWSI_RADOS::Obj stripe_obj; // current stripe object
+
+ public:
+  RadosWriter(Aio *aio, rgw::sal::RGWRadosStore* _store,
+             rgw::sal::RGWBucket* bucket,
+              RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
+              const DoutPrefixProvider *dpp, optional_yield y)
+    : Writer(aio, bucket, obj_ctx, std::move(_head_obj), dpp, y), store(_store)
+  {}
+
+  ~RadosWriter();
+
+  // change the current stripe object
+  virtual int set_stripe_obj(const rgw_raw_obj& obj) override;
 
+  // write the data at the given offset of the current stripe object
+  virtual int process(bufferlist&& data, uint64_t stripe_offset) override;
+
+  // write the data as an exclusive create and wait for it to complete
+  virtual int write_exclusive(const bufferlist& data) override;
+
+  virtual int drain() override;
 };
+
+} } // namespace rgw::sal
index 741c16d397c011d4fec55f90d4485d92cb0cc46b..98aee40c0f7036755dd0bc66dc4107c000d25fbb 100644 (file)
@@ -152,7 +152,7 @@ void AssumedRoleUser::dump(Formatter *f) const
 }
 
 int AssumedRoleUser::generateAssumedRoleUser(CephContext* cct,
-                                              rgw::sal::RGWRadosStore *store,
+                                              rgw::sal::RGWStore *store,
                                               const string& roleId,
                                               const rgw::ARN& roleArn,
                                               const string& roleSessionName)
@@ -283,7 +283,7 @@ std::tuple<int, RGWRole> STSService::getRoleInfo(const DoutPrefixProvider *dpp,
   if (auto r_arn = rgw::ARN::parse(arn); r_arn) {
     auto pos = r_arn->resource.find_last_of('/');
     string roleName = r_arn->resource.substr(pos + 1);
-    RGWRole role(cct, store->getRados()->pctl, roleName, r_arn->account);
+    RGWRole role(cct, store->get_ctl(), roleName, r_arn->account);
     if (int ret = role.get(dpp, y); ret < 0) {
       if (ret == -ENOENT) {
         ldpp_dout(dpp, 0) << "Role doesn't exist: " << roleName << dendl;
@@ -315,16 +315,17 @@ std::tuple<int, RGWRole> STSService::getRoleInfo(const DoutPrefixProvider *dpp,
 int STSService::storeARN(const DoutPrefixProvider *dpp, string& arn, optional_yield y)
 {
   int ret = 0;
-  RGWUserInfo info;
-  if (ret = rgw_get_user_info_by_uid(dpp, store->ctl()->user, user_id, info, y); ret < 0) {
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(user_id);
+  if ((ret = user->load_by_id(dpp, y)) < 0) {
     return -ERR_NO_SUCH_ENTITY;
   }
 
-  info.assumed_role_arn = arn;
+  user->get_info().assumed_role_arn = arn;
 
-  RGWObjVersionTracker objv_tracker;
-  if (ret = rgw_store_user_info(dpp, store->ctl()->user, info, &info, &objv_tracker, real_time(),
-                               false, y); ret < 0) {
+  ret = user->store_info(dpp, y, RGWUserCtl::PutParams()
+                           .set_old_info(&user->get_info())
+                           .set_exclusive(false));
+  if (ret < 0) {
     return -ERR_INTERNAL_ERROR;
   }
   return ret;
index 14c783c1cde014c4cd4f0dfd84426c4f356eaa78..3059382012203f9f6434c8e6ecd4dbe9cc4ff424 100644 (file)
@@ -112,7 +112,7 @@ class AssumedRoleUser {
   string assumeRoleId;
 public:
   int generateAssumedRoleUser( CephContext* cct,
-                                rgw::sal::RGWRadosStore *store,
+                                rgw::sal::RGWStore *store,
                                 const string& roleId,
                                 const rgw::ARN& roleArn,
                                 const string& roleSessionName);
@@ -225,14 +225,14 @@ using AssumeRoleWithWebIdentityResponse = struct AssumeRoleWithWebIdentityRespon
 
 class STSService {
   CephContext* cct;
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   rgw_user user_id;
   RGWRole role;
   rgw::auth::Identity* identity;
   int storeARN(const DoutPrefixProvider *dpp, string& arn, optional_yield y);
 public:
   STSService() = default;
-  STSService(CephContext* cct, rgw::sal::RGWRadosStore *store, rgw_user user_id,
+  STSService(CephContext* cct, rgw::sal::RGWStore *store, rgw_user user_id,
             rgw::auth::Identity* identity)
     : cct(cct), store(store), user_id(user_id), identity(identity) {}
   std::tuple<int, RGWRole> getRoleInfo(const DoutPrefixProvider *dpp, const string& arn, optional_yield y);
index da0a370b71ab7b6f231ff4654e49710c4be80889..9e3e29483b3973361b788051ebeb10b54eff52b7 100644 (file)
@@ -625,12 +625,12 @@ void RGW_SWIFT_Auth_Get::execute(optional_yield y)
   int ret = -EPERM;
 
   const char *key = s->info.env->get("HTTP_X_AUTH_KEY");
-  const char *user = s->info.env->get("HTTP_X_AUTH_USER");
+  const char *user_name = s->info.env->get("HTTP_X_AUTH_USER");
 
   s->prot_flags |= RGW_REST_SWIFT;
 
   string user_str;
-  RGWUserInfo info;
+  std::unique_ptr<rgw::sal::RGWUser> user;
   bufferlist bl;
   RGWAccessKey *swift_key;
   map<string, RGWAccessKey>::iterator siter;
@@ -682,19 +682,19 @@ void RGW_SWIFT_Auth_Get::execute(optional_yield y)
     }
   }
 
-  if (!key || !user)
+  if (!key || !user_name)
     goto done;
 
-  user_str = user;
+  user_str = user_name;
 
-  if ((ret = store->ctl()->user->get_info_by_swift(s, user_str, &info, s->yield)) < 0)
-  {
+  ret = store->get_user_by_swift(s, user_str, s->yield, &user);
+  if (ret < 0) {
     ret = -EACCES;
     goto done;
   }
 
-  siter = info.swift_keys.find(user_str);
-  if (siter == info.swift_keys.end()) {
+  siter = user->get_info().swift_keys.find(user_str);
+  if (siter == user->get_info().swift_keys.end()) {
     ret = -EPERM;
     goto done;
   }
@@ -711,7 +711,7 @@ void RGW_SWIFT_Auth_Get::execute(optional_yield y)
     tenant_path.append(g_conf()->rgw_swift_tenant_name);
   } else if (g_conf()->rgw_swift_account_in_url) {
     tenant_path = "/AUTH_";
-    tenant_path.append(info.user_id.to_str());
+    tenant_path.append(user->get_id().to_str());
   }
 
   dump_header(s, "X-Storage-Url", swift_url + swift_prefix + "/v1" +
@@ -741,7 +741,7 @@ done:
   end_header(s);
 }
 
-int RGWHandler_SWIFT_Auth::init(rgw::sal::RGWRadosStore *store, struct req_state *state,
+int RGWHandler_SWIFT_Auth::init(rgw::sal::RGWStore *store, struct req_state *state,
                                rgw::io::BasicClient *cio)
 {
   state->dialect = "swift-auth";
index ba319405bfd47f385b46934308db1934d74dd455..480d72bd290405e5bea8e54f8d562c6cf9601843 100644 (file)
@@ -315,7 +315,7 @@ public:
   ~RGWHandler_SWIFT_Auth() override {}
   RGWOp *op_get() override;
 
-  int init(rgw::sal::RGWRadosStore *store, struct req_state *state, rgw::io::BasicClient *cio) override;
+  int init(rgw::sal::RGWStore *store, struct req_state *state, rgw::io::BasicClient *cio) override;
   int authorize(const DoutPrefixProvider *dpp, optional_yield y) override;
   int postauth_init(optional_yield) override { return 0; }
   int read_permissions(RGWOp *op, optional_yield) override { return 0; }
@@ -335,7 +335,7 @@ public:
     return this;
   }
 
-  RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state*,
                                const rgw::auth::StrategyRegistry&,
                                const std::string&) override {
index d1953193f95622bb49d6b732dc2e1e31c19addec..0cc88e05621b7b5c9aa86134f9b28cefa28c947c 100644 (file)
@@ -177,7 +177,7 @@ struct ElasticConfig {
   void init(CephContext *cct, const JSONFormattable& config) {
     string elastic_endpoint = config["endpoint"];
     id = string("elastic:") + elastic_endpoint;
-    conn.reset(new RGWRESTConn(cct, nullptr, id, { elastic_endpoint }));
+    conn.reset(new RGWRESTConn(cct, (RGWSI_Zone*)nullptr, id, { elastic_endpoint }));
     explicit_custom_meta = config["explicit_custom_meta"](true);
     index_buckets.init(config["index_buckets_list"], true); /* approve all buckets by default */
     allow_owners.init(config["approved_owners_list"], true); /* approve all bucket owners by default */
index d78fc895dc2085117f4fb2d0943e785f036508d8..61a16904e5e16f20158ae8421aa728d3f9669f33 100644 (file)
@@ -381,7 +381,7 @@ class RGWHandler_REST_MDSearch_S3 : public RGWHandler_REST_S3 {
 protected:
   RGWOp *op_get() override {
     if (s->info.args.exists("query")) {
-      return new RGWMetadataSearch_ObjStore_S3(store->getRados()->get_sync_module());
+      return new RGWMetadataSearch_ObjStore_S3(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module());
     }
     if (!s->init_state.url_bucket.empty() &&
         s->info.args.exists("mdsearch")) {
@@ -401,7 +401,7 @@ public:
 };
 
 
-RGWHandler_REST* RGWRESTMgr_MDSearch_S3::get_handler(rgw::sal::RGWRadosStore *store,
+RGWHandler_REST* RGWRESTMgr_MDSearch_S3::get_handler(rgw::sal::RGWStore *store,
                                                     struct req_state* const s,
                                                      const rgw::auth::StrategyRegistry& auth_registry,
                                                      const std::string& frontend_prefix)
index 6e4a459499df83fad2dd20311d00d061088c17b8..b28e17296e83b49c13c86452e3904d333db7a5b7 100644 (file)
@@ -11,7 +11,7 @@ class RGWRESTMgr_MDSearch_S3 : public RGWRESTMgr {
 public:
   explicit RGWRESTMgr_MDSearch_S3() {}
 
-  RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+  RGWHandler_REST *get_handler(rgw::sal::RGWStore *store,
                               struct req_state* s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix) override;
index 6a3c3b142bc5b0916403b4e4653897ff7ded2d6e..6d8c6866852e0467016648d0cd0c52d962487f31 100644 (file)
@@ -456,12 +456,11 @@ class PSSubscription {
   public:
     InitBucketLifecycleCR(RGWDataSyncCtx *_sc,
            PSConfigRef& _conf,
-           RGWBucketInfo& _bucket_info,
-           std::map<string, bufferlist>& _bucket_attrs) : RGWCoroutine(_sc->cct),
+           rgw::sal::RGWBucket* _bucket) : RGWCoroutine(_sc->cct),
                                                      sc(_sc), sync_env(_sc->env),
                                                      conf(_conf) {
-      lc_config.bucket_info = _bucket_info;
-      lc_config.bucket_attrs = _bucket_attrs;
+      lc_config.bucket = _bucket;
+      lc_config.bucket_attrs = _bucket->get_attrs();
       retention_days = conf->events_retention_days;
     }
 
@@ -549,18 +548,17 @@ class PSSubscription {
           if (retcode == 0) {
             {
               auto& result = sub->get_bucket_info_result;
-              sub->bucket_info = &result->bucket_info;
+              sub->bucket_info = &result->bucket->get_info();
 
-              int ret = sub->data_access->get_bucket(result->bucket_info, result->attrs, &sub->bucket);
+              int ret = sub->data_access->get_bucket(result->bucket->get_info(), result->bucket->get_attrs(), &sub->bucket);
               if (ret < 0) {
-                ldpp_dout(sync_env->dpp, 1) << "ERROR: data_access.get_bucket() bucket=" << result->bucket_info.bucket << " failed, ret=" << ret << dendl;
+                ldpp_dout(sync_env->dpp, 1) << "ERROR: data_access.get_bucket() bucket=" << result->bucket << " failed, ret=" << ret << dendl;
                 return set_cr_error(ret);
               }
             }
 
             yield call(new InitBucketLifecycleCR(sc, conf,
-                                                 sub->get_bucket_info_result->bucket_info,
-                                                 sub->get_bucket_info_result->attrs));
+                                                 sub->get_bucket_info_result->bucket.get()));
             if (retcode < 0) {
               ldpp_dout(sync_env->dpp, 1) << "ERROR: failed to init lifecycle on bucket (bucket=" << sub_conf->data_bucket_name << ") ret=" << retcode << dendl;
               return set_cr_error(retcode);
index c7feff500226b842726e8d5fdb11fb102025ce1f..5acec0a9de8accce4a77f3da21538b30baf07573 100644 (file)
@@ -40,7 +40,7 @@ public:
     dest.arn_topic = topic_name;
     // the topic ARN will be sent in the reply
     const rgw::ARN arn(rgw::Partition::aws, rgw::Service::sns, 
-        store->svc()->zone->get_zonegroup().get_name(),
+        store->get_zonegroup().get_name(),
         s->user->get_tenant(), topic_name);
     topic_arn = arn.to_string();
     return 0;
@@ -171,7 +171,7 @@ public:
       return -EINVAL;
     }
 
-    const auto psmodule = static_cast<RGWPSSyncModuleInstance*>(store->getRados()->get_sync_module().get());
+    const auto psmodule = static_cast<RGWPSSyncModuleInstance*>(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module().get());
     const auto& conf = psmodule->get_effective_conf();
 
     dest.push_endpoint = s->info.args.get("push-endpoint");
@@ -374,7 +374,7 @@ public:
 
 void RGWPSCreateNotif_ObjStore::execute(optional_yield y)
 {
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
 
   auto b = ps->get_bucket(bucket_info.bucket);
   op_ret = b->create_notification(topic_name, events, y);
@@ -411,7 +411,7 @@ void RGWPSDeleteNotif_ObjStore::execute(optional_yield y) {
     return;
   }
 
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto b = ps->get_bucket(bucket_info.bucket);
   op_ret = b->remove_notification(topic_name, y);
   if (op_ret < 0) {
@@ -450,7 +450,7 @@ public:
 
 void RGWPSListNotifs_ObjStore::execute(optional_yield y)
 {
-  ps.emplace(store, s->owner.get_id().tenant);
+  ps.emplace(static_cast<rgw::sal::RGWRadosStore*>(store), s->owner.get_id().tenant);
   auto b = ps->get_bucket(bucket_info.bucket);
   op_ret = b->get_topics(&result);
   if (op_ret < 0) {
@@ -496,7 +496,7 @@ public:
 };
 
 // factory for ceph specific PubSub REST handlers 
-RGWHandler_REST* RGWRESTMgr_PubSub::get_handler(rgw::sal::RGWRadosStore *store,
+RGWHandler_REST* RGWRESTMgr_PubSub::get_handler(rgw::sal::RGWStore *store,
                                                struct req_state* const s,
                                                const rgw::auth::StrategyRegistry& auth_registry,
                                                const std::string& frontend_prefix)
index c558ecd0c818667f3926ec51d521a21401eb6658..6ce4a935f9d5e975905f4a51efe25e9fa8697d5a 100644 (file)
@@ -7,7 +7,7 @@
 
 class RGWRESTMgr_PubSub : public RGWRESTMgr {
 public:
-  virtual RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+  virtual RGWHandler_REST* get_handler(rgw::sal::RGWStore *store,
                               struct req_state* s,
                                const rgw::auth::StrategyRegistry& auth_registry,
                                const std::string& frontend_prefix) override;
index dce5d03188a858134c0efcbd6ee81b4caf3c2134..4339baf9fa9a675cfb4e56091af108bad3dca878 100644 (file)
@@ -407,9 +407,9 @@ void rgw_filter_attrset(map<string, bufferlist>& unfiltered_attrset, const strin
   }
 }
 
-RGWDataAccess::RGWDataAccess(rgw::sal::RGWRadosStore *_store) : store(_store)
+RGWDataAccess::RGWDataAccess(rgw::sal::RGWStore *_store) : store(_store)
 {
-  sysobj_ctx = std::make_unique<RGWSysObjectCtx>(store->svc()->sysobj->init_obj_ctx());
+  sysobj_ctx = std::make_unique<RGWSysObjectCtx>(static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sysobj->init_obj_ctx());
 }
 
 
@@ -432,17 +432,16 @@ int RGWDataAccess::Bucket::finish_init()
 
 int RGWDataAccess::Bucket::init(const DoutPrefixProvider *dpp, optional_yield y)
 {
-  int ret = sd->store->getRados()->get_bucket_info(sd->store->svc(),
-                                      tenant, name,
-                                      bucket_info,
-                                      &mtime,
-                                       y,
-                                       dpp,
-                                      &attrs);
+  std::unique_ptr<rgw::sal::RGWBucket> bucket;
+  int ret = sd->store->get_bucket(dpp, nullptr, tenant, name, &bucket, y);
   if (ret < 0) {
     return ret;
   }
 
+  bucket_info = bucket->get_info();
+  mtime = bucket->get_modification_time();
+  attrs = bucket->get_attrs();
+
   return finish_init();
 }
 
@@ -466,7 +465,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
                                const DoutPrefixProvider *dpp,
                                optional_yield y)
 {
-  rgw::sal::RGWRadosStore *store = sd->store;
+  rgw::sal::RGWStore *store = sd->store;
   CephContext *cct = store->ctx();
 
   string tag;
@@ -483,7 +482,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
 
   auto& owner = bucket->policy.get_owner();
 
-  string req_id = store->svc()->zone_utils->unique_id(store->getRados()->get_new_req_id());
+  string req_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_id(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_new_req_id());
 
   using namespace rgw::putobj;
   AtomicObjectProcessor processor(&aio, store, b.get(), nullptr,
@@ -499,7 +498,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
 
-  const auto& compression_type = store->svc()->zone->get_zone_params().get_compression_type(bucket_info.placement_rule);
+  const auto& compression_type = store->get_zone_params().get_compression_type(bucket_info.placement_rule);
   if (compression_type != "none") {
     plugin = Compressor::create(store->ctx(), compression_type);
     if (!plugin) {
index 537bcd068681c21b4e8ed166b6274d80171c94b4..ff50eba158adddd7068d0cdda7ea2ed377b3db83 100644 (file)
@@ -20,7 +20,7 @@ class RGWSysObjectCtx;
 struct RGWObjVersionTracker;
 class optional_yield;
 namespace rgw { namespace sal {
-  class RGWRadosStore;
+  class RGWStore;
 } }
 
 struct obj_version;
@@ -142,11 +142,11 @@ using RGWMD5Etag = RGWEtag<MD5, CEPH_CRYPTO_MD5_DIGESTSIZE>;
 
 class RGWDataAccess
 {
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RGWStore *store;
   std::unique_ptr<RGWSysObjectCtx> sysobj_ctx;
 
 public:
-  RGWDataAccess(rgw::sal::RGWRadosStore *_store);
+  RGWDataAccess(rgw::sal::RGWStore *_store);
 
   class Object;
   class Bucket;
index 3470471d535429b019a2b9cacbca87dc7add5b9d..84938299d53240d48c51d9219f8bcd1e0a863222 100644 (file)
@@ -37,7 +37,7 @@ seed::~seed()
   store = NULL;
 }
 
-void seed::init(struct req_state *p_req, rgw::sal::RGWRadosStore *p_store)
+void seed::init(struct req_state *p_req, rgw::sal::RGWStore *p_store)
 {
   s = p_req;
   store = p_store;
@@ -249,15 +249,8 @@ int seed::save_torrent_file(optional_yield y)
 {
   int op_ret = 0;
   string key = RGW_OBJ_TORRENT;
-  rgw_obj obj(s->bucket->get_key(), s->object->get_name());
 
-  rgw_raw_obj raw_obj;
-  store->getRados()->obj_to_raw(s->bucket->get_info().placement_rule, obj, &raw_obj);
-
-  auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
-  auto sysobj = obj_ctx.get_obj(raw_obj);
-
-  op_ret = sysobj.omap().set(key, bl, y);
+  op_ret = s->object->omap_set_val_by_key(key, bl, false, y);
   if (op_ret < 0)
   {
     ldout(s->cct, 0) << "ERROR: failed to omap_set() op_ret = " << op_ret << dendl;
index 9959236681efc1565d7179533d2dfa807e94f669..faeb9aceca7c55e73eea18e8a761f8fe7ffdbce3 100644 (file)
@@ -108,7 +108,7 @@ private:
   bufferlist bl;  // bufflist ready to send
 
   struct req_state *s{nullptr};
-  rgw::sal::RGWRadosStore *store{nullptr};
+  rgw::sal::RGWStore *store{nullptr};
   SHA1 h;
 
   TorrentBencode dencode;
@@ -117,7 +117,7 @@ public:
   ~seed();
 
   int get_params();
-  void init(struct req_state *p_req, rgw::sal::RGWRadosStore *p_store);
+  void init(struct req_state *p_req, rgw::sal::RGWStore *p_store);
   int get_torrent_file(rgw::sal::RGWObject* object,
                        uint64_t &total_len,
                        ceph::bufferlist &bl_data,
index e54fbb692c4582c77e938398089c6fb73dfd08c6..eb3b381c15d8a6fb25a1c48e2303349e3265aad9 100644 (file)
@@ -1081,7 +1081,7 @@ class BucketTrimManager::Impl : public TrimCounters::Server,
 
   Impl(rgw::sal::RGWRadosStore *store, const BucketTrimConfig& config)
     : store(store), config(config),
-      status_obj(store->svc()->zone->get_zone_params().log_pool, BucketTrimStatus::oid),
+      status_obj(store->get_zone_params().log_pool, BucketTrimStatus::oid),
       counter(config.counter_size),
       trimmed(config.recent_size, config.recent_duration),
       watcher(store, status_obj, this)
index 34884e0b8234dd8b3f4f5e8e4d312692f15f8c52..11ab2e25b8cb58a66428a93e76ac891160d93020 100644 (file)
@@ -7,6 +7,7 @@
 #include "rgw_rados.h"
 #include "rgw_usage.h"
 #include "rgw_formats.h"
+#include "rgw_sal.h"
 
 
 
@@ -29,9 +30,11 @@ static void dump_usage_categories_info(Formatter *formatter, const rgw_usage_log
   formatter->close_section(); // categories
 }
 
-int RGWUsage::show(RGWRados *store, const rgw_user& uid, const string& bucket_name, uint64_t start_epoch,
-                  uint64_t end_epoch, bool show_log_entries, bool show_log_sum, map<string, bool> *categories,
-                  RGWFormatterFlusher& flusher)
+int RGWUsage::show(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                 rgw::sal::RGWUser* user , rgw::sal::RGWBucket* bucket,
+                  uint64_t start_epoch, uint64_t end_epoch, bool show_log_entries,
+                  bool show_log_sum,
+                  map<string, bool> *categories, RGWFormatterFlusher& flusher)
 {
   uint32_t max_entries = 1000;
 
@@ -51,9 +54,19 @@ int RGWUsage::show(RGWRados *store, const rgw_user& uid, const string& bucket_na
   string last_owner;
   bool user_section_open = false;
   map<string, rgw_usage_log_entry> summary_map;
+  int ret;
+
   while (is_truncated) {
-    int ret = store->read_usage(uid, bucket_name, start_epoch, end_epoch, max_entries,
-                                &is_truncated, usage_iter, usage);
+    if (bucket) {
+      ret = bucket->read_usage(start_epoch, end_epoch, max_entries, &is_truncated,
+                              usage_iter, usage);
+    } else if (user) {
+      ret = user->read_usage(start_epoch, end_epoch, max_entries, &is_truncated,
+                            usage_iter, usage);
+    } else {
+      ret = store->read_all_usage(start_epoch, end_epoch, max_entries, &is_truncated,
+                                 usage_iter, usage);
+    }
 
     if (ret == -ENOENT) {
       ret = 0;
@@ -139,13 +152,20 @@ int RGWUsage::show(RGWRados *store, const rgw_user& uid, const string& bucket_na
   return 0;
 }
 
-int RGWUsage::trim(RGWRados *store, const rgw_user& uid, const string& bucket_name, uint64_t start_epoch,
-                   uint64_t end_epoch)
+int RGWUsage::trim(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                  rgw::sal::RGWUser* user , rgw::sal::RGWBucket* bucket,
+                  uint64_t start_epoch, uint64_t end_epoch)
 {
-  return store->trim_usage(uid, bucket_name, start_epoch, end_epoch);
+  if (bucket) {
+    return bucket->trim_usage(start_epoch, end_epoch);
+  } else if (user) {
+    return user->trim_usage(start_epoch, end_epoch);
+  } else {
+    return store->trim_all_usage(start_epoch, end_epoch);
+  }
 }
 
-int RGWUsage::clear(RGWRados *store)
+int RGWUsage::clear(rgw::sal::RGWStore* store)
 {
   return store->clear_usage();
 }
index bab4242f04c0eb21a1ebe38454f845df5f37fea8..7b7bed8db4a063044b35bbf5d93b30eaed789936 100644 (file)
 #include "rgw_formats.h"
 #include "rgw_user.h"
 
-class RGWRados;
+namespace rgw { namespace sal { class RGWStore; } }
 
 
 class RGWUsage
 {
 public:
-  static int show(RGWRados *store, const rgw_user& uid, const string& bucket_name, uint64_t start_epoch,
-                 uint64_t end_epoch, bool show_log_entries, bool show_log_sum,
+  static int show(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                 rgw::sal::RGWUser* user , rgw::sal::RGWBucket* bucket,
+                 uint64_t start_epoch, uint64_t end_epoch, bool show_log_entries,
+                 bool show_log_sum,
                  std::map<std::string, bool> *categories, RGWFormatterFlusher& flusher);
 
-  static int trim(RGWRados *store, const rgw_user& uid, const string& bucket_name, uint64_t start_epoch,
-                 uint64_t end_epoch);
+  static int trim(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store,
+                 rgw::sal::RGWUser* user , rgw::sal::RGWBucket* bucket,
+                 uint64_t start_epoch, uint64_t end_epoch);
 
-  static int clear(RGWRados *store);
+  static int clear(rgw::sal::RGWStore *store);
 };
 
 
index 5cdf9efa2dbe7eb188373ab772355d77f0c2746f..7aa43fe055abddd6ee66129d2eae12d912c8d17f 100644 (file)
@@ -11,7 +11,6 @@
 #include "common/Formatter.h"
 #include "common/ceph_json.h"
 #include "common/RWLock.h"
-#include "rgw_sal.h"
 #include "rgw_sal_rados.h"
 #include "rgw_zone.h"
 #include "rgw_acl.h"
@@ -48,11 +47,10 @@ void rgw_get_anon_user(RGWUserInfo& info)
   info.access_keys.clear();
 }
 
-int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store,
-                           const rgw_user& user_id, optional_yield y)
+int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store,
+                           rgw::sal::RGWUser* user, optional_yield y)
 {
   rgw::sal::RGWBucketList user_buckets;
-  rgw::sal::RGWRadosUser user(store, user_id);
 
   CephContext *cct = store->ctx();
   size_t max_entries = cct->_conf->rgw_list_buckets_max_chunk;
@@ -60,7 +58,7 @@ int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosSto
   int ret;
 
   do {
-    ret = user.list_buckets(dpp, marker, string(), max_entries, false, user_buckets, y);
+    ret = user->list_buckets(dpp, marker, string(), max_entries, false, user_buckets, y);
     if (ret < 0) {
       ldpp_dout(dpp, 0) << "failed to read user buckets: ret=" << ret << dendl;
       return ret;
@@ -88,7 +86,7 @@ int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosSto
     }
   } while (user_buckets.is_truncated());
 
-  ret = store->ctl()->user->complete_flush_stats(user.get_user(), y);
+  ret = user->complete_flush_stats(y);
   if (ret < 0) {
     cerr << "ERROR: failed to complete syncing user stats: ret=" << ret << std::endl;
     return ret;
@@ -97,9 +95,9 @@ int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosSto
   return 0;
 }
 
-int rgw_user_get_all_buckets_stats(const DoutPrefixProvider *dpp, 
-                                   rgw::sal::RGWRadosStore *store,
-                                  const rgw_user& user_id,
+int rgw_user_get_all_buckets_stats(const DoutPrefixProvider *dpp,
+                                  rgw::sal::RGWStore *store,
+                                  rgw::sal::RGWUser* user,
                                   map<string, cls_user_bucket_entry>& buckets_usage_map,
                                   optional_yield y)
 {
@@ -111,8 +109,7 @@ int rgw_user_get_all_buckets_stats(const DoutPrefixProvider *dpp,
 
   do {
     rgw::sal::RGWBucketList buckets;
-    ret = rgw_read_user_buckets(dpp, store, user_id, buckets, marker,
-                               string(), max_entries, false, y);
+    ret = user->list_buckets(dpp, marker, string(), max_entries, false, buckets, y);
     if (ret < 0) {
       ldpp_dout(dpp, 0) << "failed to read user buckets: ret=" << ret << dendl;
       return ret;
@@ -1417,7 +1414,7 @@ RGWUser::RGWUser() : caps(this), keys(this), subusers(this)
   init_default();
 }
 
-int RGWUser::init(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *storage,
+int RGWUser::init(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *storage,
                  RGWUserAdminOpState& op_state, optional_yield y)
 {
   init_default();
@@ -1441,14 +1438,14 @@ void RGWUser::init_default()
   clear_populated();
 }
 
-int RGWUser::init_storage(rgw::sal::RGWRadosStore *storage)
+int RGWUser::init_storage(rgw::sal::RGWStore *storage)
 {
   if (!storage) {
     return -EINVAL;
   }
 
   store = storage;
-  user_ctl = store->ctl()->user;
+  user_ctl = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->user;
 
   clear_populated();
 
@@ -1646,17 +1643,17 @@ int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
     }
   }
 
-  rgw::sal::RGWRadosUser old_user(store, op_state.get_user_info());
-  rgw::sal::RGWRadosUser new_user(store, op_state.get_new_uid());
-  if (old_user.get_tenant() != new_user.get_tenant()) {
+  std::unique_ptr<rgw::sal::RGWUser> old_user = store->get_user(op_state.get_user_info().user_id);
+  std::unique_ptr<rgw::sal::RGWUser> new_user = store->get_user(op_state.get_new_uid());
+  if (old_user->get_tenant() != new_user->get_tenant()) {
     set_err_msg(err_msg, "users have to be under the same tenant namespace "
-                + old_user.get_tenant() + " != " + new_user.get_tenant());
+                + old_user->get_tenant() + " != " + new_user->get_tenant());
     return -EINVAL;
   }
 
   // create a stub user and write only the uid index and buckets object
   RGWUserInfo stub_user_info;
-  stub_user_info.user_id = new_user.get_user();
+  stub_user_info.user_id = new_user->get_user();
 
   RGWObjVersionTracker objv;
   const bool exclusive = !op_state.get_overwrite_new_user(); // overwrite if requested
@@ -1675,7 +1672,7 @@ int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
   }
 
   RGWAccessControlPolicy policy_instance;
-  policy_instance.create_default(new_user.get_user(), old_user.get_display_name());
+  policy_instance.create_default(new_user->get_user(), old_user->get_display_name());
 
   //unlink and link buckets to new user
   string marker;
@@ -1684,7 +1681,7 @@ int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
   rgw::sal::RGWBucketList buckets;
 
   do {
-    ret = old_user.list_buckets(dpp, marker, "", max_buckets, false, buckets, y);
+    ret = old_user->list_buckets(dpp, marker, "", max_buckets, false, buckets, y);
     if (ret < 0) {
       set_err_msg(err_msg, "unable to list user buckets");
       return ret;
@@ -1708,13 +1705,13 @@ int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
         return ret;
       }
 
-      ret = bucket->link(dpp, &new_user, y);
+      ret = bucket->link(dpp, new_user.get(), y);
       if (ret < 0) {
         set_err_msg(err_msg, "failed to link bucket " + bucket->get_name());
         return ret;
       }
 
-      ret = bucket->chown(&new_user, &old_user, y, dpp);
+      ret = bucket->chown(dpp, new_user.get(), old_user.get(), y);
       if (ret < 0) {
         set_err_msg(err_msg, "failed to run bucket chown" + cpp_strerror(-ret));
         return ret;
@@ -1726,10 +1723,10 @@ int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
   // update the 'stub user' with all of the other fields and rewrite all of the
   // associated index objects
   RGWUserInfo& user_info = op_state.get_user_info();
-  user_info.user_id = new_user.get_user();
+  user_info.user_id = new_user->get_user();
   op_state.objv = objv;
 
-  rename_swift_keys(new_user.get_user(), user_info.swift_keys);
+  rename_swift_keys(new_user->get_user(), user_info.swift_keys);
 
   return update(dpp, op_state, err_msg, y);
 }
@@ -1910,7 +1907,7 @@ int RGWUser::execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
   int ret;
 
   bool purge_data = op_state.will_purge_data();
-  rgw_user& uid = op_state.get_user_id();
+  std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(op_state.get_user_id());
   RGWUserInfo user_info = op_state.get_user_info();
 
   if (!op_state.has_existing_user()) {
@@ -1923,8 +1920,7 @@ int RGWUser::execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
   CephContext *cct = store->ctx();
   size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk;
   do {
-    ret = rgw_read_user_buckets(dpp, store, uid, buckets, marker, string(),
-                               max_buckets, false, y);
+    ret = user->list_buckets(dpp, marker, string(), max_buckets, false, buckets, y);
     if (ret < 0) {
       set_err_msg(err_msg, "unable to read user bucket info");
       return ret;
@@ -2077,9 +2073,9 @@ int RGWUser::execute_modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
     string marker;
     CephContext *cct = store->ctx();
     size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk;
+    std::unique_ptr<rgw::sal::RGWUser> user = store->get_user(user_id);
     do {
-      ret = rgw_read_user_buckets(dpp, store, user_id, buckets, marker, string(),
-                                 max_buckets, false, y);
+      ret = user->list_buckets(dpp, marker, string(), max_buckets, false, buckets, y);
       if (ret < 0) {
         set_err_msg(err_msg, "could not get buckets for uid:  " + user_id.to_str());
         return ret;
@@ -2095,7 +2091,7 @@ int RGWUser::execute_modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
         marker = iter->first;
       }
 
-      ret = store->getRados()->set_buckets_enabled(bucket_names, !suspended, dpp);
+      ret = store->set_buckets_enabled(dpp, bucket_names, !suspended);
       if (ret < 0) {
         set_err_msg(err_msg, "failed to modify bucket");
         return ret;
@@ -2196,7 +2192,7 @@ int RGWUser::list(RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher)
     op_state.max_entries = 1000;
   }
 
-  auto meta_mgr = store->ctl()->meta.mgr;
+  auto meta_mgr = static_cast<rgw::sal::RGWRadosStore*>(store)->ctl()->meta.mgr;
 
   int ret = meta_mgr->list_keys_init(metadata_key, op_state.marker, &handle);
   if (ret < 0) {
@@ -2244,7 +2240,7 @@ int RGWUser::list(RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher)
   return 0;
 }
 
-int RGWUserAdminOp_User::list(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
+int RGWUserAdminOp_User::list(rgw::sal::RGWStore *store, RGWUserAdminOpState& op_state,
                   RGWFormatterFlusher& flusher)
 {
   RGWUser user;
@@ -2260,13 +2256,14 @@ int RGWUserAdminOp_User::list(rgw::sal::RGWRadosStore *store, RGWUserAdminOpStat
   return 0;
 }
 
-int RGWUserAdminOp_User::info(const DoutPrefixProvider *dpp, 
-                              rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
+int RGWUserAdminOp_User::info(const DoutPrefixProvider *dpp,
+                             rgw::sal::RGWStore *store, RGWUserAdminOpState& op_state,
                              RGWFormatterFlusher& flusher,
                              optional_yield y)
 {
   RGWUserInfo info;
   RGWUser user;
+  std::unique_ptr<rgw::sal::RGWUser> ruser;
 
   int ret = user.init(dpp, store, op_state, y);
   if (ret < 0)
@@ -2281,8 +2278,10 @@ int RGWUserAdminOp_User::info(const DoutPrefixProvider *dpp,
   if (ret < 0)
     return ret;
 
+  ruser = store->get_user(info.user_id);
+
   if (op_state.sync_stats) {
-    ret = rgw_user_sync_all_stats(dpp, store, info.user_id, y);
+    ret = rgw_user_sync_all_stats(dpp, store, ruser.get(), y);
     if (ret < 0) {
       return ret;
     }
@@ -2291,7 +2290,7 @@ int RGWUserAdminOp_User::info(const DoutPrefixProvider *dpp,
   RGWStorageStats stats;
   RGWStorageStats *arg_stats = NULL;
   if (op_state.fetch_stats) {
-    int ret = store->ctl()->user->read_stats(info.user_id, &stats, y);
+    int ret = ruser->read_stats(y, &stats);
     if (ret < 0 && ret != -ENOENT) {
       return ret;
     }
@@ -2309,8 +2308,8 @@ int RGWUserAdminOp_User::info(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_User::create(const DoutPrefixProvider *dpp, 
-                                rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_User::create(const DoutPrefixProvider *dpp,
+                               rgw::sal::RGWStore *store,
                                RGWUserAdminOpState& op_state,
                                RGWFormatterFlusher& flusher, optional_yield y)
 {
@@ -2343,8 +2342,8 @@ int RGWUserAdminOp_User::create(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_User::modify(const DoutPrefixProvider *dpp, 
-                                rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_User::modify(const DoutPrefixProvider *dpp,
+                               rgw::sal::RGWStore *store,
                                RGWUserAdminOpState& op_state,
                                RGWFormatterFlusher& flusher, optional_yield y)
 {
@@ -2376,7 +2375,8 @@ int RGWUserAdminOp_User::modify(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_User::remove(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
+int RGWUserAdminOp_User::remove(const DoutPrefixProvider *dpp,
+                               rgw::sal::RGWStore *store, RGWUserAdminOpState& op_state,
                                RGWFormatterFlusher& flusher, optional_yield y)
 {
   RGWUserInfo info;
@@ -2393,8 +2393,8 @@ int RGWUserAdminOp_User::remove(const DoutPrefixProvider *dpp, rgw::sal::RGWRado
   return ret;
 }
 
-int RGWUserAdminOp_Subuser::create(const DoutPrefixProvider *dpp, 
-                                   rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_Subuser::create(const DoutPrefixProvider *dpp,
+                                  rgw::sal::RGWStore *store,
                                   RGWUserAdminOpState& op_state,
                                   RGWFormatterFlusher& flusher,
                                   optional_yield y)
@@ -2428,8 +2428,8 @@ int RGWUserAdminOp_Subuser::create(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_Subuser::modify(const DoutPrefixProvider *dpp, 
-                                   rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
+int RGWUserAdminOp_Subuser::modify(const DoutPrefixProvider *dpp,
+                                  rgw::sal::RGWStore *store, RGWUserAdminOpState& op_state,
                                   RGWFormatterFlusher& flusher, optional_yield y)
 {
   RGWUserInfo info;
@@ -2461,8 +2461,8 @@ int RGWUserAdminOp_Subuser::modify(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_Subuser::remove(const DoutPrefixProvider *dpp, 
-                                   rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_Subuser::remove(const DoutPrefixProvider *dpp,
+                                  rgw::sal::RGWStore *store,
                                   RGWUserAdminOpState& op_state,
                                   RGWFormatterFlusher& flusher,
                                   optional_yield y)
@@ -2484,8 +2484,8 @@ int RGWUserAdminOp_Subuser::remove(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_Key::create(const DoutPrefixProvider *dpp, 
-                               rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
+int RGWUserAdminOp_Key::create(const DoutPrefixProvider *dpp,
+                              rgw::sal::RGWStore *store, RGWUserAdminOpState& op_state,
                               RGWFormatterFlusher& flusher,
                               optional_yield y)
 {
@@ -2525,8 +2525,8 @@ int RGWUserAdminOp_Key::create(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_Key::remove(const DoutPrefixProvider *dpp, 
-                               rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_Key::remove(const DoutPrefixProvider *dpp,
+                              rgw::sal::RGWStore *store,
                               RGWUserAdminOpState& op_state,
                               RGWFormatterFlusher& flusher,
                               optional_yield y)
@@ -2548,8 +2548,8 @@ int RGWUserAdminOp_Key::remove(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWUserAdminOp_Caps::add(const DoutPrefixProvider *dpp, 
-                             rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_Caps::add(const DoutPrefixProvider *dpp,
+                            rgw::sal::RGWStore *store,
                             RGWUserAdminOpState& op_state,
                             RGWFormatterFlusher& flusher, optional_yield y)
 {
@@ -2583,8 +2583,8 @@ int RGWUserAdminOp_Caps::add(const DoutPrefixProvider *dpp,
 }
 
 
-int RGWUserAdminOp_Caps::remove(const DoutPrefixProvider *dpp, 
-                                rgw::sal::RGWRadosStore *store,
+int RGWUserAdminOp_Caps::remove(const DoutPrefixProvider *dpp,
+                               rgw::sal::RGWStore *store,
                                RGWUserAdminOpState& op_state,
                                RGWFormatterFlusher& flusher, optional_yield y)
 {
index 890666bd9fdedc64066ef3449799fe76b82e0fd4..21ae057e252c6bf38b7383af2ee8d76d0cb08601 100644 (file)
@@ -32,7 +32,7 @@ class RGWUserBuckets;
 
 class RGWGetUserStats_CB;
 namespace rgw { namespace sal {
-class RGWRadosStore;
+class RGWStore;
 } }
 
 /**
@@ -57,9 +57,9 @@ struct RGWUID
 };
 WRITE_CLASS_ENCODER(RGWUID)
 
-extern int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const rgw_user& user_id, optional_yield y);
+extern int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store, rgw::sal::RGWUser* user, optional_yield y);
 extern int rgw_user_get_all_buckets_stats(const DoutPrefixProvider *dpp,
-  rgw::sal::RGWRadosStore *store,const rgw_user& user_id,
+  rgw::sal::RGWStore* store, rgw::sal::RGWUser* user,
   map<string, cls_user_bucket_entry>& buckets_usage_map, optional_yield y);
 
 /**
@@ -258,14 +258,14 @@ struct RGWUserAdminOpState {
     key_op = true;
   }
 
-  void set_user_id(rgw_user& id) {
+  void set_user_id(const rgw_user& id) {
     if (id.empty())
       return;
 
     user_id = id;
   }
 
-  void set_new_user_id(rgw_user& id) {
+  void set_new_user_id(const rgw_user& id) {
     if (id.empty())
       return;
 
@@ -583,7 +583,7 @@ class RGWAccessKeyPool
 
   std::map<std::string, int, ltstr_nocase> key_type_map;
   rgw_user user_id;
-  rgw::sal::RGWRadosStore *store{nullptr};
+  rgw::sal::RGWStore *store{nullptr};
   RGWUserCtl *user_ctl{nullptr};
 
   map<std::string, RGWAccessKey> *swift_keys{nullptr};
@@ -637,7 +637,7 @@ class RGWSubUserPool
   RGWUser *user{nullptr};
 
   rgw_user user_id;
-  rgw::sal::RGWRadosStore *store{nullptr};
+  rgw::sal::RGWStore *store{nullptr};
   RGWUserCtl *user_ctl{nullptr};
   bool subusers_allowed{false};
 
@@ -700,7 +700,7 @@ class RGWUser
 
 private:
   RGWUserInfo old_info;
-  rgw::sal::RGWRadosStore *store{nullptr};
+  rgw::sal::RGWStore *store{nullptr};
   RGWUserCtl *user_ctl{nullptr};
 
   rgw_user user_id;
@@ -727,14 +727,14 @@ private:
 public:
   RGWUser();
 
-  int init(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *storage, RGWUserAdminOpState& op_state,
+  int init(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *storage, RGWUserAdminOpState& op_state,
           optional_yield y);
 
-  int init_storage(rgw::sal::RGWRadosStore *storage);
+  int init_storage(rgw::sal::RGWStore *storage);
   int init(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y);
   int init_members(RGWUserAdminOpState& op_state);
 
-  rgw::sal::RGWRadosStore *get_store() { return store; }
+  rgw::sal::RGWStore *get_store() { return store; }
   RGWUserCtl *get_user_ctl() { return user_ctl; }
 
   /* API Contracted Members */
@@ -774,41 +774,42 @@ public:
 class RGWUserAdminOp_User
 {
 public:
-  static int list(rgw::sal::RGWRadosStore *store,
+  static int list(rgw::sal::RGWStore *store,
                   RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
 
-  static int info(const DoutPrefixProvider *dpp, 
-                  rgw::sal::RGWRadosStore *store,
+  static int info(const DoutPrefixProvider *dpp,
+                 rgw::sal::RGWStore *store,
                   RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                  optional_yield y);
 
-  static int create(const DoutPrefixProvider *dpp, 
-                    rgw::sal::RGWRadosStore *store,
+  static int create(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 
-  static int modify(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store,
+  static int modify(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
 
-  static int remove(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store,
+  static int remove(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store,
                   RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
 };
 
 class RGWUserAdminOp_Subuser
 {
 public:
-  static int create(const DoutPrefixProvider *dpp, 
-                    rgw::sal::RGWRadosStore *store,
+  static int create(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 
-  static int modify(const DoutPrefixProvider *dpp, 
-                    rgw::sal::RGWRadosStore *store,
+  static int modify(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 
-  static int remove(const DoutPrefixProvider *dpp, 
-                    rgw::sal::RGWRadosStore *store,
+  static int remove(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 };
@@ -816,12 +817,12 @@ public:
 class RGWUserAdminOp_Key
 {
 public:
-  static int create(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store,
+  static int create(const DoutPrefixProvider *dpp, rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 
-  static int remove(const DoutPrefixProvider *dpp, 
-                    rgw::sal::RGWRadosStore *store,
+  static int remove(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 };
@@ -829,13 +830,13 @@ public:
 class RGWUserAdminOp_Caps
 {
 public:
-  static int add(const DoutPrefixProvider *dpp, 
-                 rgw::sal::RGWRadosStore *store,
+  static int add(const DoutPrefixProvider *dpp,
+                rgw::sal::RGWStore *store,
                 RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                 optional_yield y);
 
-  static int remove(const DoutPrefixProvider *dpp, 
-                    rgw::sal::RGWRadosStore *store,
+  static int remove(const DoutPrefixProvider *dpp,
+                   rgw::sal::RGWStore *store,
                    RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
                    optional_yield y);
 };
index 9886cc3ecfdd5558d914850ef97bb231f6ca5d1b..4798c057ea67e8137fe0ebe30995f36e2ea47fbe 100644 (file)
@@ -1372,13 +1372,13 @@ static int read_sync_status(rgw::sal::RGWRadosStore *store, rgw_meta_sync_status
   return r;
 }
 
-int RGWPeriod::update_sync_status(rgw::sal::RGWRadosStore *store, /* for now */
+int RGWPeriod::update_sync_status(rgw::sal::RGWStore *store, /* for now */
                                  const RGWPeriod &current_period,
                                   std::ostream& error_stream,
                                   bool force_if_stale)
 {
   rgw_meta_sync_status status;
-  int r = read_sync_status(store, &status);
+  int r = read_sync_status(static_cast<rgw::sal::RGWRadosStore*>(store), &status);
   if (r < 0) {
     ldout(cct, 0) << "period failed to read sync status: "
         << cpp_strerror(-r) << dendl;
@@ -1422,8 +1422,8 @@ int RGWPeriod::update_sync_status(rgw::sal::RGWRadosStore *store, /* for now */
   return 0;
 }
 
-int RGWPeriod::commit(const DoutPrefixProvider *dpp, 
-                      rgw::sal::RGWRadosStore *store,
+int RGWPeriod::commit(const DoutPrefixProvider *dpp,
+                     rgw::sal::RGWStore *store,
                      RGWRealm& realm, const RGWPeriod& current_period,
                       std::ostream& error_stream, optional_yield y,
                      bool force_if_stale)
index 088e9740bd6b3f11661a3c3a8767d73f5fbe5f21..37c31f4050dc83ec4ba585d3f82559ee399570ff 100644 (file)
@@ -1070,7 +1070,7 @@ class RGWPeriod
   const std::string get_period_oid_prefix() const;
 
   // gather the metadata sync status for each shard; only for use on master zone
-  int update_sync_status(rgw::sal::RGWRadosStore *store,
+  int update_sync_status(rgw::sal::RGWStore *store,
                          const RGWPeriod &current_period,
                          std::ostream& error_stream, bool force_if_stale);
 
@@ -1165,8 +1165,8 @@ public:
   int update(optional_yield y);
 
   // commit a staging period; only for use on master zone
-  int commit(const DoutPrefixProvider *dpp, 
-             rgw::sal::RGWRadosStore *store,
+  int commit(const DoutPrefixProvider *dpp,
+            rgw::sal::RGWStore *store,
              RGWRealm& realm, const RGWPeriod &current_period,
              std::ostream& error_stream, optional_yield y,
             bool force_if_stale = false);