Merge pull request #14299 from rzarzynski/wip-rgw-deduplicate-rgw_make_bucket_entry_name

rgw: deduplicate variants of rgw_make_bucket_entry_name().

Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2017-04-26 11:38:13 -04:00 committed by GitHub
commit 82aea4722b
2 changed files with 11 additions and 17 deletions

View File

@ -51,18 +51,9 @@ void rgw_get_buckets_obj(const rgw_user& user_id, string& buckets_obj_id)
* acceptable in bucket names and thus qualified buckets cannot conflict
* with the legacy or S3 buckets.
*/
void rgw_make_bucket_entry_name(const string& tenant_name, const string& bucket_name, string& bucket_entry) {
if (bucket_name.empty()) {
bucket_entry.clear();
} else if (tenant_name.empty()) {
bucket_entry = bucket_name;
} else {
bucket_entry = tenant_name + "/" + bucket_name;
}
}
string rgw_make_bucket_entry_name(const string& tenant_name, const string& bucket_name) {
string bucket_entry;
std::string rgw_make_bucket_entry_name(const std::string& tenant_name,
const std::string& bucket_name) {
std::string bucket_entry;
if (bucket_name.empty()) {
bucket_entry.clear();

View File

@ -49,11 +49,14 @@ extern int rgw_bucket_delete_bucket_obj(RGWRados *store,
extern int rgw_bucket_sync_user_stats(RGWRados *store, const rgw_user& user_id, const RGWBucketInfo& bucket_info);
extern int rgw_bucket_sync_user_stats(RGWRados *store, const string& tenant_name, const string& bucket_name);
extern void rgw_make_bucket_entry_name(const string& tenant_name,
const string& bucket_name,
string& bucket_entry);
extern string rgw_make_bucket_entry_name(const string& tenant_name,
const string& bucket_name);
extern std::string rgw_make_bucket_entry_name(const std::string& tenant_name,
const std::string& bucket_name);
static inline void rgw_make_bucket_entry_name(const string& tenant_name,
const string& bucket_name,
std::string& bucket_entry) {
bucket_entry = rgw_make_bucket_entry_name(tenant_name, bucket_name);
}
extern void rgw_parse_url_bucket(const string& bucket,
const string& auth_tenant,
string &tenant_name, string &bucket_name);