]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/sal: add account interfaces to Driver
authorCasey Bodley <cbodley@redhat.com>
Wed, 1 Nov 2023 22:15:06 +0000 (18:15 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 10 Apr 2024 16:53:05 +0000 (12:53 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.cc
src/rgw/rgw_sal_filter.h

index dfc7a608642e41cb65025f39f55b3e1a2ab6a89f..3f652950380b60020f56adad4b7e13bd765056eb 100644 (file)
@@ -1002,6 +1002,72 @@ int RadosStore::get_user_by_swift(const DoutPrefixProvider* dpp, const std::stri
   return 0;
 }
 
+
+int RadosStore::load_account_by_id(const DoutPrefixProvider* dpp,
+                                   optional_yield y,
+                                   std::string_view id,
+                                   RGWAccountInfo& info,
+                                   Attrs& attrs,
+                                   RGWObjVersionTracker& objv)
+{
+  return -ENOTSUP;
+}
+
+int RadosStore::load_account_by_name(const DoutPrefixProvider* dpp,
+                                     optional_yield y,
+                                     std::string_view tenant,
+                                     std::string_view name,
+                                     RGWAccountInfo& info,
+                                     Attrs& attrs,
+                                     RGWObjVersionTracker& objv)
+{
+  return -ENOTSUP;
+}
+
+int RadosStore::load_account_by_email(const DoutPrefixProvider* dpp,
+                                      optional_yield y,
+                                      std::string_view email,
+                                      RGWAccountInfo& info,
+                                      Attrs& attrs,
+                                      RGWObjVersionTracker& objv)
+{
+  return -ENOTSUP;
+}
+
+int RadosStore::store_account(const DoutPrefixProvider* dpp,
+                              optional_yield y, bool exclusive,
+                              const RGWAccountInfo& info,
+                              const RGWAccountInfo* old_info,
+                              const Attrs& attrs,
+                              RGWObjVersionTracker& objv)
+{
+  return -ENOTSUP;
+}
+
+int RadosStore::delete_account(const DoutPrefixProvider* dpp,
+                               optional_yield y,
+                               const RGWAccountInfo& info,
+                               RGWObjVersionTracker& objv)
+{
+  return -ENOTSUP;
+}
+
+int RadosStore::load_account_stats(const DoutPrefixProvider* dpp,
+                                   optional_yield y, std::string_view id,
+                                   RGWStorageStats& stats,
+                                   ceph::real_time& last_synced,
+                                   ceph::real_time& last_updated)
+{
+  return -ENOTSUP;
+}
+
+int RadosStore::load_account_stats_async(const DoutPrefixProvider* dpp,
+                                         std::string_view id,
+                                         boost::intrusive_ptr<ReadStatsCB> cb)
+{
+  return -ENOTSUP;
+}
+
 std::unique_ptr<Object> RadosStore::get_object(const rgw_obj_key& k)
 {
   return std::make_unique<RadosObject>(this, k);
index 732898272ef9956218a524699602c34c8b49fc92..952979988280503659c4e0b4d711281d3db9128f 100644 (file)
@@ -144,6 +144,45 @@ class RadosStore : public StoreDriver {
     virtual int get_user_by_access_key(const DoutPrefixProvider* dpp, const std::string& key, optional_yield y, std::unique_ptr<User>* user) override;
     virtual int get_user_by_email(const DoutPrefixProvider* dpp, const std::string& email, optional_yield y, std::unique_ptr<User>* user) override;
     virtual int get_user_by_swift(const DoutPrefixProvider* dpp, const std::string& user_str, optional_yield y, std::unique_ptr<User>* user) override;
+
+    int load_account_by_id(const DoutPrefixProvider* dpp,
+                           optional_yield y,
+                           std::string_view id,
+                           RGWAccountInfo& info,
+                           Attrs& attrs,
+                           RGWObjVersionTracker& objv) override;
+    int load_account_by_name(const DoutPrefixProvider* dpp,
+                             optional_yield y,
+                             std::string_view tenant,
+                             std::string_view name,
+                             RGWAccountInfo& info,
+                             Attrs& attrs,
+                             RGWObjVersionTracker& objv) override;
+    int load_account_by_email(const DoutPrefixProvider* dpp,
+                              optional_yield y,
+                              std::string_view email,
+                              RGWAccountInfo& info,
+                              Attrs& attrs,
+                              RGWObjVersionTracker& objv) override;
+    int store_account(const DoutPrefixProvider* dpp,
+                      optional_yield y, bool exclusive,
+                      const RGWAccountInfo& info,
+                      const RGWAccountInfo* old_info,
+                      const Attrs& attrs,
+                      RGWObjVersionTracker& objv) override;
+    int delete_account(const DoutPrefixProvider* dpp,
+                       optional_yield y,
+                       const RGWAccountInfo& info,
+                       RGWObjVersionTracker& objv) override;
+    int load_account_stats(const DoutPrefixProvider* dpp,
+                           optional_yield y, std::string_view id,
+                           RGWStorageStats& stats,
+                           ceph::real_time& last_synced,
+                           ceph::real_time& last_updated) override;
+    int load_account_stats_async(const DoutPrefixProvider* dpp,
+                                 std::string_view id,
+                                 boost::intrusive_ptr<ReadStatsCB> cb) override;
+
     virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
     std::unique_ptr<Bucket> get_bucket(const RGWBucketInfo& i) override;
     int load_bucket(const DoutPrefixProvider* dpp, const rgw_bucket& b,
index 10f3997f7fd7467ecb58e891f657990cefd7061f..02c7b3c9048bddeb89b35eaf29121839429fc811 100644 (file)
@@ -268,6 +268,54 @@ class Driver {
     virtual int get_user_by_email(const DoutPrefixProvider* dpp, const std::string& email, optional_yield y, std::unique_ptr<User>* user) = 0;
     /** Lookup a User by swift username.  Queries driver for user info. */
     virtual int get_user_by_swift(const DoutPrefixProvider* dpp, const std::string& user_str, optional_yield y, std::unique_ptr<User>* user) = 0;
+
+    /** Lookup RGWAccountInfo by id */
+    virtual int load_account_by_id(const DoutPrefixProvider* dpp,
+                                   optional_yield y,
+                                   std::string_view id,
+                                   RGWAccountInfo& info,
+                                   Attrs& attrs,
+                                   RGWObjVersionTracker& objv) = 0;
+    /** Lookup RGWAccountInfo by name */
+    virtual int load_account_by_name(const DoutPrefixProvider* dpp,
+                                     optional_yield y,
+                                     std::string_view tenant,
+                                     std::string_view name,
+                                     RGWAccountInfo& info,
+                                     Attrs& attrs,
+                                     RGWObjVersionTracker& objv) = 0;
+    /** Lookup RGWAccountInfo by email address */
+    virtual int load_account_by_email(const DoutPrefixProvider* dpp,
+                                      optional_yield y,
+                                      std::string_view email,
+                                      RGWAccountInfo& info,
+                                      Attrs& attrs,
+                                      RGWObjVersionTracker& objv) = 0;
+    /** Write or overwrite an account */
+    virtual int store_account(const DoutPrefixProvider* dpp,
+                              optional_yield y, bool exclusive,
+                              const RGWAccountInfo& info,
+                              const RGWAccountInfo* old_info,
+                              const Attrs& attrs,
+                              RGWObjVersionTracker& objv) = 0;
+    /** Delete an account */
+    virtual int delete_account(const DoutPrefixProvider* dpp,
+                               optional_yield y,
+                               const RGWAccountInfo& info,
+                               RGWObjVersionTracker& objv) = 0;
+
+    /** Load account storage stats */
+    virtual int load_account_stats(const DoutPrefixProvider* dpp,
+                                   optional_yield y, std::string_view id,
+                                   RGWStorageStats& stats,
+                                   ceph::real_time& last_synced,
+                                   ceph::real_time& last_updated) = 0;
+    /** Load account storage stats asynchronously */
+    virtual int load_account_stats_async(const DoutPrefixProvider* dpp,
+                                         std::string_view id,
+                                         boost::intrusive_ptr<ReadStatsCB> cb) = 0;
+
+
     /** Get a basic Object.  This Object is not looked up, and is incomplete, since is
      * does not have a bucket.  This should only be used when an Object is needed before
      * there is a Bucket, otherwise use the get_object() in the Bucket class. */
index b10caec40d277a8e43a22bf5dac50f8934eab794..ee5f5a1f2ebe62f214e6ad252db0eb2fc808fa48 100644 (file)
@@ -1541,6 +1541,71 @@ namespace rgw::sal {
     return -ENOTSUP;
   }
 
+  int DBStore::load_account_by_id(const DoutPrefixProvider* dpp,
+                                  optional_yield y,
+                                  std::string_view id,
+                                  RGWAccountInfo& info,
+                                  Attrs& attrs,
+                                  RGWObjVersionTracker& objv)
+  {
+    return -ENOTSUP;
+  }
+
+  int DBStore::load_account_by_name(const DoutPrefixProvider* dpp,
+                                    optional_yield y,
+                                    std::string_view tenant,
+                                    std::string_view name,
+                                    RGWAccountInfo& info,
+                                    Attrs& attrs,
+                                    RGWObjVersionTracker& objv)
+  {
+    return -ENOTSUP;
+  }
+
+  int DBStore::load_account_by_email(const DoutPrefixProvider* dpp,
+                                     optional_yield y,
+                                     std::string_view email,
+                                     RGWAccountInfo& info,
+                                     Attrs& attrs,
+                                     RGWObjVersionTracker& objv)
+  {
+    return -ENOTSUP;
+  }
+
+  int DBStore::store_account(const DoutPrefixProvider* dpp,
+                             optional_yield y, bool exclusive,
+                             const RGWAccountInfo& info,
+                             const RGWAccountInfo* old_info,
+                             const Attrs& attrs,
+                             RGWObjVersionTracker& objv)
+  {
+    return -ENOTSUP;
+  }
+
+  int DBStore::delete_account(const DoutPrefixProvider* dpp,
+                              optional_yield y,
+                              const RGWAccountInfo& info,
+                              RGWObjVersionTracker& objv)
+  {
+    return -ENOTSUP;
+  }
+
+  int DBStore::load_account_stats(const DoutPrefixProvider* dpp,
+                                  optional_yield y, std::string_view id,
+                                  RGWStorageStats& stats,
+                                  ceph::real_time& last_synced,
+                                  ceph::real_time& last_updated)
+  {
+    return -ENOTSUP;
+  }
+
+  int DBStore::load_account_stats_async(const DoutPrefixProvider* dpp,
+                                        std::string_view id,
+                                        boost::intrusive_ptr<ReadStatsCB> cb)
+  {
+    return -ENOTSUP;
+  }
+
   std::string DBStore::get_cluster_id(const DoutPrefixProvider* dpp,  optional_yield y)
   {
     return "PLACEHOLDER"; // for instance unique identifier
index bb869a5cde4edddf6f2b45037f62138d53be38f9..aa971d1cdf08b1189d86e4061b0b448a2874dc60 100644 (file)
@@ -748,6 +748,45 @@ public:
       virtual int get_user_by_access_key(const DoutPrefixProvider *dpp, const std::string& key, optional_yield y, std::unique_ptr<User>* user) override;
       virtual int get_user_by_email(const DoutPrefixProvider *dpp, const std::string& email, optional_yield y, std::unique_ptr<User>* user) override;
       virtual int get_user_by_swift(const DoutPrefixProvider *dpp, const std::string& user_str, optional_yield y, std::unique_ptr<User>* user) override;
+
+      int load_account_by_id(const DoutPrefixProvider* dpp,
+                             optional_yield y,
+                             std::string_view id,
+                             RGWAccountInfo& info,
+                             Attrs& attrs,
+                             RGWObjVersionTracker& objv) override;
+      int load_account_by_name(const DoutPrefixProvider* dpp,
+                               optional_yield y,
+                               std::string_view tenant,
+                               std::string_view name,
+                               RGWAccountInfo& info,
+                               Attrs& attrs,
+                               RGWObjVersionTracker& objv) override;
+      int load_account_by_email(const DoutPrefixProvider* dpp,
+                                optional_yield y,
+                                std::string_view email,
+                                RGWAccountInfo& info,
+                                Attrs& attrs,
+                                RGWObjVersionTracker& objv) override;
+      int store_account(const DoutPrefixProvider* dpp,
+                        optional_yield y, bool exclusive,
+                        const RGWAccountInfo& info,
+                        const RGWAccountInfo* old_info,
+                        const Attrs& attrs,
+                        RGWObjVersionTracker& objv) override;
+      int delete_account(const DoutPrefixProvider* dpp,
+                         optional_yield y,
+                         const RGWAccountInfo& info,
+                         RGWObjVersionTracker& objv) override;
+      int load_account_stats(const DoutPrefixProvider* dpp,
+                             optional_yield y, std::string_view id,
+                             RGWStorageStats& stats,
+                             ceph::real_time& last_synced,
+                             ceph::real_time& last_updated) override;
+      int load_account_stats_async(const DoutPrefixProvider* dpp,
+                                   std::string_view id,
+                                   boost::intrusive_ptr<ReadStatsCB> cb) override;
+
       virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
       virtual std::string get_cluster_id(const DoutPrefixProvider* dpp, optional_yield y);
       std::unique_ptr<Bucket> get_bucket(const RGWBucketInfo& i) override;
index a4dc43a1373350718a40310e4f975d6818a56446..78dfc9f28aa85d4579f82c5f18c1a3ee3ccb06e3 100644 (file)
@@ -155,6 +155,71 @@ int FilterDriver::get_user_by_swift(const DoutPrefixProvider* dpp, const std::st
   return 0;
 }
 
+int FilterDriver::load_account_by_id(const DoutPrefixProvider* dpp,
+                                     optional_yield y,
+                                     std::string_view id,
+                                     RGWAccountInfo& info,
+                                     Attrs& attrs,
+                                     RGWObjVersionTracker& objv)
+{
+  return next->load_account_by_id(dpp, y, id, info, attrs, objv);
+}
+
+int FilterDriver::load_account_by_name(const DoutPrefixProvider* dpp,
+                                       optional_yield y,
+                                       std::string_view tenant,
+                                       std::string_view name,
+                                       RGWAccountInfo& info,
+                                       Attrs& attrs,
+                                       RGWObjVersionTracker& objv)
+{
+  return next->load_account_by_name(dpp, y, tenant, name, info, attrs, objv);
+}
+
+int FilterDriver::load_account_by_email(const DoutPrefixProvider* dpp,
+                                        optional_yield y,
+                                        std::string_view email,
+                                        RGWAccountInfo& info,
+                                        Attrs& attrs,
+                                        RGWObjVersionTracker& objv)
+{
+  return next->load_account_by_email(dpp, y, email, info, attrs, objv);
+}
+
+int FilterDriver::store_account(const DoutPrefixProvider* dpp,
+                                optional_yield y, bool exclusive,
+                                const RGWAccountInfo& info,
+                                const RGWAccountInfo* old_info,
+                                const Attrs& attrs,
+                                RGWObjVersionTracker& objv)
+{
+  return next->store_account(dpp, y, exclusive, info, old_info, attrs, objv);
+}
+
+int FilterDriver::delete_account(const DoutPrefixProvider* dpp,
+                                 optional_yield y,
+                                 const RGWAccountInfo& info,
+                                 RGWObjVersionTracker& objv)
+{
+  return next->delete_account(dpp, y, info, objv);
+}
+
+int FilterDriver::load_account_stats(const DoutPrefixProvider* dpp,
+                                     optional_yield y, std::string_view id,
+                                     RGWStorageStats& stats,
+                                     ceph::real_time& last_synced,
+                                     ceph::real_time& last_updated)
+{
+  return next->load_account_stats(dpp, y, id, stats, last_synced, last_updated);
+}
+
+int FilterDriver::load_account_stats_async(const DoutPrefixProvider* dpp,
+                                           std::string_view id,
+                                           boost::intrusive_ptr<ReadStatsCB> cb)
+{
+  return next->load_account_stats_async(dpp, id, std::move(cb));
+}
+
 std::unique_ptr<Object> FilterDriver::get_object(const rgw_obj_key& k)
 {
   std::unique_ptr<Object> o = next->get_object(k);
index edc8e86b94022d25a314123823e1ea0f6d122d25..5c4e632724560da93b9596a58e355075b4c130ca 100644 (file)
@@ -156,6 +156,45 @@ public:
   virtual int get_user_by_swift(const DoutPrefixProvider* dpp, const
                                std::string& user_str, optional_yield y,
                                std::unique_ptr<User>* user) override;
+
+  int load_account_by_id(const DoutPrefixProvider* dpp,
+                         optional_yield y,
+                         std::string_view id,
+                         RGWAccountInfo& info,
+                         Attrs& attrs,
+                         RGWObjVersionTracker& objv) override;
+  int load_account_by_name(const DoutPrefixProvider* dpp,
+                           optional_yield y,
+                           std::string_view tenant,
+                           std::string_view name,
+                           RGWAccountInfo& info,
+                           Attrs& attrs,
+                           RGWObjVersionTracker& objv) override;
+  int load_account_by_email(const DoutPrefixProvider* dpp,
+                            optional_yield y,
+                            std::string_view email,
+                            RGWAccountInfo& info,
+                            Attrs& attrs,
+                            RGWObjVersionTracker& objv) override;
+  int store_account(const DoutPrefixProvider* dpp,
+                    optional_yield y, bool exclusive,
+                    const RGWAccountInfo& info,
+                    const RGWAccountInfo* old_info,
+                    const Attrs& attrs,
+                    RGWObjVersionTracker& objv) override;
+  int delete_account(const DoutPrefixProvider* dpp,
+                     optional_yield y,
+                     const RGWAccountInfo& info,
+                     RGWObjVersionTracker& objv) override;
+  int load_account_stats(const DoutPrefixProvider* dpp,
+                         optional_yield y, std::string_view id,
+                         RGWStorageStats& stats,
+                         ceph::real_time& last_synced,
+                         ceph::real_time& last_updated) override;
+  int load_account_stats_async(const DoutPrefixProvider* dpp,
+                               std::string_view id,
+                               boost::intrusive_ptr<ReadStatsCB> cb) override;
+
   virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
   std::unique_ptr<Bucket> get_bucket(const RGWBucketInfo& i) override;
   int load_bucket(const DoutPrefixProvider* dpp, const rgw_bucket& b,