Skip to content

Commit

Permalink
rgw: refactor arrangement of parameters for rgw_read_user_buckets().
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
  • Loading branch information
rzarzynski committed Apr 21, 2015
1 parent 14c25a6 commit a62fa16
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
10 changes: 6 additions & 4 deletions src/rgw/rgw_bucket.cc
Expand Up @@ -46,10 +46,10 @@ int rgw_read_user_buckets(RGWRados *store,
string user_id,
RGWUserBuckets& buckets,
const string& marker,
const string& end_marker,
uint64_t max,
bool need_stats,
uint64_t default_amount,
string end_marker)
uint64_t default_amount)
{
int ret;
buckets.clear();
Expand Down Expand Up @@ -325,7 +325,8 @@ void check_bad_user_bucket_mapping(RGWRados *store, const string& user_id, bool
size_t max_entries = cct->_conf->rgw_list_buckets_max_chunk;

do {
int ret = rgw_read_user_buckets(store, user_id, user_buckets, marker, max_entries, false);
int ret = rgw_read_user_buckets(store, user_id, user_buckets,
marker, string(), max_entries, false);
if (ret < 0) {
ldout(store->ctx(), 0) << "failed to read user buckets: " << cpp_strerror(-ret) << dendl;
return;
Expand Down Expand Up @@ -1072,7 +1073,8 @@ int RGWBucketAdminOp::info(RGWRados *store, RGWBucketAdminOpState& op_state,
bool done;

do {
ret = rgw_read_user_buckets(store, op_state.get_user_id(), buckets, marker, max_entries, false);
ret = rgw_read_user_buckets(store, op_state.get_user_id(), buckets,
marker, string(), max_entries, false);
if (ret < 0)
return ret;

Expand Down
4 changes: 2 additions & 2 deletions src/rgw/rgw_bucket.h
Expand Up @@ -108,10 +108,10 @@ extern int rgw_read_user_buckets(RGWRados *store,
string user_id,
RGWUserBuckets& buckets,
const string& marker,
const string& end_marker,
uint64_t max,
bool need_stats,
uint64_t default_amount = 1000,
string end_marker = string());
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);
Expand Down
8 changes: 5 additions & 3 deletions src/rgw/rgw_op.cc
Expand Up @@ -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(), end_marker);
marker, end_marker, read_count, should_get_stats());

if (!started) {
send_response_begin(buckets.count() > 0);
Expand Down Expand Up @@ -1060,7 +1060,8 @@ void RGWStatAccount::execute()
do {
RGWUserBuckets buckets;

ret = rgw_read_user_buckets(store, s->user.user_id, buckets, marker, max_buckets, true);
ret = rgw_read_user_buckets(store, s->user.user_id, buckets,
marker, string(), max_buckets, true);
if (ret < 0) {
/* hmm.. something wrong here.. the user was authenticated, so it
should exist */
Expand Down Expand Up @@ -1257,7 +1258,8 @@ int RGWCreateBucket::verify_permission()
if (s->user.max_buckets) {
RGWUserBuckets buckets;
string marker;
int ret = rgw_read_user_buckets(store, s->user.user_id, buckets, marker, s->user.max_buckets, false);
int ret = rgw_read_user_buckets(store, s->user.user_id, buckets,
marker, string(), s->user.max_buckets, false);
if (ret < 0)
return ret;

Expand Down
12 changes: 8 additions & 4 deletions src/rgw/rgw_user.cc
Expand Up @@ -55,7 +55,8 @@ int rgw_user_sync_all_stats(RGWRados *store, const string& user_id)

do {
RGWUserBuckets user_buckets;
ret = rgw_read_user_buckets(store, user_id, user_buckets, marker, max_entries, false);
ret = rgw_read_user_buckets(store, user_id, user_buckets,
marker, string(), max_entries, false);
if (ret < 0) {
ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl;
return ret;
Expand Down Expand Up @@ -370,7 +371,8 @@ int rgw_delete_user(RGWRados *store, RGWUserInfo& info, RGWObjVersionTracker& ob

do {
RGWUserBuckets user_buckets;
ret = rgw_read_user_buckets(store, info.user_id, user_buckets, marker, max_buckets, false);
ret = rgw_read_user_buckets(store, info.user_id, user_buckets,
marker, string(), max_buckets, false);
if (ret < 0)
return ret;

Expand Down Expand Up @@ -1863,7 +1865,8 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg)
size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk;
do {
RGWUserBuckets buckets;
ret = rgw_read_user_buckets(store, uid, buckets, marker, max_buckets, false);
ret = rgw_read_user_buckets(store, uid, buckets,
marker, string(), max_buckets, false);
if (ret < 0) {
set_err_msg(err_msg, "unable to read user bucket info");
return ret;
Expand Down Expand Up @@ -2017,7 +2020,8 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg)
CephContext *cct = store->ctx();
size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk;
do {
ret = rgw_read_user_buckets(store, user_id, buckets, marker, max_buckets, false);
ret = rgw_read_user_buckets(store, user_id, buckets,
marker, string(), max_buckets, false);
if (ret < 0) {
set_err_msg(err_msg, "could not get buckets for uid: " + user_id);
return ret;
Expand Down

0 comments on commit a62fa16

Please sign in to comment.