From 4bab3fcac18aed724417876a1cd50969f93a7bc8 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 9 Nov 2015 17:14:49 +0100 Subject: [PATCH] rgw: move RGWBulkDelete in rgw/rgw_op.h. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_op.h | 162 +++++++++++++++++++++++------------------------ 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 3ecfbed9859da..ce0f70d21d82e 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -197,6 +197,87 @@ public: virtual bool need_object_expiration() { return false; } }; +class RGWBulkDelete : public RGWOp { +public: + struct acct_path_t { + std::string bucket_name; + rgw_obj_key obj_key; + }; + + struct fail_desc_t { + int err; + acct_path_t path; + }; + + class Deleter { + protected: + unsigned int num_deleted; + unsigned int num_unfound; + std::list failures; + + RGWRados * const store; + req_state * const s; + + public: + Deleter(RGWRados * const str, req_state * const s) + : num_deleted(0), + num_unfound(0), + store(str), + s(s) { + } + + unsigned int get_num_deleted() const { + return num_deleted; + } + + unsigned int get_num_unfound() const { + return num_unfound; + } + + const std::list get_failures() const { + return failures; + } + + bool verify_permission(RGWBucketInfo& binfo, + map& battrs, + rgw_obj& obj, + ACLOwner& bucket_owner /* out */); + bool verify_permission(RGWBucketInfo& binfo, + map& battrs); + bool delete_single(const acct_path_t& path); + bool delete_chunk(const std::list& paths); + }; + /* End of Deleter subclass */ + + static const size_t MAX_CHUNK_ENTRIES = 1024; + +protected: + int ret; + std::unique_ptr deleter; + +public: + RGWBulkDelete() + : ret(0), + deleter(nullptr) { + } + + int verify_permission(); + void pre_exec(); + void execute(); + + virtual int get_data(std::list& items, + bool * is_truncated) = 0; + virtual void send_response() = 0; + + virtual const string name() { return "bulk_delete"; } + virtual RGWOpType get_type() { return RGW_OP_BULK_DELETE; } + virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; } +}; + +inline ostream& operator<<(ostream& out, const RGWBulkDelete::acct_path_t &o) { + return out << o.bucket_name << "/" << o.obj_key; +} + #define RGW_LIST_BUCKETS_LIMIT_MAX 10000 class RGWListBuckets : public RGWOp { @@ -1155,87 +1236,6 @@ public: }; -class RGWBulkDelete : public RGWOp { -public: - struct acct_path_t { - std::string bucket_name; - rgw_obj_key obj_key; - }; - - struct fail_desc_t { - int err; - acct_path_t path; - }; - - class Deleter { - protected: - unsigned int num_deleted; - unsigned int num_unfound; - std::list failures; - - RGWRados * const store; - req_state * const s; - - public: - Deleter(RGWRados * const str, req_state * const s) - : num_deleted(0), - num_unfound(0), - store(str), - s(s) { - } - - unsigned int get_num_deleted() const { - return num_deleted; - } - - unsigned int get_num_unfound() const { - return num_unfound; - } - - const std::list get_failures() const { - return failures; - } - - bool verify_permission(RGWBucketInfo& binfo, - map& battrs, - rgw_obj& obj, - ACLOwner& bucket_owner /* out */); - bool verify_permission(RGWBucketInfo& binfo, - map& battrs); - bool delete_single(const acct_path_t& path); - bool delete_chunk(const std::list& paths); - }; - /* End of Deleter subclass */ - - static const size_t MAX_CHUNK_ENTRIES = 1024; - -protected: - int ret; - std::unique_ptr deleter; - -public: - RGWBulkDelete() - : ret(0), - deleter(nullptr) { - } - - int verify_permission(); - void pre_exec(); - void execute(); - - virtual int get_data(std::list& items, - bool * is_truncated) = 0; - virtual void send_response() = 0; - - virtual const string name() { return "bulk_delete"; } - virtual RGWOpType get_type() { return RGW_OP_BULK_DELETE; } - virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; } -}; - -inline ostream& operator<<(ostream& out, const RGWBulkDelete::acct_path_t &o) { - return out << o.bucket_name << "/" << o.obj_key; -} - class RGWDeleteMultiObj : public RGWOp { protected: int ret; -- 2.39.5