]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_multi.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rgw / rgw_multi.h
CommitLineData
7c673cae 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
7c673cae
FG
3
4#ifndef CEPH_RGW_MULTI_H
5#define CEPH_RGW_MULTI_H
6
7#include <map>
8#include "rgw_xml.h"
9f95a23c
TL
9#include "rgw_obj_manifest.h"
10#include "rgw_compression_types.h"
b3b6e05e 11#include "common/dout.h"
9f95a23c
TL
12
13namespace rgw { namespace sal {
20effc67 14 class Store;
9f95a23c 15} }
7c673cae 16
7c673cae
FG
17#define MULTIPART_UPLOAD_ID_PREFIX_LEGACY "2/"
18#define MULTIPART_UPLOAD_ID_PREFIX "2~" // must contain a unique char that may not come up in gen_rand_alpha()
19
9f95a23c
TL
20class RGWMPObj;
21
22struct RGWUploadPartInfo {
23 uint32_t num;
24 uint64_t size;
25 uint64_t accounted_size{0};
20effc67 26 std::string etag;
9f95a23c
TL
27 ceph::real_time modified;
28 RGWObjManifest manifest;
29 RGWCompressionInfo cs_info;
30
31 RGWUploadPartInfo() : num(0), size(0) {}
32
33 void encode(bufferlist& bl) const {
34 ENCODE_START(4, 2, bl);
35 encode(num, bl);
36 encode(size, bl);
37 encode(etag, bl);
38 encode(modified, bl);
39 encode(manifest, bl);
40 encode(cs_info, bl);
41 encode(accounted_size, bl);
42 ENCODE_FINISH(bl);
43 }
44 void decode(bufferlist::const_iterator& bl) {
45 DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
46 decode(num, bl);
47 decode(size, bl);
48 decode(etag, bl);
49 decode(modified, bl);
50 if (struct_v >= 3)
51 decode(manifest, bl);
52 if (struct_v >= 4) {
53 decode(cs_info, bl);
54 decode(accounted_size, bl);
55 } else {
56 accounted_size = size;
57 }
58 DECODE_FINISH(bl);
59 }
60 void dump(Formatter *f) const;
20effc67 61 static void generate_test_instances(std::list<RGWUploadPartInfo*>& o);
9f95a23c
TL
62};
63WRITE_CLASS_ENCODER(RGWUploadPartInfo)
64
7c673cae
FG
65class RGWMultiCompleteUpload : public XMLObj
66{
67public:
68 RGWMultiCompleteUpload() {}
69 ~RGWMultiCompleteUpload() override {}
70 bool xml_end(const char *el) override;
71
20effc67 72 std::map<int, std::string> parts;
7c673cae
FG
73};
74
75class RGWMultiPart : public XMLObj
76{
20effc67 77 std::string etag;
7c673cae
FG
78 int num;
79public:
80 RGWMultiPart() : num(0) {}
81 ~RGWMultiPart() override {}
82 bool xml_end(const char *el) override;
83
20effc67 84 std::string& get_etag() { return etag; }
7c673cae
FG
85 int get_num() { return num; }
86};
87
88class RGWMultiPartNumber : public XMLObj
89{
90public:
91 RGWMultiPartNumber() {}
92 ~RGWMultiPartNumber() override {}
93};
94
95class RGWMultiETag : public XMLObj
96{
97public:
98 RGWMultiETag() {}
99 ~RGWMultiETag() override {}
100};
101
102class RGWMultiXMLParser : public RGWXMLParser
103{
104 XMLObj *alloc_obj(const char *el) override;
105public:
106 RGWMultiXMLParser() {}
20effc67 107 virtual ~RGWMultiXMLParser() override;
7c673cae
FG
108};
109
20effc67
TL
110extern bool is_v2_upload_id(const std::string& upload_id);
111
7c673cae 112#endif