From a842dd09d584ff7636ec972646caff218df59c4b Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 28 Aug 2017 21:53:28 +0200 Subject: [PATCH] rgw: abstract partial data processing in RGWListBuckets. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_op.cc | 6 +++--- src/rgw/rgw_op.h | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index db00d2ea627..26bd5cba3d7 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1807,7 +1807,7 @@ void RGWListBuckets::execute() bool started = false; uint64_t total_count = 0; - uint64_t max_buckets = s->cct->_conf->rgw_list_buckets_max_chunk; + const uint64_t max_buckets = s->cct->_conf->rgw_list_buckets_max_chunk; op_ret = get_params(); if (op_ret < 0) { @@ -1861,10 +1861,10 @@ void RGWListBuckets::execute() } if (!m.empty()) { - send_response_data(buckets); - map::reverse_iterator riter = m.rbegin(); marker = riter->first; + + handle_listing_chunk((buckets)); } } while (is_truncated && !done); diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index d9ce2b40001..7fe86fade05 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -616,6 +616,13 @@ public: void execute() override; virtual int get_params() = 0; + virtual void handle_listing_chunk(RGWUserBuckets& buckets) { + /* The default implementation, used by e.g. S3, just generates a new + * part of listing and sends it client immediately. Swift can behave + * differently: when the reverse option is requested, all incoming + * instances of RGWUserBuckets are buffered and finally reversed. */ + return send_response_data(buckets); + } virtual void send_response_begin(bool has_buckets) = 0; virtual void send_response_data(RGWUserBuckets& buckets) = 0; virtual void send_response_end() = 0; -- 2.39.5