]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notifications: add const to APIs when possible 49256/head
authorYuval Lifshitz <ylifshit@redhat.com>
Fri, 25 Nov 2022 14:15:27 +0000 (16:15 +0200)
committerYuval Lifshitz <ylifshit@redhat.com>
Mon, 23 Jan 2023 17:45:44 +0000 (17:45 +0000)
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
PendingReleaseNotes
src/rgw/driver/rados/rgw_notify.cc
src/rgw/driver/rados/rgw_pubsub.cc
src/rgw/driver/rados/rgw_pubsub.h
src/rgw/driver/rados/rgw_rest_pubsub.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/rgw_admin.cc

index e216861ba6fdd072a251c95032bdd5915a6dd3f1..b6a18ff9a997314028c8f3f7667e5c45de47c252 100644 (file)
@@ -89,6 +89,9 @@
   notifications needs to pull them (instead of the notifications be pushed 
   to it), an external message bus (e.g. rabbitmq, Kafka) should be used for 
   that purpose.
+* RGW: The serialized format of notification and topics has changed, so that 
+  new/updated topics will be unreadable by old RGWs. We recommend completing 
+  the RGW upgrades before creating or modifying any notification topics.
 * RBD: Trailing newline in passphrase files (`<passphrase-file>` argument in
   `rbd encryption format` command and `--encryption-passphrase-file` option
   in other commands) is no longer stripped.
index 0ff4a13fba6a007830550a20e3171942231a2ccc..bfe1f9413600aeaf89a1ff65185a1c7305bc18cf 100644 (file)
@@ -777,8 +777,8 @@ static inline bool notification_match(reservation_t& res,
                      reservation_t& res,
                      const RGWObjTags* req_tags)
 {
-  RGWPubSub ps(res.store, res.user_tenant);
-  RGWPubSub::Bucket ps_bucket(&ps, res.bucket->get_key());
+  const RGWPubSub ps(res.store, res.user_tenant);
+  const RGWPubSub::Bucket ps_bucket(ps, res.bucket->get_key());
   rgw_pubsub_bucket_topics bucket_topics;
   auto rc = ps_bucket.get_topics(&bucket_topics);
   if (rc < 0) {
index ab03e30f58f1046b01b717fecab1ae51b51feedf..4ffee1769d9297d52b6f9d0a1d6028512a4dad90 100644 (file)
@@ -15,7 +15,6 @@
 
 #define dout_subsys ceph_subsys_rgw
 
-using namespace std;
 void set_event_id(std::string& id, const std::string& hash, const utime_t& ts) {
   char buf[64];
   const auto len = snprintf(buf, sizeof(buf), "%010ld.%06ld.%s", (long)ts.sec(), (long)ts.usec(), hash.c_str());
@@ -178,7 +177,7 @@ bool match(const rgw_s3_key_value_filter& filter, const KeyMultiValueMap& kv) {
   // object metadata/tags may include items not in the filter
   for (auto& filter : filter.kv) {
     auto result = kv.equal_range(filter.first);
-    if (std::any_of(result.first, result.second, [&filter](const pair<string,string>& p) { return p.second == filter.second;}))
+    if (std::any_of(result.first, result.second, [&filter](const std::pair<std::string, std::string>& p) { return p.second == filter.second;}))
       continue;
     else
       return false;
@@ -194,7 +193,7 @@ bool match(const rgw::notify::EventTypeList& events, rgw::notify::EventType even
   return true;
 }
 
-void do_decode_xml_obj(rgw::notify::EventTypeList& l, const string& name, XMLObj *obj) {
+void do_decode_xml_obj(rgw::notify::EventTypeList& l, const std::string& name, XMLObj *obj) {
   l.clear();
 
   XMLObjIter iter = obj->find(name);
@@ -414,7 +413,7 @@ RGWPubSub::RGWPubSub(rgw::sal::RadosStore* _store, const std::string& _tenant)
 int RGWPubSub::remove(const DoutPrefixProvider *dpp, 
                           const rgw_raw_obj& obj,
                          RGWObjVersionTracker *objv_tracker,
-                         optional_yield y)
+                         optional_yield y) const
 {
   int ret = rgw_delete_system_obj(dpp, store->svc()->sysobj, obj.pool, obj.oid, objv_tracker, y);
   if (ret < 0) {
@@ -424,7 +423,7 @@ int RGWPubSub::remove(const DoutPrefixProvider *dpp,
   return 0;
 }
 
-int RGWPubSub::read_topics(rgw_pubsub_topics *result, RGWObjVersionTracker *objv_tracker)
+int RGWPubSub::read_topics(rgw_pubsub_topics *result, RGWObjVersionTracker *objv_tracker) const
 {
   int ret = read(meta_obj, result, objv_tracker);
   if (ret < 0) {
@@ -435,7 +434,7 @@ int RGWPubSub::read_topics(rgw_pubsub_topics *result, RGWObjVersionTracker *objv
 }
 
 int RGWPubSub::write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_topics& topics,
-                                    RGWObjVersionTracker *objv_tracker, optional_yield y)
+                                    RGWObjVersionTracker *objv_tracker, optional_yield y) const
 {
   int ret = write(dpp, meta_obj, topics, objv_tracker, y);
   if (ret < 0 && ret != -ENOENT) {
@@ -445,16 +444,16 @@ int RGWPubSub::write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_topi
   return 0;
 }
 
-int RGWPubSub::get_topics(rgw_pubsub_topics *result)
+int RGWPubSub::get_topics(rgw_pubsub_topics *result) const
 {
   return read_topics(result, nullptr);
 }
 
-int RGWPubSub::Bucket::read_topics(rgw_pubsub_bucket_topics *result, RGWObjVersionTracker *objv_tracker)
+int RGWPubSub::Bucket::read_topics(rgw_pubsub_bucket_topics *result, RGWObjVersionTracker *objv_tracker) const
 {
-  int ret = ps->read(bucket_meta_obj, result, objv_tracker);
+  int ret = ps.read(bucket_meta_obj, result, objv_tracker);
   if (ret < 0 && ret != -ENOENT) {
-    ldout(ps->store->ctx(), 1) << "ERROR: failed to read bucket topics info: ret=" << ret << dendl;
+    ldout(ps.store->ctx(), 1) << "ERROR: failed to read bucket topics info: ret=" << ret << dendl;
     return ret;
   }
   return 0;
@@ -462,23 +461,23 @@ int RGWPubSub::Bucket::read_topics(rgw_pubsub_bucket_topics *result, RGWObjVersi
 
 int RGWPubSub::Bucket::write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_bucket_topics& topics,
                                        RGWObjVersionTracker *objv_tracker,
-                                       optional_yield y)
+                                       optional_yield y) const
 {
-  int ret = ps->write(dpp, bucket_meta_obj, topics, objv_tracker, y);
+  int ret = ps.write(dpp, bucket_meta_obj, topics, objv_tracker, y);
   if (ret < 0) {
-    ldout(ps->store->ctx(), 1) << "ERROR: failed to write bucket topics info: ret=" << ret << dendl;
+    ldout(ps.store->ctx(), 1) << "ERROR: failed to write bucket topics info: ret=" << ret << dendl;
     return ret;
   }
 
   return 0;
 }
 
-int RGWPubSub::Bucket::get_topics(rgw_pubsub_bucket_topics *result)
+int RGWPubSub::Bucket::get_topics(rgw_pubsub_bucket_topics *result) const
 {
   return read_topics(result, nullptr);
 }
 
-int RGWPubSub::get_topic(const string& name, rgw_pubsub_topic *result)
+int RGWPubSub::get_topic(const std::string& name, rgw_pubsub_topic *result) const
 {
   rgw_pubsub_topics topics;
   int ret = get_topics(&topics);
@@ -497,14 +496,16 @@ int RGWPubSub::get_topic(const string& name, rgw_pubsub_topic *result)
   return 0;
 }
 
-int RGWPubSub::Bucket::create_notification(const DoutPrefixProvider *dpp, const string& topic_name, const rgw::notify::EventTypeList& events, optional_yield y) {
+int RGWPubSub::Bucket::create_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, 
+    const rgw::notify::EventTypeList& events, optional_yield y) const {
   return create_notification(dpp, topic_name, events, std::nullopt, "", y);
 }
 
-int RGWPubSub::Bucket::create_notification(const DoutPrefixProvider *dpp, const string& topic_name,const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y) {
+int RGWPubSub::Bucket::create_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, 
+    const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y) const {
   rgw_pubsub_topic topic_info;
 
-  int ret = ps->get_topic(topic_name, &topic_info);
+  int ret = ps.get_topic(topic_name, &topic_info);
   if (ret < 0) {
     ldpp_dout(dpp, 1) << "ERROR: failed to read topic '" << topic_name << "' info: ret=" << ret << dendl;
     return ret;
@@ -542,11 +543,11 @@ int RGWPubSub::Bucket::create_notification(const DoutPrefixProvider *dpp, const
   return 0;
 }
 
-int RGWPubSub::Bucket::remove_notification(const DoutPrefixProvider *dpp, const string& topic_name, optional_yield y)
+int RGWPubSub::Bucket::remove_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, optional_yield y) const
 {
   rgw_pubsub_topic topic_info;
 
-  int ret = ps->get_topic(topic_name, &topic_info);
+  int ret = ps.get_topic(topic_name, &topic_info);
   if (ret < 0) {
     ldpp_dout(dpp, 1) << "ERROR: failed to read topic info: ret=" << ret << dendl;
     return ret;
@@ -565,7 +566,7 @@ int RGWPubSub::Bucket::remove_notification(const DoutPrefixProvider *dpp, const
 
   if (bucket_topics.topics.empty()) {
     // no more topics - delete the notification object of the bucket
-    ret = ps->remove(dpp, bucket_meta_obj, &objv_tracker, y);
+    ret = ps.remove(dpp, bucket_meta_obj, &objv_tracker, y);
     if (ret < 0 && ret != -ENOENT) {
       ldpp_dout(dpp, 1) << "ERROR: failed to remove bucket topics: ret=" << ret << dendl;
       return ret;
@@ -583,7 +584,7 @@ int RGWPubSub::Bucket::remove_notification(const DoutPrefixProvider *dpp, const
   return 0;
 }
 
-int RGWPubSub::Bucket::remove_notifications(const DoutPrefixProvider *dpp, optional_yield y)
+int RGWPubSub::Bucket::remove_notifications(const DoutPrefixProvider *dpp, optional_yield y) const
 {
   // get all topics on a bucket
   rgw_pubsub_bucket_topics bucket_topics;
@@ -596,14 +597,14 @@ int RGWPubSub::Bucket::remove_notifications(const DoutPrefixProvider *dpp, optio
   // remove all auto-genrated topics
   for (const auto& topic : bucket_topics.topics) {
     const auto& topic_name = topic.first;
-    ret = ps->remove_topic(dpp, topic_name, y);
+    ret = ps.remove_topic(dpp, topic_name, y);
     if (ret < 0 && ret != -ENOENT) {
       ldpp_dout(dpp, 5) << "WARNING: failed to remove auto-generated topic '" << topic_name << "', ret=" << ret << dendl;
     }
   }
 
   // delete the notification object of the bucket
-  ret = ps->remove(dpp, bucket_meta_obj, nullptr, y);
+  ret = ps.remove(dpp, bucket_meta_obj, nullptr, y);
   if (ret < 0 && ret != -ENOENT) {
     ldpp_dout(dpp, 1) << "ERROR: failed to remove bucket topics: ret=" << ret << dendl;
     return ret;
@@ -612,11 +613,12 @@ int RGWPubSub::Bucket::remove_notifications(const DoutPrefixProvider *dpp, optio
   return 0;
 }
 
-int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const string& name, optional_yield y) {
+int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const {
   return create_topic(dpp, name, rgw_pubsub_dest{}, "", "", y);
 }
 
-int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const string& name, const rgw_pubsub_dest& dest, const std::string& arn, const std::string& opaque_data, optional_yield y) {
+int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const std::string& name, const rgw_pubsub_dest& dest, 
+    const std::string& arn, const std::string& opaque_data, optional_yield y) const {
   RGWObjVersionTracker objv_tracker;
   rgw_pubsub_topics topics;
 
@@ -643,7 +645,7 @@ int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const string& name, c
   return 0;
 }
 
-int RGWPubSub::remove_topic(const DoutPrefixProvider *dpp, const string& name, optional_yield y)
+int RGWPubSub::remove_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const
 {
   RGWObjVersionTracker objv_tracker;
   rgw_pubsub_topics topics;
index d3a9ebf6d3ae048c1ebf11f13eeffe72ca64cd19..6b5f029d7ef926ab88c55bf59c96187f48ef988e 100644 (file)
@@ -541,9 +541,9 @@ class RGWPubSub
 {
   friend class Bucket;
 
-  rgw::sal::RadosStore* store;
+  rgw::sal::RadosStore* const store;
   const std::string tenant;
-  RGWSI_SysObj* svc_sysobj;
+  RGWSI_SysObj* const svc_sysobj;
 
   rgw_raw_obj meta_obj;
 
@@ -556,61 +556,63 @@ class RGWPubSub
   }
 
   template <class T>
-  int read(const rgw_raw_obj& obj, T* data, RGWObjVersionTracker* objv_tracker);
+  int read(const rgw_raw_obj& obj, T* data, RGWObjVersionTracker* objv_tracker) const;
 
   template <class T>
   int write(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, const T& info,
-           RGWObjVersionTracker* obj_tracker, optional_yield y);
+           RGWObjVersionTracker* obj_tracker, optional_yield y) const;
 
   int remove(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, RGWObjVersionTracker* objv_tracker,
-            optional_yield y);
+            optional_yield y) const;
 
-  int read_topics(rgw_pubsub_topics *result, RGWObjVersionTracker* objv_tracker);
+  int read_topics(rgw_pubsub_topics *result, RGWObjVersionTracker* objv_tracker) const;
   int write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_topics& topics,
-                       RGWObjVersionTracker* objv_tracker, optional_yield y);
+                       RGWObjVersionTracker* objv_tracker, optional_yield y) const;
 
 public:
   RGWPubSub(rgw::sal::RadosStore* _store, const std::string& tenant);
 
   class Bucket {
     friend class RGWPubSub;
-    RGWPubSub *ps;
-    rgw_bucket bucket;
+    const RGWPubSub& ps;
+    const rgw_bucket& bucket;
     rgw_raw_obj bucket_meta_obj;
 
     // read the list of topics associated with a bucket and populate into result
     // use version tacker to enforce atomicity between read/write
     // return 0 on success or if no topic was associated with the bucket, error code otherwise
-    int read_topics(rgw_pubsub_bucket_topics *result, RGWObjVersionTracker* objv_tracker);
+    int read_topics(rgw_pubsub_bucket_topics *result, RGWObjVersionTracker* objv_tracker) const;
     // set the list of topics associated with a bucket
     // use version tacker to enforce atomicity between read/write
     // return 0 on success, error code otherwise
     int write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_bucket_topics& topics,
-                    RGWObjVersionTracker* objv_tracker, optional_yield y);
+                    RGWObjVersionTracker* objv_tracker, optional_yield y) const;
   public:
-    Bucket(RGWPubSub *_ps, const rgw_bucket& _bucket) : ps(_ps), bucket(_bucket) {
-      ps->get_bucket_meta_obj(bucket, &bucket_meta_obj);
+    Bucket(const RGWPubSub& _ps, const rgw_bucket& _bucket) : ps(_ps), bucket(_bucket) {
+      ps.get_bucket_meta_obj(bucket, &bucket_meta_obj);
     }
 
     // read the list of topics associated with a bucket and populate into result
     // return 0 on success or if no topic was associated with the bucket, error code otherwise
-    int get_topics(rgw_pubsub_bucket_topics *result);
+    int get_topics(rgw_pubsub_bucket_topics *result) const;
     // adds a topic + filter (event list, and possibly name metadata or tags filters) to a bucket
     // assigning a notification name is optional (needed for S3 compatible notifications)
     // if the topic already exist on the bucket, the filter event list may be updated
     // for S3 compliant notifications the version with: s3_filter and notif_name should be used
     // return -ENOENT if the topic does not exists
     // return 0 on success, error code otherwise
-    int create_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, const rgw::notify::EventTypeList& events, optional_yield y);
-    int create_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y);
+    int create_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, 
+        const rgw::notify::EventTypeList& events, optional_yield y) const;
+    int create_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, 
+        const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y) const;
     // remove a topic and filter from bucket
     // if the topic does not exists on the bucket it is a no-op (considered success)
     // return -ENOENT if the topic does not exists
     // return 0 on success, error code otherwise
-    int remove_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, optional_yield y);
+    int remove_notification(const DoutPrefixProvider *dpp, const std::string& topic_name, optional_yield y) const;
     // remove all notifications (and autogenerated topics) associated with the bucket
     // return 0 on success or if no topic was associated with the bucket, error code otherwise
-    int remove_notifications(const DoutPrefixProvider *dpp, optional_yield y);
+    int remove_notifications(const DoutPrefixProvider *dpp, optional_yield y) const;
   };
 
   void get_meta_obj(rgw_raw_obj *obj) const;
@@ -618,28 +620,28 @@ public:
 
   // get all topics (per tenant, if used)) and populate them into "result"
   // return 0 on success or if no topics exist, error code otherwise
-  int get_topics(rgw_pubsub_topics *result);
+  int get_topics(rgw_pubsub_topics *result) const;
   // get a topic with by its name and populate it into "result"
   // return -ENOENT if the topic does not exists 
   // return 0 on success, error code otherwise
-  int get_topic(const std::string& name, rgw_pubsub_topic *result);
+  int get_topic(const std::string& name, rgw_pubsub_topic *result) const;
   // create a topic with a name only
   // if the topic already exists it is a no-op (considered success)
   // return 0 on success, error code otherwise
-  int create_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y);
+  int create_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const;
   // create a topic with push destination information and ARN
   // if the topic already exists the destination and ARN values may be updated (considered succsess)
   // return 0 on success, error code otherwise
-  int create_topic(const DoutPrefixProvider *dpp, const std::string& name, const rgw_pubsub_dest& dest, const std::string& arn, const std::string& opaque_data, optional_yield y);
+  int create_topic(const DoutPrefixProvider *dpp, const std::string& name, const rgw_pubsub_dest& dest, 
+      const std::string& arn, const std::string& opaque_data, optional_yield y) const;
   // remove a topic according to its name
   // if the topic does not exists it is a no-op (considered success)
   // return 0 on success, error code otherwise
-  int remove_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y);
+  int remove_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const;
 };
 
-
 template <class T>
-int RGWPubSub::read(const rgw_raw_obj& obj, T* result, RGWObjVersionTracker* objv_tracker)
+int RGWPubSub::read(const rgw_raw_obj& obj, T* result, RGWObjVersionTracker* objv_tracker) const
 {
   bufferlist bl;
   int ret = rgw_get_system_obj(svc_sysobj,
@@ -663,7 +665,7 @@ int RGWPubSub::read(const rgw_raw_obj& obj, T* result, RGWObjVersionTracker* obj
 
 template <class T>
 int RGWPubSub::write(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, const T& info,
-                        RGWObjVersionTracker* objv_tracker, optional_yield y)
+                        RGWObjVersionTracker* objv_tracker, optional_yield y) const
 {
   bufferlist bl;
   encode(info, bl);
@@ -671,3 +673,4 @@ int RGWPubSub::write(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, cons
   return rgw_put_system_obj(dpp, svc_sysobj, obj.pool, obj.oid,
                             bl, false, objv_tracker, real_time(), y);
 }
+
index 92b402d379db56ff4572b68047a051677782575c..befcda4ae43f322d4060f75f1f23d375e056ca8f 100644 (file)
@@ -627,7 +627,7 @@ auto find_unique_topic(const rgw_pubsub_bucket_topics& bucket_topics, const std:
 }
 }
 
-int remove_notification_by_topic(const DoutPrefixProvider *dpp, const std::string& topic_name, RGWPubSub::Bucket& b, optional_yield y, RGWPubSub& ps) {
+int remove_notification_by_topic(const DoutPrefixProvider *dpp, const std::string& topic_name, const RGWPubSub::Bucket& b, optional_yield y, const RGWPubSub& ps) {
   int op_ret = b.remove_notification(dpp, topic_name, y);
   if (op_ret < 0) {
     ldpp_dout(dpp, 1) << "failed to remove notification of topic '" << topic_name << "', ret=" << op_ret << dendl;
@@ -639,7 +639,7 @@ int remove_notification_by_topic(const DoutPrefixProvider *dpp, const std::strin
   return op_ret;
 }
 
-int delete_all_notifications(const DoutPrefixProvider *dpp, const rgw_pubsub_bucket_topics& bucket_topics, RGWPubSub::Bucket& b, optional_yield y, RGWPubSub& ps) {
+int delete_all_notifications(const DoutPrefixProvider *dpp, const rgw_pubsub_bucket_topics& bucket_topics, const RGWPubSub::Bucket& b, optional_yield y, const RGWPubSub& ps) {
   // delete all notifications of on a bucket
   for (const auto& topic : bucket_topics.topics) {
     const auto op_ret = remove_notification_by_topic(dpp, topic.first, b, y, ps);
@@ -734,8 +734,8 @@ void RGWPSCreateNotifOp::execute(optional_yield y) {
     return;
   }
 
-  RGWPubSub ps(static_cast<rgw::sal::RadosStore*>(driver), s->owner.get_id().tenant);
-  RGWPubSub::Bucket b(&ps, bucket_info.bucket);
+  const RGWPubSub ps(static_cast<rgw::sal::RadosStore*>(driver), s->owner.get_id().tenant);
+  const RGWPubSub::Bucket b(ps, bucket_info.bucket);
 
   if(configurations.list.empty()) {
     // get all topics on a bucket
@@ -880,8 +880,8 @@ void RGWPSDeleteNotifOp::execute(optional_yield y) {
     return;
   }
 
-  RGWPubSub ps(static_cast<rgw::sal::RadosStore*>(driver), s->owner.get_id().tenant);
-  RGWPubSub::Bucket b(&ps, bucket_info.bucket);
+  const RGWPubSub ps(static_cast<rgw::sal::RadosStore*>(driver), s->owner.get_id().tenant);
+  const RGWPubSub::Bucket b(ps, bucket_info.bucket);
 
   // get all topics on a bucket
   rgw_pubsub_bucket_topics bucket_topics;
@@ -979,8 +979,8 @@ private:
 };
 
 void RGWPSListNotifsOp::execute(optional_yield y) {
-  RGWPubSub ps(static_cast<rgw::sal::RadosStore*>(driver), s->owner.get_id().tenant);
-  RGWPubSub::Bucket b(&ps, bucket_info.bucket);
+  const RGWPubSub ps(static_cast<rgw::sal::RadosStore*>(driver), s->owner.get_id().tenant);
+  const RGWPubSub::Bucket b(ps, bucket_info.bucket);
   
   // get all topics on a bucket
   rgw_pubsub_bucket_topics bucket_topics;
index cd0e4e231b6164a0b21c541fdbfebc3d1bd435f8..548090f23f6476ea9c59fa4aba1c4c70f2ce81f8 100644 (file)
@@ -470,8 +470,8 @@ int RadosBucket::remove_bucket(const DoutPrefixProvider* dpp,
 
   // if bucket has notification definitions associated with it
   // they should be removed (note that any pending notifications on the bucket are still going to be sent)
-  RGWPubSub ps(store, info.owner.tenant);
-  RGWPubSub::Bucket ps_bucket(&ps, info.bucket);
+  const RGWPubSub ps(store, info.owner.tenant);
+  const RGWPubSub::Bucket ps_bucket(ps, info.bucket);
   const auto ps_ret = ps_bucket.remove_notifications(dpp, y);
   if (ps_ret < 0 && ps_ret != -ENOENT) {
     ldpp_dout(dpp, -1) << "ERROR: unable to remove notifications from bucket. ret=" << ps_ret << dendl;
index 0ac61c279ba8bd0118da30070135eba96d6b43a7..749ddefa238ff951388b7dc9e24d9a0f1c274a2e 100644 (file)
@@ -10465,7 +10465,7 @@ next:
         return -ret;
       }
 
-      RGWPubSub::Bucket b(&ps, bucket->get_key());
+      const RGWPubSub::Bucket b(ps, bucket->get_key());
       ret = b.get_topics(&result);
       if (ret < 0 && ret != -ENOENT) {
         cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;