]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #ifndef CEPH_RGW_MULTI_H | |
5 | #define CEPH_RGW_MULTI_H | |
6 | ||
7 | #include <map> | |
8 | #include "rgw_xml.h" | |
9 | #include "rgw_rados.h" | |
10 | ||
7c673cae FG |
11 | #define MULTIPART_UPLOAD_ID_PREFIX_LEGACY "2/" |
12 | #define MULTIPART_UPLOAD_ID_PREFIX "2~" // must contain a unique char that may not come up in gen_rand_alpha() | |
13 | ||
14 | class RGWMultiCompleteUpload : public XMLObj | |
15 | { | |
16 | public: | |
17 | RGWMultiCompleteUpload() {} | |
18 | ~RGWMultiCompleteUpload() override {} | |
19 | bool xml_end(const char *el) override; | |
20 | ||
21 | std::map<int, string> parts; | |
22 | }; | |
23 | ||
24 | class RGWMultiPart : public XMLObj | |
25 | { | |
26 | string etag; | |
27 | int num; | |
28 | public: | |
29 | RGWMultiPart() : num(0) {} | |
30 | ~RGWMultiPart() override {} | |
31 | bool xml_end(const char *el) override; | |
32 | ||
33 | string& get_etag() { return etag; } | |
34 | int get_num() { return num; } | |
35 | }; | |
36 | ||
37 | class RGWMultiPartNumber : public XMLObj | |
38 | { | |
39 | public: | |
40 | RGWMultiPartNumber() {} | |
41 | ~RGWMultiPartNumber() override {} | |
42 | }; | |
43 | ||
44 | class RGWMultiETag : public XMLObj | |
45 | { | |
46 | public: | |
47 | RGWMultiETag() {} | |
48 | ~RGWMultiETag() override {} | |
49 | }; | |
50 | ||
51 | class RGWMultiXMLParser : public RGWXMLParser | |
52 | { | |
53 | XMLObj *alloc_obj(const char *el) override; | |
54 | public: | |
55 | RGWMultiXMLParser() {} | |
56 | ~RGWMultiXMLParser() override {} | |
57 | }; | |
58 | ||
11fdf7f2 TL |
59 | /** |
60 | * A filter to a) test whether an object name is a multipart meta | |
61 | * object, and b) filter out just the key used to determine the bucket | |
62 | * index shard. | |
63 | * | |
64 | * Objects for multipart meta have names adorned with an upload id and | |
65 | * other elements -- specifically a ".", MULTIPART_UPLOAD_ID_PREFIX, | |
66 | * unique id, and MP_META_SUFFIX. This filter will return true when | |
67 | * the name provided is such. It will also extract the key used for | |
68 | * bucket index shard calculation from the adorned name. | |
69 | */ | |
7c673cae FG |
70 | class MultipartMetaFilter : public RGWAccessListFilter { |
71 | public: | |
72 | MultipartMetaFilter() {} | |
7c673cae | 73 | |
11fdf7f2 TL |
74 | /** |
75 | * @param name [in] The object name as it appears in the bucket index. | |
76 | * @param key [out] An output parameter that will contain the bucket | |
77 | * index key if this entry is in the form of a multipart meta object. | |
78 | * @return true if the name provided is in the form of a multipart meta | |
79 | * object, false otherwise | |
80 | */ | |
81 | bool filter(const string& name, string& key) override; | |
82 | }; // class MultipartMetaFilter | |
7c673cae FG |
83 | |
84 | extern bool is_v2_upload_id(const string& upload_id); | |
85 | ||
11fdf7f2 TL |
86 | extern int list_multipart_parts(RGWRados *store, RGWBucketInfo& bucket_info, |
87 | CephContext *cct, | |
7c673cae | 88 | const string& upload_id, |
11fdf7f2 | 89 | const string& meta_oid, int num_parts, |
7c673cae FG |
90 | int marker, map<uint32_t, RGWUploadPartInfo>& parts, |
91 | int *next_marker, bool *truncated, | |
92 | bool assume_unsorted = false); | |
93 | ||
94 | extern int list_multipart_parts(RGWRados *store, struct req_state *s, | |
95 | const string& upload_id, | |
11fdf7f2 | 96 | const string& meta_oid, int num_parts, |
7c673cae FG |
97 | int marker, map<uint32_t, RGWUploadPartInfo>& parts, |
98 | int *next_marker, bool *truncated, | |
99 | bool assume_unsorted = false); | |
100 | ||
101 | extern int abort_multipart_upload(RGWRados *store, CephContext *cct, RGWObjectCtx *obj_ctx, | |
102 | RGWBucketInfo& bucket_info, RGWMPObj& mp_obj); | |
103 | ||
224ce89b | 104 | extern int list_bucket_multiparts(RGWRados *store, RGWBucketInfo& bucket_info, |
494da23a TL |
105 | const string& prefix, |
106 | const string& marker, | |
107 | const string& delim, | |
108 | const int& max_uploads, | |
109 | vector<rgw_bucket_dir_entry> *objs, | |
110 | map<string, bool> *common_prefixes, bool *is_truncated); | |
224ce89b WB |
111 | |
112 | extern int abort_bucket_multiparts(RGWRados *store, CephContext *cct, RGWBucketInfo& bucket_info, | |
113 | string& prefix, string& delim); | |
7c673cae | 114 | #endif |