]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_multi.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_RGW_MULTI_H
5 #define CEPH_RGW_MULTI_H
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()
14 class RGWMultiCompleteUpload
: public XMLObj
17 RGWMultiCompleteUpload() {}
18 ~RGWMultiCompleteUpload() override
{}
19 bool xml_end(const char *el
) override
;
21 std::map
<int, string
> parts
;
24 class RGWMultiPart
: public XMLObj
29 RGWMultiPart() : num(0) {}
30 ~RGWMultiPart() override
{}
31 bool xml_end(const char *el
) override
;
33 string
& get_etag() { return etag
; }
34 int get_num() { return num
; }
37 class RGWMultiPartNumber
: public XMLObj
40 RGWMultiPartNumber() {}
41 ~RGWMultiPartNumber() override
{}
44 class RGWMultiETag
: public XMLObj
48 ~RGWMultiETag() override
{}
51 class RGWMultiXMLParser
: public RGWXMLParser
53 XMLObj
*alloc_obj(const char *el
) override
;
55 RGWMultiXMLParser() {}
56 ~RGWMultiXMLParser() override
{}
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
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.
70 class MultipartMetaFilter
: public RGWAccessListFilter
{
72 MultipartMetaFilter() {}
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
81 bool filter(const string
& name
, string
& key
) override
;
82 }; // class MultipartMetaFilter
84 extern bool is_v2_upload_id(const string
& upload_id
);
86 extern int list_multipart_parts(RGWRados
*store
, RGWBucketInfo
& bucket_info
,
88 const string
& upload_id
,
89 const string
& meta_oid
, int num_parts
,
90 int marker
, map
<uint32_t, RGWUploadPartInfo
>& parts
,
91 int *next_marker
, bool *truncated
,
92 bool assume_unsorted
= false);
94 extern int list_multipart_parts(RGWRados
*store
, struct req_state
*s
,
95 const string
& upload_id
,
96 const string
& meta_oid
, int num_parts
,
97 int marker
, map
<uint32_t, RGWUploadPartInfo
>& parts
,
98 int *next_marker
, bool *truncated
,
99 bool assume_unsorted
= false);
101 extern int abort_multipart_upload(RGWRados
*store
, CephContext
*cct
, RGWObjectCtx
*obj_ctx
,
102 RGWBucketInfo
& bucket_info
, RGWMPObj
& mp_obj
);
104 extern int list_bucket_multiparts(RGWRados
*store
, RGWBucketInfo
& bucket_info
,
105 const string
& prefix
,
106 const string
& marker
,
108 const int& max_uploads
,
109 vector
<rgw_bucket_dir_entry
> *objs
,
110 map
<string
, bool> *common_prefixes
, bool *is_truncated
);
112 extern int abort_bucket_multiparts(RGWRados
*store
, CephContext
*cct
, RGWBucketInfo
& bucket_info
,
113 string
& prefix
, string
& delim
);