mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
rgw_file: use emplace_attr in RGWCreateBucket and RGWCopyObj
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
parent
7a7de9b752
commit
601b193874
@ -1879,9 +1879,8 @@ static void populate_with_generic_attrs(const req_state * const s,
|
||||
void RGWCreateBucket::execute()
|
||||
{
|
||||
RGWAccessControlPolicy old_policy(s->cct);
|
||||
map<string, bufferlist> attrs;
|
||||
bufferlist aclbl;
|
||||
bufferlist corsbl;
|
||||
buffer::list aclbl;
|
||||
buffer::list corsbl;
|
||||
bool existed;
|
||||
string bucket_name;
|
||||
rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name, bucket_name);
|
||||
@ -1974,17 +1973,17 @@ void RGWCreateBucket::execute()
|
||||
}
|
||||
|
||||
policy.encode(aclbl);
|
||||
attrs[RGW_ATTR_ACL] = aclbl;
|
||||
emplace_attr(RGW_ATTR_ACL, std::move(aclbl));
|
||||
|
||||
if (has_cors) {
|
||||
cors_config.encode(corsbl);
|
||||
attrs[RGW_ATTR_CORS] = corsbl;
|
||||
emplace_attr(RGW_ATTR_CORS, std::move(corsbl));
|
||||
}
|
||||
s->bucket.tenant = s->bucket_tenant; /* ignored if bucket exists */
|
||||
s->bucket.name = s->bucket_name;
|
||||
op_ret = store->create_bucket(*(s->user), s->bucket, zonegroup_id, placement_rule,
|
||||
swift_ver_location,
|
||||
attrs, info, pobjv, &ep_objv, creation_time,
|
||||
op_ret = store->create_bucket(*(s->user), s->bucket, zonegroup_id,
|
||||
placement_rule, swift_ver_location, attrs,
|
||||
info, pobjv, &ep_objv, creation_time,
|
||||
pmaster_bucket, true);
|
||||
/* continue if EEXIST and create_bucket will fail below. this way we can
|
||||
* recover from a partial create by retrying it. */
|
||||
@ -3219,8 +3218,8 @@ int RGWCopyObj::init_common()
|
||||
|
||||
bufferlist aclbl;
|
||||
dest_policy.encode(aclbl);
|
||||
emplace_attr(RGW_ATTR_ACL, std::move(aclbl));
|
||||
|
||||
attrs[RGW_ATTR_ACL] = aclbl;
|
||||
rgw_get_request_metadata(s->cct, s->info, attrs);
|
||||
|
||||
map<string, string>::iterator iter;
|
||||
|
@ -536,6 +536,7 @@ protected:
|
||||
bool has_cors;
|
||||
RGWCORSConfiguration cors_config;
|
||||
string swift_ver_location;
|
||||
map<string, buffer::list> attrs;
|
||||
set<string> rmattr_names;
|
||||
|
||||
bufferlist in_data;
|
||||
@ -545,6 +546,10 @@ protected:
|
||||
public:
|
||||
RGWCreateBucket() : has_cors(false) {}
|
||||
|
||||
void emplace_attr(std::string&& key, buffer::list&& bl) {
|
||||
attrs.emplace(key, bl); /* key and bl are r-value refs */
|
||||
}
|
||||
|
||||
int verify_permission();
|
||||
void pre_exec();
|
||||
void execute();
|
||||
@ -875,7 +880,7 @@ protected:
|
||||
ceph::real_time unmod_time;
|
||||
ceph::real_time *mod_ptr;
|
||||
ceph::real_time *unmod_ptr;
|
||||
map<string, bufferlist> attrs;
|
||||
map<string, buffer::list> attrs;
|
||||
string src_tenant_name, src_bucket_name;
|
||||
rgw_bucket src_bucket;
|
||||
rgw_obj_key src_object;
|
||||
@ -923,6 +928,10 @@ public:
|
||||
string& bucket_name,
|
||||
rgw_obj_key& object);
|
||||
|
||||
void emplace_attr(std::string&& key, buffer::list&& bl) {
|
||||
attrs.emplace(key, bl); /* key and bl are r-value refs */
|
||||
}
|
||||
|
||||
virtual void init(RGWRados *store, struct req_state *s, RGWHandler *h) {
|
||||
RGWOp::init(store, s, h);
|
||||
dest_policy.set_ctx(s->cct);
|
||||
|
Loading…
Reference in New Issue
Block a user