#include <boost/optional.hpp>
#include <boost/utility/in_place_factory.hpp>
#include <boost/function.hpp>
+#include <boost/container/flat_map.hpp>
#include "common/armor.h"
#include "common/mime.h"
#include "rgw_torrent.h"
#include "rgw_tag.h"
#include "rgw_object_lock.h"
-#include "cls/lock/cls_lock_client.h"
#include "cls/rgw/cls_rgw_client.h"
#include "rgw_public_access.h"
}
int rgw_op_get_bucket_policy_from_attr(CephContext *cct,
- rgw::sal::RGWRadosStore *store,
+ rgw::sal::RGWStore *store,
RGWBucketInfo& bucket_info,
map<string, bufferlist>& bucket_attrs,
- RGWAccessControlPolicy *policy);
+ RGWAccessControlPolicy *policy,
+ optional_yield y);
class RGWHandler {
protected:
rgw::sal::RGWRadosStore* store{nullptr};
struct req_state *s{nullptr};
- int do_init_permissions();
- int do_read_permissions(RGWOp* op, bool only_bucket);
+ int do_init_permissions(optional_yield y);
+ int do_read_permissions(RGWOp* op, bool only_bucket, optional_yield y);
public:
RGWHandler() {}
struct req_state* _s,
rgw::io::BasicClient* cio);
- virtual int init_permissions(RGWOp*) {
+ virtual int init_permissions(RGWOp*, optional_yield y) {
return 0;
}
- virtual int retarget(RGWOp* op, RGWOp** new_op) {
+ virtual int retarget(RGWOp* op, RGWOp** new_op, optional_yield) {
*new_op = op;
return 0;
}
- virtual int read_permissions(RGWOp* op) = 0;
- virtual int authorize(const DoutPrefixProvider* dpp) = 0;
- virtual int postauth_init() = 0;
- virtual int error_handler(int err_no, std::string* error_content);
+ virtual int read_permissions(RGWOp* op, optional_yield y) = 0;
+ virtual int authorize(const DoutPrefixProvider* dpp, optional_yield y) = 0;
+ virtual int postauth_init(optional_yield y) = 0;
+ virtual int error_handler(int err_no, std::string* error_content, optional_yield y);
virtual void dump(const string& code, const string& message) const {}
virtual bool supports_quota() {
int get_ret() const { return op_ret; }
- virtual int init_processing() {
+ virtual int init_processing(optional_yield y) {
if (dialect_handler->supports_quota()) {
op_ret = init_quota();
if (op_ret < 0)
* authentication. The alternative is to duplicate parts of the method-
* dispatch logic in RGWHandler::authorize() and pollute it with a lot
* of special cases. */
- virtual int verify_requester(const rgw::auth::StrategyRegistry& auth_registry) {
+ virtual int verify_requester(const rgw::auth::StrategyRegistry& auth_registry, optional_yield y) {
/* TODO(rzarzynski): rename RGWHandler::authorize to generic_authenticate. */
- return dialect_handler->authorize(this);
+ return dialect_handler->authorize(this, y);
}
- virtual int verify_permission() = 0;
+ virtual int verify_permission(optional_yield y) = 0;
virtual int verify_op_mask();
virtual void pre_exec() {}
- virtual void execute() = 0;
+ virtual void execute(optional_yield y) = 0;
virtual void send_response() {}
virtual void complete() {
send_response();
virtual uint32_t op_mask() { return 0; }
- virtual int error_handler(int err_no, string *error_content);
+ virtual int error_handler(int err_no, string *error_content, optional_yield y);
// implements DoutPrefixProvider
std::ostream& gen_prefix(std::ostream& out) const override;
ceph::real_time unmod_time;
ceph::real_time *mod_ptr;
ceph::real_time *unmod_ptr;
- map<string, bufferlist> attrs;
+ rgw::sal::RGWAttrs attrs;
bool get_data;
bool partial_content;
bool ignore_invalid_range;
bool range_parsed;
bool skip_manifest;
bool skip_decrypt{false};
- rgw_obj obj;
utime_t gc_invalidate_time;
bool is_slo;
string lo_etag;
this->get_data = get_data;
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
int parse_range();
int read_user_manifest_part(
- rgw_bucket& bucket,
+ rgw::sal::RGWBucket* bucket,
const rgw_bucket_dir_entry& ent,
RGWAccessControlPolicy * const bucket_acl,
const boost::optional<rgw::IAM::Policy>& bucket_policy,
const off_t start_ofs,
const off_t end_ofs,
bool swift_slo);
- int handle_user_manifest(const char *prefix);
- int handle_slo_manifest(bufferlist& bl);
+ int handle_user_manifest(const char *prefix, optional_yield y);
+ int handle_slo_manifest(bufferlist& bl, optional_yield y);
int get_data_cb(bufferlist& bl, off_t ofs, off_t len);
- virtual int get_params() = 0;
- virtual int send_response_data_error() = 0;
+ virtual int get_params(optional_yield y) = 0;
+ virtual int send_response_data_error(optional_yield y) = 0;
virtual int send_response_data(bufferlist& bl, off_t ofs, off_t len) = 0;
const char* name() const override { return "get_obj"; }
bufferlist tags_bl;
bool has_tags{false};
public:
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
void pre_exec() override;
virtual void send_response_data(bufferlist& bl) = 0;
protected:
bufferlist tags_bl;
public:
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
virtual void send_response() override = 0;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "put_obj_tags"; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
RGWOpType get_type() override { return RGW_OP_PUT_OBJ_TAGGING; }
class RGWDeleteObjTags: public RGWOp {
public:
void pre_exec() override;
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
const char* name() const override { return "delete_obj_tags"; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_DELETE; }
bufferlist tags_bl;
bool has_tags{false};
public:
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
void pre_exec() override;
virtual void send_response_data(bufferlist& bl) = 0;
bufferlist tags_bl;
bufferlist in_data;
public:
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
virtual void send_response() override = 0;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "put_bucket_tags"; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
RGWOpType get_type() override { return RGW_OP_PUT_BUCKET_TAGGING; }
class RGWDeleteBucketTags : public RGWOp {
public:
void pre_exec() override;
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
const char* name() const override { return "delete_bucket_tags"; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_DELETE; }
class RGWGetBucketReplication : public RGWOp {
public:
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
void pre_exec() override;
virtual void send_response_data() = 0;
bufferlist in_data;
std::vector<rgw_sync_policy_group> sync_policy_groups;
public:
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
virtual void send_response() override = 0;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "put_bucket_replication"; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
RGWOpType get_type() override { return RGW_OP_PUT_BUCKET_REPLICATION; }
virtual void update_sync_policy(rgw_sync_policy_info *policy) = 0;
public:
void pre_exec() override;
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
const char* name() const override { return "delete_bucket_replication"; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_DELETE; }
bool verify_permission(RGWBucketInfo& binfo,
map<string, bufferlist>& battrs,
- ACLOwner& bucket_owner /* out */);
- bool delete_single(const acct_path_t& path);
- bool delete_chunk(const std::list<acct_path_t>& paths);
+ ACLOwner& bucket_owner /* out */,
+ optional_yield y);
+ bool delete_single(const acct_path_t& path, optional_yield y);
+ bool delete_chunk(const std::list<acct_path_t>& paths, optional_yield y);
};
/* End of Deleter subclass */
: deleter(nullptr) {
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
virtual int get_data(std::list<acct_path_t>& items,
bool * is_truncated) = 0;
virtual void send_response() override = 0;
boost::optional<std::pair<std::string, rgw_obj_key>>
- parse_path(const boost::string_ref& path);
+ parse_path(const std::string_view& path);
std::pair<std::string, std::string>
handle_upload_path(struct req_state *s);
bool handle_file_verify_permission(RGWBucketInfo& binfo,
const rgw_obj& obj,
std::map<std::string, ceph::bufferlist>& battrs,
- ACLOwner& bucket_owner /* out */);
- int handle_file(boost::string_ref path,
+ ACLOwner& bucket_owner /* out */,
+ optional_yield y);
+ int handle_file(std::string_view path,
size_t size,
- AlignedStreamGetter& body);
+ AlignedStreamGetter& body,
+ optional_yield y);
- int handle_dir_verify_permission();
- int handle_dir(boost::string_ref path);
+ int handle_dir_verify_permission(optional_yield y);
+ int handle_dir(std::string_view path, optional_yield y);
public:
RGWBulkUploadOp()
struct req_state* const s,
RGWHandler* const h) override;
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
const char* name() const override { return "bulk_upload"; }
is_truncated(false) {
}
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
virtual void handle_listing_chunk(rgw::sal::RGWBucketList&& buckets) {
/* The default implementation, used by e.g. S3, just generates a new
* part of listing and sends it client immediately. Swift can behave
RGWGetUsage() : sent_data(false), show_log_entries(true), show_log_sum(true){
}
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override {}
virtual bool should_get_stats() { return false; }
public:
RGWStatAccount() = default;
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "stat_account"; }
class RGWListBucket : public RGWOp {
protected:
- rgw::sal::RGWBucket* bucket;
string prefix;
rgw_obj_key marker;
rgw_obj_key next_marker;
int parse_max_keys();
public:
- RGWListBucket() : bucket(nullptr), list_versions(false), max(0),
+ RGWListBucket() : list_versions(false), max(0),
default_max(0), is_truncated(false),
allow_unordered(false), shard_id(-1) {}
- ~RGWListBucket() { delete bucket; }
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
RGWOp::init(store, s, h);
- bucket = new rgw::sal::RGWRadosBucket(store, *s->user, s->bucket);
}
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "list_bucket"; }
RGWOpType get_type() override { return RGW_OP_LIST_BUCKET; }
class RGWGetBucketLogging : public RGWOp {
public:
RGWGetBucketLogging() {}
- int verify_permission() override;
- void execute() override { }
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield) override { }
void send_response() override = 0;
const char* name() const override { return "get_bucket_logging"; }
public:
RGWGetBucketLocation() {}
~RGWGetBucketLocation() override {}
- int verify_permission() override;
- void execute() override { }
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield) override { }
void send_response() override = 0;
const char* name() const override { return "get_bucket_location"; }
public:
RGWGetBucketVersioning() = default;
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "get_bucket_versioning"; }
public:
RGWSetBucketVersioning() : versioning_status(VersioningNotChanged) {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() { return 0; }
+ virtual int get_params(optional_yield y) { return 0; }
void send_response() override = 0;
const char* name() const override { return "set_bucket_versioning"; }
public:
RGWGetBucketWebsite() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "get_bucket_website"; }
public:
RGWSetBucketWebsite() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() { return 0; }
+ virtual int get_params(optional_yield y) { return 0; }
void send_response() override = 0;
const char* name() const override { return "set_bucket_website"; }
public:
RGWDeleteBucketWebsite() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "delete_bucket_website"; }
class RGWStatBucket : public RGWOp {
protected:
- rgw::sal::RGWBucket* bucket;
+ std::unique_ptr<rgw::sal::RGWBucket> bucket;
public:
- RGWStatBucket() : bucket(nullptr) {}
- ~RGWStatBucket() override { delete bucket; }
-
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "stat_bucket"; }
attrs.emplace(std::move(key), std::move(bl)); /* key and bl are r-value refs */
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
RGWOp::init(store, s, h);
policy.set_ctx(s->cct);
relaxed_region_enforcement =
s->cct->_conf.get_val<bool>("rgw_relaxed_region_enforcement");
}
- virtual int get_params() { return 0; }
+ virtual int get_params(optional_yield y) { return 0; }
void send_response() override = 0;
const char* name() const override { return "create_bucket"; }
RGWOpType get_type() override { return RGW_OP_CREATE_BUCKET; }
public:
RGWDeleteBucket() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "delete_bucket"; }
std::unique_ptr <RGWObjTags> obj_tags;
const char *dlo_manifest;
RGWSLOInfo *slo_info;
- map<string, bufferlist> attrs;
+ rgw::sal::RGWAttrs attrs;
ceph::real_time mtime;
uint64_t olh_epoch;
string version_id;
policy.set_ctx(s->cct);
}
+ virtual int init_processing(optional_yield y) override;
+
void emplace_attr(std::string&& key, buffer::list&& bl) {
attrs.emplace(std::move(key), std::move(bl)); /* key and bl are r-value refs */
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
/* this is for cases when copying data from other object */
virtual int get_decrypt_filter(std::unique_ptr<RGWGetObj_Filter>* filter,
int get_data_cb(bufferlist& bl, off_t bl_ofs, off_t bl_len);
int get_data(const off_t fst, const off_t lst, bufferlist& bl);
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
virtual int get_data(bufferlist& bl) = 0;
void send_response() override = 0;
const char* name() const override { return "put_obj"; }
policy.set_ctx(s->cct);
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
virtual int get_encrypt_filter(std::unique_ptr<rgw::putobj::DataProcessor> *filter,
rgw::putobj::DataProcessor *cb) {
return 0;
}
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
virtual int get_data(ceph::bufferlist& bl, bool& again) = 0;
void send_response() override = 0;
const char* name() const override { return "post_obj"; }
RGWOp::init(store, s, h);
policy.set_ctx(s->cct);
}
- int init_processing() override;
- int verify_permission() override;
+ int init_processing(optional_yield y) override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override { }
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
virtual void filter_out_temp_url(map<string, bufferlist>& add_attrs,
const set<string>& rmattr_names,
class RGWPutMetadataBucket : public RGWOp {
protected:
- map<string, buffer::list> attrs;
+ rgw::sal::RGWAttrs attrs;
set<string> rmattr_names;
bool has_policy, has_cors;
uint32_t policy_rw_mask;
policy.set_ctx(s->cct);
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "put_bucket_metadata"; }
RGWOpType get_type() override { return RGW_OP_PUT_METADATA_BUCKET; }
RGWOp::init(store, s, h);
policy.set_ctx(s->cct);
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "put_obj_metadata"; }
RGWOpType get_type() override { return RGW_OP_PUT_METADATA_OBJECT; }
bypass_governance_mode(false) {
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
- int handle_slo_manifest(bufferlist& bl);
+ void execute(optional_yield y) override;
+ int handle_slo_manifest(bufferlist& bl, optional_yield y);
- virtual int get_params() { return 0; }
+ virtual int get_params(optional_yield y) { return 0; }
void send_response() override = 0;
const char* name() const override { return "delete_obj"; }
RGWOpType get_type() override { return RGW_OP_DELETE_OBJ; }
ceph::real_time unmod_time;
ceph::real_time *mod_ptr;
ceph::real_time *unmod_ptr;
- map<string, buffer::list> attrs;
- string src_tenant_name, src_bucket_name;
- rgw_bucket src_bucket;
- rgw_obj_key src_object;
- string dest_tenant_name, dest_bucket_name;
- rgw_bucket dest_bucket;
- string dest_object;
+ rgw::sal::RGWAttrs attrs;
+ string src_tenant_name, src_bucket_name, src_obj_name;
+ std::unique_ptr<rgw::sal::RGWBucket> src_bucket;
+ std::unique_ptr<rgw::sal::RGWObject> src_object;
+ string dest_tenant_name, dest_bucket_name, dest_obj_name;
+ std::unique_ptr<rgw::sal::RGWBucket> dest_bucket;
+ std::unique_ptr<rgw::sal::RGWObject> dest_object;
ceph::real_time src_mtime;
ceph::real_time mtime;
- RGWRados::AttrsMod attrs_mod;
- RGWBucketInfo src_bucket_info;
- RGWBucketInfo dest_bucket_info;
+ rgw::sal::AttrsMod attrs_mod;
string source_zone;
string etag;
end = -1;
mod_ptr = NULL;
unmod_ptr = NULL;
- attrs_mod = RGWRados::ATTRSMOD_NONE;
+ attrs_mod = rgw::sal::ATTRSMOD_NONE;
last_ofs = 0;
olh_epoch = 0;
copy_if_newer = false;
}
- static bool parse_copy_location(const boost::string_view& src,
+ static bool parse_copy_location(const std::string_view& src,
string& bucket_name,
rgw_obj_key& object);
RGWOp::init(store, s, h);
dest_policy.set_ctx(s->cct);
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void progress_cb(off_t ofs);
virtual int check_storage_class(const rgw_placement_rule& src_placement) {
}
virtual int init_dest_policy() { return 0; }
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
virtual void send_partial_response(off_t ofs) {}
void send_response() override = 0;
const char* name() const override { return "copy_obj"; }
public:
RGWGetACLs() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "get_acls"; }
RGWPutACLs() {}
~RGWPutACLs() override {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
virtual int get_policy_from_state(rgw::sal::RGWRadosStore *store, struct req_state *s, stringstream& ss) { return 0; }
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "put_acls"; }
RGWOpType get_type() override { return RGW_OP_PUT_ACLS; }
RGWGetLC() { }
~RGWGetLC() override { }
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override = 0;
+ void execute(optional_yield) override = 0;
void send_response() override = 0;
const char* name() const override { return "get_lifecycle"; }
cookie = buf;
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
// virtual int get_policy_from_state(RGWRados *store, struct req_state *s, stringstream& ss) { return 0; }
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "put_lifecycle"; }
RGWOpType get_type() override { return RGW_OP_PUT_LC; }
class RGWDeleteLC : public RGWOp {
public:
RGWDeleteLC() = default;
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "delete_lifecycle"; }
public:
RGWGetCORS() {}
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "get_cors"; }
RGWPutCORS() {}
~RGWPutCORS() override {}
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "put_cors"; }
RGWOpType get_type() override { return RGW_OP_PUT_CORS; }
public:
RGWDeleteCORS() {}
- int verify_permission() override;
- void execute() override;
+ int verify_permission(optional_yield y) override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "delete_cors"; }
req_hdrs(NULL), req_meth(NULL) {
}
- int verify_permission() override {return 0;}
+ int verify_permission(optional_yield y) override {return 0;}
int validate_cors_request(RGWCORSConfiguration *cc);
- void execute() override;
+ void execute(optional_yield y) override;
void get_response_params(string& allowed_hdrs, string& exp_hdrs, unsigned *max_age);
void send_response() override = 0;
const char* name() const override { return "options_cors"; }
public:
RGWGetRequestPayment() : requester_pays(0) {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "get_request_payment"; }
public:
RGWSetRequestPayment() : requester_pays(false) {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() { return 0; }
+ virtual int get_params(optional_yield y) { return 0; }
void send_response() override = 0;
const char* name() const override { return "set_request_payment"; }
RGWOp::init(store, s, h);
policy.set_ctx(s->cct);
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "init_multipart"; }
RGWOpType get_type() override { return RGW_OP_INIT_MULTIPART; }
string etag;
string version_id;
bufferlist data;
-
- struct MPSerializer {
- librados::IoCtx ioctx;
- rados::cls::lock::Lock lock;
- librados::ObjectWriteOperation op;
- std::string oid;
- bool locked;
-
- MPSerializer() : lock("RGWCompleteMultipart"), locked(false)
- {}
-
- int try_lock(const std::string& oid, utime_t dur);
-
- int unlock() {
- return lock.unlock(&ioctx, oid);
- }
-
- void clear_locked() {
- locked = false;
- }
- } serializer;
+ rgw::sal::MPSerializer* serializer;
public:
- RGWCompleteMultipart() {}
- ~RGWCompleteMultipart() override {}
+ RGWCompleteMultipart() : serializer(nullptr) {}
+ ~RGWCompleteMultipart() override { delete serializer; }
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void complete() override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "complete_multipart"; }
RGWOpType get_type() override { return RGW_OP_COMPLETE_MULTIPART; }
public:
RGWAbortMultipart() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
void send_response() override = 0;
const char* name() const override { return "abort_multipart"; }
RGWOp::init(store, s, h);
policy = RGWAccessControlPolicy(s->cct);
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "list_multipart"; }
RGWOpType get_type() override { return RGW_OP_LIST_MULTIPART; }
max_uploads = default_max;
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "list_bucket_multiparts"; }
RGWOpType get_type() override { return RGW_OP_LIST_BUCKET_MULTIPARTS; }
RGWGetCrossDomainPolicy() = default;
~RGWGetCrossDomainPolicy() override = default;
- int verify_permission() override {
+ int verify_permission(optional_yield) override {
return 0;
}
- void execute() override {
+ void execute(optional_yield) override {
op_ret = 0;
}
RGWGetHealthCheck() = default;
~RGWGetHealthCheck() override = default;
- int verify_permission() override {
+ int verify_permission(optional_yield) override {
return 0;
}
- void execute() override;
+ void execute(optional_yield y) override;
const char* name() const override { return "get_health_check"; }
class RGWDeleteMultiObj : public RGWOp {
protected:
bufferlist data;
- rgw_bucket bucket;
+ rgw::sal::RGWBucket* bucket;
bool quiet;
bool status_dumped;
bool acl_allowed = false;
+ bool bypass_perm;
+ bool bypass_governance_mode;
+
public:
RGWDeleteMultiObj() {
quiet = false;
status_dumped = false;
+ bypass_perm = true;
+ bypass_governance_mode = false;
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
virtual void send_status() = 0;
virtual void begin_response() = 0;
virtual void send_partial_response(rgw_obj_key& key, bool delete_marker,
RGWInfo() = default;
~RGWInfo() override = default;
- int verify_permission() override { return 0; }
+ int verify_permission(optional_yield) override { return 0; }
const char* name() const override { return "get info"; }
RGWOpType get_type() override { return RGW_OP_GET_INFO; }
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
};
-extern int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s);
+extern int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y);
extern int rgw_build_object_policies(rgw::sal::RGWRadosStore *store, struct req_state *s,
- bool prefetch_data);
+ bool prefetch_data, optional_yield y);
extern void rgw_build_iam_environment(rgw::sal::RGWRadosStore* store,
struct req_state* s);
extern vector<rgw::IAM::Policy> get_iam_user_policy_from_attr(CephContext* cct,
map<string, bufferlist>& attrs,
const string& tenant);
-static inline int get_system_versioning_params(req_state *s,
- uint64_t *olh_epoch,
- string *version_id)
+inline int get_system_versioning_params(req_state *s,
+ uint64_t *olh_epoch,
+ string *version_id)
{
if (!s->system_request) {
return 0;
* On failure returns a negative error code.
*
*/
-static inline int rgw_get_request_metadata(CephContext* const cct,
- struct req_info& info,
- std::map<std::string, ceph::bufferlist>& attrs,
- const bool allow_empty_attrs = true)
+inline int rgw_get_request_metadata(CephContext* const cct,
+ struct req_info& info,
+ std::map<std::string, ceph::bufferlist>& attrs,
+ const bool allow_empty_attrs = true)
{
- static const std::set<std::string> blacklisted_headers = {
+ static const std::set<std::string> blocklisted_headers = {
"x-amz-server-side-encryption-customer-algorithm",
"x-amz-server-side-encryption-customer-key",
"x-amz-server-side-encryption-customer-key-md5",
const std::string& name = kv.first;
std::string& xattr = kv.second;
- if (blacklisted_headers.count(name) == 1) {
+ if (blocklisted_headers.count(name) == 1) {
lsubdout(cct, rgw, 10) << "skipping x>> " << name << dendl;
continue;
} else if (allow_empty_attrs || !xattr.empty()) {
return 0;
} /* rgw_get_request_metadata */
-static inline void encode_delete_at_attr(boost::optional<ceph::real_time> delete_at,
- map<string, bufferlist>& attrs)
+inline void encode_delete_at_attr(boost::optional<ceph::real_time> delete_at,
+ map<string, bufferlist>& attrs)
{
if (delete_at == boost::none) {
return;
attrs[RGW_ATTR_DELETE_AT] = delatbl;
} /* encode_delete_at_attr */
-static inline void encode_obj_tags_attr(RGWObjTags* obj_tags, map<string, bufferlist>& attrs)
+inline void encode_obj_tags_attr(RGWObjTags* obj_tags, map<string, bufferlist>& attrs)
{
if (obj_tags == nullptr){
// we assume the user submitted a tag format which we couldn't parse since
attrs[RGW_ATTR_TAGS] = tagsbl;
}
-static inline int encode_dlo_manifest_attr(const char * const dlo_manifest,
- map<string, bufferlist>& attrs)
+inline int encode_dlo_manifest_attr(const char * const dlo_manifest,
+ map<string, bufferlist>& attrs)
{
string dm = dlo_manifest;
return 0;
} /* encode_dlo_manifest_attr */
-static inline void complete_etag(MD5& hash, string *etag)
+inline void complete_etag(MD5& hash, string *etag)
{
char etag_buf[CEPH_CRYPTO_MD5_DIGESTSIZE];
char etag_buf_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
*etag = etag_buf_str;
} /* complete_etag */
+using boost::container::flat_map;
+
+class RGWGetAttrs : public RGWOp {
+public:
+ using get_attrs_t = flat_map<std::string, std::optional<buffer::list>>;
+protected:
+ get_attrs_t attrs;
+
+public:
+ RGWGetAttrs()
+ {}
+
+ virtual ~RGWGetAttrs() {}
+
+ void emplace_key(std::string&& key) {
+ attrs.emplace(std::move(key), std::nullopt);
+ }
+
+ int verify_permission(optional_yield y);
+ void pre_exec();
+ void execute(optional_yield y);
+
+ virtual int get_params() = 0;
+ virtual void send_response() = 0;
+ virtual const char* name() const { return "get_attrs"; }
+ virtual RGWOpType get_type() { return RGW_OP_GET_ATTRS; }
+ virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
+}; /* RGWGetAttrs */
+
class RGWSetAttrs : public RGWOp {
protected:
- map<string, buffer::list> attrs;
+ map<std::string, buffer::list> attrs;
public:
RGWSetAttrs() {}
attrs.emplace(std::move(key), std::move(bl));
}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
void send_response() override = 0;
const char* name() const override { return "set_attrs"; }
RGWOpType get_type() override { return RGW_OP_SET_ATTRS; }
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
};
+class RGWRMAttrs : public RGWOp {
+protected:
+ rgw::sal::RGWAttrs attrs;
+
+public:
+ RGWRMAttrs()
+ {}
+
+ virtual ~RGWRMAttrs() {}
+
+ void emplace_key(std::string&& key) {
+ attrs.emplace(std::move(key), buffer::list());
+ }
+
+ int verify_permission(optional_yield y);
+ void pre_exec();
+ void execute(optional_yield y);
+
+ virtual int get_params() = 0;
+ virtual void send_response() = 0;
+ virtual const char* name() const { return "rm_attrs"; }
+ virtual RGWOpType get_type() { return RGW_OP_DELETE_ATTRS; }
+ virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; }
+}; /* RGWRMAttrs */
+
class RGWGetObjLayout : public RGWOp {
protected:
RGWObjManifest *manifest{nullptr};
int check_caps(RGWUserCaps& caps) {
return caps.check_cap("admin", RGW_CAP_READ);
}
- int verify_permission() override {
+ int verify_permission(optional_yield) override {
return check_caps(s->user->get_info().caps);
}
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
const char* name() const override { return "get_obj_layout"; }
virtual RGWOpType get_type() override { return RGW_OP_GET_OBJ_LAYOUT; }
~RGWPutBucketPolicy() {
}
void send_response() override;
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
uint32_t op_mask() override {
return RGW_OP_TYPE_WRITE;
}
- void execute() override;
- int get_params();
+ void execute(optional_yield y) override;
+ int get_params(optional_yield y);
const char* name() const override { return "put_bucket_policy"; }
RGWOpType get_type() override {
return RGW_OP_PUT_BUCKET_POLICY;
public:
RGWGetBucketPolicy() = default;
void send_response() override;
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
uint32_t op_mask() override {
return RGW_OP_TYPE_READ;
}
- void execute() override;
+ void execute(optional_yield y) override;
const char* name() const override { return "get_bucket_policy"; }
RGWOpType get_type() override {
return RGW_OP_GET_BUCKET_POLICY;
public:
RGWDeleteBucketPolicy() = default;
void send_response() override;
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
uint32_t op_mask() override {
return RGW_OP_TYPE_WRITE;
}
- void execute() override;
- int get_params();
+ void execute(optional_yield y) override;
+ int get_params(optional_yield y);
const char* name() const override { return "delete_bucket_policy"; }
RGWOpType get_type() override {
return RGW_OP_DELETE_BUCKET_POLICY;
public:
RGWPutBucketObjectLock() = default;
~RGWPutBucketObjectLock() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
- virtual void send_response() = 0;
- virtual int get_params() = 0;
+ void execute(optional_yield y) override;
+ virtual void send_response() override = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "put_bucket_object_lock"; }
RGWOpType get_type() override { return RGW_OP_PUT_BUCKET_OBJ_LOCK; }
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
class RGWGetBucketObjectLock : public RGWOp {
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
- virtual void send_response() = 0;
+ void execute(optional_yield y) override;
+ virtual void send_response() override = 0;
const char* name() const override {return "get_bucket_object_lock"; }
RGWOpType get_type() override { return RGW_OP_GET_BUCKET_OBJ_LOCK; }
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
bool bypass_governance_mode;
public:
RGWPutObjRetention():bypass_perm(true), bypass_governance_mode(false) {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
virtual void send_response() override = 0;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "put_obj_retention"; }
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
RGWOpType get_type() override { return RGW_OP_PUT_OBJ_RETENTION; }
protected:
RGWObjectRetention obj_retention;
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
- virtual void send_response() = 0;
+ void execute(optional_yield y) override;
+ virtual void send_response() override = 0;
const char* name() const override {return "get_obj_retention"; }
RGWOpType get_type() override { return RGW_OP_GET_OBJ_RETENTION; }
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
bufferlist data;
RGWObjectLegalHold obj_legal_hold;
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
virtual void send_response() override = 0;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "put_obj_legal_hold"; }
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
RGWOpType get_type() override { return RGW_OP_PUT_OBJ_LEGAL_HOLD; }
protected:
RGWObjectLegalHold obj_legal_hold;
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
- virtual void send_response() = 0;
+ void execute(optional_yield y) override;
+ virtual void send_response() override = 0;
const char* name() const override {return "get_obj_legal_hold"; }
RGWOpType get_type() override { return RGW_OP_GET_OBJ_LEGAL_HOLD; }
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
public:
RGWConfigBucketMetaSearch() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
- virtual int get_params() = 0;
+ virtual int get_params(optional_yield y) = 0;
const char* name() const override { return "config_bucket_meta_search"; }
virtual RGWOpType get_type() override { return RGW_OP_CONFIG_BUCKET_META_SEARCH; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
public:
RGWGetBucketMetaSearch() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override {}
+ void execute(optional_yield) override {}
const char* name() const override { return "get_bucket_meta_search"; }
virtual RGWOpType get_type() override { return RGW_OP_GET_BUCKET_META_SEARCH; }
public:
RGWDelBucketMetaSearch() {}
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
void pre_exec() override;
- void execute() override;
+ void execute(optional_yield y) override;
const char* name() const override { return "delete_bucket_meta_search"; }
virtual RGWOpType delete_type() { return RGW_OP_DEL_BUCKET_META_SEARCH; }
class RGWGetClusterStat : public RGWOp {
protected:
- struct rados_cluster_stat_t stats_op;
+ RGWClusterStat stats_op;
public:
RGWGetClusterStat() {}
void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
RGWOp::init(store, s, h);
}
- int verify_permission() override {return 0;}
+ int verify_permission(optional_yield) override {return 0;}
virtual void send_response() override = 0;
- virtual int get_params() = 0;
- void execute() override;
+ virtual int get_params(optional_yield y) = 0;
+ void execute(optional_yield y) override;
const char* name() const override { return "get_cluster_stat"; }
dmc::client_id dmclock_client() override { return dmc::client_id::admin; }
};
protected:
bool isPublic {false};
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
const char* name() const override { return "get_bucket_policy_status"; }
virtual RGWOpType get_type() override { return RGW_OP_GET_BUCKET_POLICY_STATUS; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
- void execute() override;
+ void execute(optional_yield y) override;
dmc::client_id dmclock_client() override { return dmc::client_id::metadata; }
};
bufferlist data;
PublicAccessBlockConfiguration access_conf;
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
const char* name() const override { return "put_bucket_public_access_block";}
virtual RGWOpType get_type() override { return RGW_OP_PUT_BUCKET_PUBLIC_ACCESS_BLOCK; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
- int get_params();
- void execute() override;
+ int get_params(optional_yield y);
+ void execute(optional_yield y) override;
dmc::client_id dmclock_client() override { return dmc::client_id::metadata; }
};
protected:
PublicAccessBlockConfiguration access_conf;
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
const char* name() const override { return "get_bucket_public_access_block";}
virtual RGWOpType get_type() override { return RGW_OP_GET_BUCKET_PUBLIC_ACCESS_BLOCK; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
- int get_params();
- void execute() override;
+ int get_params(optional_yield y);
+ void execute(optional_yield y) override;
dmc::client_id dmclock_client() override { return dmc::client_id::metadata; }
};
protected:
PublicAccessBlockConfiguration access_conf;
public:
- int verify_permission() override;
+ int verify_permission(optional_yield y) override;
const char* name() const override { return "delete_bucket_public_access_block";}
virtual RGWOpType get_type() override { return RGW_OP_DELETE_BUCKET_PUBLIC_ACCESS_BLOCK; }
virtual uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
- int get_params();
- void execute() override;
+ int get_params(optional_yield y);
+ void execute(optional_yield y) override;
void send_response() override;
dmc::client_id dmclock_client() override { return dmc::client_id::metadata; }
};
-static inline int parse_value_and_bound(
+inline int parse_value_and_bound(
const string &input,
int &output,
const long lower_bound,
return 0;
}
-int forward_request_to_master(struct req_state *s, obj_version *objv, rgw::sal::RGWRadosStore *store,
- bufferlist& in_data, JSONParser *jp, req_info *forward_info = nullptr);
-
#endif /* CEPH_RGW_OP_H */