rgw: make rgw_read_user_buckets() backward compatible.

Fixes: #10683
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
This commit is contained in:
Radoslaw Zarzynski 2015-03-31 12:41:11 +02:00
parent f7b92f9988
commit 7dd54fa362
3 changed files with 19 additions and 5 deletions

View File

@ -42,8 +42,13 @@ void rgw_get_buckets_obj(const string& user_id, string& buckets_obj_id)
* Get all the buckets owned by a user and fill up an RGWUserBuckets with them.
* Returns: 0 on success, -ERR# on failure.
*/
int rgw_read_user_buckets(RGWRados *store, string user_id, RGWUserBuckets& buckets,
const string& marker, uint64_t max, bool need_stats)
int rgw_read_user_buckets(RGWRados * store,
string user_id,
RGWUserBuckets& buckets,
const string& marker,
uint64_t max,
bool need_stats,
uint64_t default_amount)
{
int ret;
buckets.clear();
@ -59,6 +64,10 @@ int rgw_read_user_buckets(RGWRados *store, string user_id, RGWUserBuckets& bucke
uint64_t total = 0;
if (!max) {
max = default_amount;
}
do {
ret = store->cls_user_list_buckets(obj, m, max - total, entries, &m, &truncated);
if (ret == -ENOENT)

View File

@ -104,8 +104,13 @@ extern void rgw_bucket_init(RGWMetadataManager *mm);
* Get all the buckets owned by a user and fill up an RGWUserBuckets with them.
* Returns: 0 on success, -ERR# on failure.
*/
extern int rgw_read_user_buckets(RGWRados *store, string user_id, RGWUserBuckets& buckets,
const string& marker, uint64_t max, bool need_stats);
extern int rgw_read_user_buckets(RGWRados *store,
string user_id,
RGWUserBuckets& buckets,
const string& marker,
uint64_t max,
bool need_stats,
uint64_t default_amount = 1000);
extern int rgw_link_bucket(RGWRados *store, string user_id, rgw_bucket& bucket, time_t creation_time, bool update_entrypoint = true);
extern int rgw_unlink_bucket(RGWRados *store, string user_id, const string& bucket_name, bool update_entrypoint = true);

View File

@ -1002,7 +1002,7 @@ void RGWListBuckets::execute()
read_count = min(limit - total_count, (uint64_t)max_buckets);
ret = rgw_read_user_buckets(store, s->user.user_id, buckets,
marker, read_count, should_get_stats());
marker, read_count, should_get_stats(), 0);
if (!started) {
send_response_begin(buckets.count() > 0);