summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_pubsub.h
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@redhat.com>2024-01-10 00:55:40 +0100
committerCasey Bodley <cbodley@redhat.com>2024-03-05 18:55:25 +0100
commitdb6c73a0cdcf60a920c91b6d4506df36d98b7308 (patch)
treed619501417c3398dfd838962b34de3aef3c1b70d /src/rgw/rgw_pubsub.h
parentrgw/mdlog: add complete_entry() for most common usage (diff)
downloadceph-db6c73a0cdcf60a920c91b6d4506df36d98b7308.tar.xz
ceph-db6c73a0cdcf60a920c91b6d4506df36d98b7308.zip
rgw: paginate ListTopics
rename read_topics()/write_topics() to 'v1' and only call them from internal v1 call paths public get_topics() now calls read_topics_v1() for the v1 case, and does the paginated listing with driver->meta_list_keys_next() for v2 RGWPSListTopicsOp now uses the NextToken request/response params with the paginated get_topics(), limiting responses to 100 entries like AWS 'radosgw-admin topic list' also paginates the listing according to --max-entries to avoid reading everything into memory at once Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/rgw_pubsub.h')
-rw-r--r--src/rgw/rgw_pubsub.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/rgw/rgw_pubsub.h b/src/rgw/rgw_pubsub.h
index ed785672175..519c1053ab3 100644
--- a/src/rgw/rgw_pubsub.h
+++ b/src/rgw/rgw_pubsub.h
@@ -562,10 +562,10 @@ class RGWPubSub
const std::string tenant;
bool use_notification_v2 = false;
- int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result,
- RGWObjVersionTracker* objv_tracker, optional_yield y) const;
- int write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_topics& topics,
- RGWObjVersionTracker* objv_tracker, optional_yield y) const;
+ int read_topics_v1(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result,
+ RGWObjVersionTracker* objv_tracker, optional_yield y) const;
+ int write_topics_v1(const DoutPrefixProvider *dpp, const rgw_pubsub_topics& topics,
+ RGWObjVersionTracker* objv_tracker, optional_yield y) const;
public:
RGWPubSub(rgw::sal::Driver* _driver, const std::string& tenant);
@@ -620,11 +620,13 @@ public:
int remove_notifications(const DoutPrefixProvider *dpp, optional_yield y) const;
};
- // get the list of topics
- // return 0 on success or if no topic was associated with the bucket, error code otherwise
- int get_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result, optional_yield y) const {
- return read_topics(dpp, result, nullptr, y);
- }
+ // get a paginated list of topics
+ // return 0 on success, error code otherwise
+ int get_topics(const DoutPrefixProvider* dpp,
+ const std::string& start_marker, int max_items,
+ rgw_pubsub_topics& result, std::string& next_marker,
+ optional_yield y) 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.