]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notification: Publish notification information in bucket stats 53009/head
authorkchheda3 <kchheda3@bloomberg.net>
Tue, 15 Aug 2023 18:53:16 +0000 (00:23 +0530)
committerkchheda3 <kchheda3@bloomberg.net>
Wed, 6 Sep 2023 14:08:56 +0000 (10:08 -0400)
Signed-off-by: kchheda3 <kchheda3@bloomberg.net>
src/rgw/driver/rados/rgw_bucket.cc

index 686b7223b87608a412aba0d3b267a0740d093a2a..25d24d02922e708c47a03a4f8c180a6775a26677 100644 (file)
@@ -13,6 +13,7 @@
 #include "services/svc_user.h"
 
 #include "rgw_reshard.h"
+#include "rgw_pubsub.h"
 
 // stolen from src/cls/version/cls_version.cc
 #define VERSION_ATTR "ceph.objclass.version"
@@ -862,11 +863,9 @@ int RGWBucketAdminOp::sync_bucket(rgw::sal::Driver* driver, RGWBucketAdminOpStat
 }
 
 static int bucket_stats(rgw::sal::Driver* driver,
-                       const std::string& tenant_name,
-                       const std::string& bucket_name,
-                       Formatter *formatter,
-                        const DoutPrefixProvider *dpp, optional_yield y)
-{
+                        const std::string& tenant_name,
+                        const std::string& bucket_name, Formatter* formatter,
+                        const DoutPrefixProvider* dpp, optional_yield y) {
   std::unique_ptr<rgw::sal::Bucket> bucket;
   map<RGWObjCategory, RGWStorageStats> stats;
 
@@ -926,6 +925,17 @@ static int bucket_stats(rgw::sal::Driver* driver,
     }
   }
 
+  // bucket notifications
+  RGWPubSub ps(driver, tenant_name);
+  rgw_pubsub_bucket_topics result;
+  const RGWPubSub::Bucket b(ps, bucket.get());
+  ret = b.get_topics(dpp, result, y);
+  if (ret < 0 && ret != -ENOENT) {
+    cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;
+    return -ret;
+  }
+  result.dump(formatter);
+
   // TODO: bucket CORS
   // TODO: bucket LC
   formatter->close_section();