summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_rest_pubsub.cc
diff options
context:
space:
mode:
authorMatt Benjamin <mbenjamin@redhat.com>2020-12-02 13:43:12 +0100
committerGitHub <noreply@github.com>2020-12-02 13:43:12 +0100
commitf89d98320ef370403c7e8c1f80b555e485228b65 (patch)
tree0564a3d75560195cb8a4d7e08d21328f24686a14 /src/rgw/rgw_rest_pubsub.cc
parentMerge pull request #38171 from yuvalif/wip-yuval-fix-46296 (diff)
parentrgw/notification: trigger notifications on changes from any user (diff)
downloadceph-f89d98320ef370403c7e8c1f80b555e485228b65.tar.xz
ceph-f89d98320ef370403c7e8c1f80b555e485228b65.zip
Merge pull request #38136 from yuvalif/wip-yuval-fix-47904
rgw/notification: trigger notifications on changes from any user
Diffstat (limited to 'src/rgw/rgw_rest_pubsub.cc')
-rw-r--r--src/rgw/rgw_rest_pubsub.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/rgw/rgw_rest_pubsub.cc b/src/rgw/rgw_rest_pubsub.cc
index a232500e6ae..17a75be0674 100644
--- a/src/rgw/rgw_rest_pubsub.cc
+++ b/src/rgw/rgw_rest_pubsub.cc
@@ -492,8 +492,8 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
return;
}
- ups.emplace(store, s->owner.get_id());
- auto b = ups->get_bucket(bucket_info.bucket);
+ ps.emplace(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 = "";
@@ -539,7 +539,7 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
// get topic information. destination information is stored in the topic
rgw_pubsub_topic topic_info;
- op_ret = ups->get_topic(topic_name, &topic_info);
+ op_ret = ps->get_topic(topic_name, &topic_info);
if (op_ret < 0) {
ldout(s->cct, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl;
return;
@@ -554,7 +554,7 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
// generate the internal topic. destination is stored here for the "push-only" case
// when no subscription exists
// ARN is cached to make the "GET" method faster
- op_ret = ups->create_topic(unique_topic_name, topic_info.dest, topic_info.arn, topic_info.opaque_data, y);
+ op_ret = ps->create_topic(unique_topic_name, topic_info.dest, topic_info.arn, topic_info.opaque_data, y);
if (op_ret < 0) {
ldout(s->cct, 1) << "failed to auto-generate unique topic '" << unique_topic_name <<
"', ret=" << op_ret << dendl;
@@ -568,7 +568,7 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
ldout(s->cct, 1) << "failed to auto-generate notification for unique topic '" << unique_topic_name <<
"', ret=" << op_ret << dendl;
// rollback generated topic (ignore return value)
- ups->remove_topic(unique_topic_name, y);
+ ps->remove_topic(unique_topic_name, y);
return;
}
ldout(s->cct, 20) << "successfully auto-generated notification for unique topic '" << unique_topic_name << "'" << dendl;
@@ -578,14 +578,14 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
rgw_pubsub_sub_dest dest = topic_info.dest;
dest.bucket_name = data_bucket_prefix + s->owner.get_id().to_str() + "-" + unique_topic_name;
dest.oid_prefix = data_oid_prefix + notif_name + "/";
- auto sub = ups->get_sub(notif_name);
+ auto sub = ps->get_sub(notif_name);
op_ret = sub->subscribe(unique_topic_name, dest, y, notif_name);
if (op_ret < 0) {
ldout(s->cct, 1) << "failed to auto-generate subscription '" << notif_name << "', ret=" << op_ret << dendl;
// rollback generated notification (ignore return value)
b->remove_notification(unique_topic_name, y);
// rollback generated topic (ignore return value)
- ups->remove_topic(unique_topic_name, y);
+ ps->remove_topic(unique_topic_name, y);
return;
}
ldout(s->cct, 20) << "successfully auto-generated subscription '" << notif_name << "'" << dendl;
@@ -613,12 +613,12 @@ private:
return 0;
}
- void remove_notification_by_topic(const std::string& topic_name, const RGWUserPubSub::BucketRef& b, optional_yield y) {
+ void remove_notification_by_topic(const std::string& topic_name, const RGWPubSub::BucketRef& b, optional_yield y) {
op_ret = b->remove_notification(topic_name, y);
if (op_ret < 0) {
ldout(s->cct, 1) << "failed to remove notification of topic '" << topic_name << "', ret=" << op_ret << dendl;
}
- op_ret = ups->remove_topic(topic_name, y);
+ op_ret = ps->remove_topic(topic_name, y);
if (op_ret < 0) {
ldout(s->cct, 1) << "failed to remove auto-generated topic '" << topic_name << "', ret=" << op_ret << dendl;
}
@@ -635,8 +635,8 @@ void RGWPSDeleteNotif_ObjStore_S3::execute(optional_yield y) {
return;
}
- ups.emplace(store, s->owner.get_id());
- auto b = ups->get_bucket(bucket_info.bucket);
+ ps.emplace(store, s->owner.get_id().tenant);
+ auto b = ps->get_bucket(bucket_info.bucket);
ceph_assert(b);
// get all topics on a bucket
@@ -653,7 +653,7 @@ void RGWPSDeleteNotif_ObjStore_S3::execute(optional_yield y) {
if (unique_topic) {
// remove the auto generated subscription according to notification name (if exist)
const auto unique_topic_name = unique_topic->get().topic.name;
- auto sub = ups->get_sub(notif_name);
+ auto sub = ps->get_sub(notif_name);
op_ret = sub->unsubscribe(unique_topic_name, y);
if (op_ret < 0 && op_ret != -ENOENT) {
ldout(s->cct, 1) << "failed to remove auto-generated subscription '" << notif_name << "', ret=" << op_ret << dendl;
@@ -671,9 +671,9 @@ void RGWPSDeleteNotif_ObjStore_S3::execute(optional_yield y) {
for (const auto& topic : bucket_topics.topics) {
// remove the auto generated subscription of the topic (if exist)
rgw_pubsub_topic_subs topic_subs;
- op_ret = ups->get_topic(topic.first, &topic_subs);
+ op_ret = ps->get_topic(topic.first, &topic_subs);
for (const auto& topic_sub_name : topic_subs.subs) {
- auto sub = ups->get_sub(topic_sub_name);
+ auto sub = ps->get_sub(topic_sub_name);
rgw_pubsub_sub_config sub_conf;
op_ret = sub->get_conf(&sub_conf);
if (op_ret < 0) {
@@ -734,8 +734,8 @@ public:
};
void RGWPSListNotifs_ObjStore_S3::execute(optional_yield y) {
- ups.emplace(store, s->owner.get_id());
- auto b = ups->get_bucket(bucket_info.bucket);
+ ps.emplace(store, s->owner.get_id().tenant);
+ auto b = ps->get_bucket(bucket_info.bucket);
ceph_assert(b);
// get all topics on a bucket