diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/rgw/rgw_multi.h | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/rgw/rgw_multi.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/rgw/rgw_multi.h b/src/rgw/rgw_multi.h new file mode 100644 index 00000000..8c682888 --- /dev/null +++ b/src/rgw/rgw_multi.h @@ -0,0 +1,114 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_RGW_MULTI_H +#define CEPH_RGW_MULTI_H + +#include <map> +#include "rgw_xml.h" +#include "rgw_rados.h" + +#define MULTIPART_UPLOAD_ID_PREFIX_LEGACY "2/" +#define MULTIPART_UPLOAD_ID_PREFIX "2~" // must contain a unique char that may not come up in gen_rand_alpha() + +class RGWMultiCompleteUpload : public XMLObj +{ +public: + RGWMultiCompleteUpload() {} + ~RGWMultiCompleteUpload() override {} + bool xml_end(const char *el) override; + + std::map<int, string> parts; +}; + +class RGWMultiPart : public XMLObj +{ + string etag; + int num; +public: + RGWMultiPart() : num(0) {} + ~RGWMultiPart() override {} + bool xml_end(const char *el) override; + + string& get_etag() { return etag; } + int get_num() { return num; } +}; + +class RGWMultiPartNumber : public XMLObj +{ +public: + RGWMultiPartNumber() {} + ~RGWMultiPartNumber() override {} +}; + +class RGWMultiETag : public XMLObj +{ +public: + RGWMultiETag() {} + ~RGWMultiETag() override {} +}; + +class RGWMultiXMLParser : public RGWXMLParser +{ + XMLObj *alloc_obj(const char *el) override; +public: + RGWMultiXMLParser() {} + ~RGWMultiXMLParser() override {} +}; + +/** + * A filter to a) test whether an object name is a multipart meta + * object, and b) filter out just the key used to determine the bucket + * index shard. + * + * Objects for multipart meta have names adorned with an upload id and + * other elements -- specifically a ".", MULTIPART_UPLOAD_ID_PREFIX, + * unique id, and MP_META_SUFFIX. This filter will return true when + * the name provided is such. It will also extract the key used for + * bucket index shard calculation from the adorned name. + */ +class MultipartMetaFilter : public RGWAccessListFilter { +public: + MultipartMetaFilter() {} + + /** + * @param name [in] The object name as it appears in the bucket index. + * @param key [out] An output parameter that will contain the bucket + * index key if this entry is in the form of a multipart meta object. + * @return true if the name provided is in the form of a multipart meta + * object, false otherwise + */ + bool filter(const string& name, string& key) override; +}; // class MultipartMetaFilter + +extern bool is_v2_upload_id(const string& upload_id); + +extern int list_multipart_parts(RGWRados *store, RGWBucketInfo& bucket_info, + CephContext *cct, + const string& upload_id, + const string& meta_oid, int num_parts, + int marker, map<uint32_t, RGWUploadPartInfo>& parts, + int *next_marker, bool *truncated, + bool assume_unsorted = false); + +extern int list_multipart_parts(RGWRados *store, struct req_state *s, + const string& upload_id, + const string& meta_oid, int num_parts, + int marker, map<uint32_t, RGWUploadPartInfo>& parts, + int *next_marker, bool *truncated, + bool assume_unsorted = false); + +extern int abort_multipart_upload(RGWRados *store, CephContext *cct, RGWObjectCtx *obj_ctx, + RGWBucketInfo& bucket_info, RGWMPObj& mp_obj); + +extern int list_bucket_multiparts(RGWRados *store, RGWBucketInfo& bucket_info, + const string& prefix, + const string& marker, + const string& delim, + const int& max_uploads, + vector<rgw_bucket_dir_entry> *objs, + map<string, bool> *common_prefixes, bool *is_truncated); + +extern int abort_bucket_multiparts(RGWRados *store, CephContext *cct, RGWBucketInfo& bucket_info, + string& prefix, string& delim); +#endif |