From f8bb819e486f5cfbfc2e4659d11008f7a17962c4 Mon Sep 17 00:00:00 2001 From: kchheda3 Date: Wed, 16 Aug 2023 00:23:16 +0530 Subject: [PATCH] rgw/notification: Publish notification information in bucket stats Signed-off-by: kchheda3 --- src/rgw/driver/rados/rgw_bucket.cc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index 686b7223b87..25d24d02922 100644 --- a/src/rgw/driver/rados/rgw_bucket.cc +++ b/src/rgw/driver/rados/rgw_bucket.cc @@ -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 bucket; map 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(); -- 2.39.5