]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_multi.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rgw / rgw_multi.h
index f406213b4090fa72a455cd8245a96020469aa9d9..668b12080194b46e945bf49318027e0991643dac 100644 (file)
@@ -1,17 +1,67 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
+// vim: ts=8 sw=2 smarttab ft=cpp
 
 #ifndef CEPH_RGW_MULTI_H
 #define CEPH_RGW_MULTI_H
 
 #include <map>
 #include "rgw_xml.h"
-#include "rgw_rados.h"
+#include "rgw_obj_manifest.h"
+#include "rgw_compression_types.h"
+#include "common/dout.h"
+
+namespace rgw { namespace sal {
+  class Store;
+} }
 
-#define MP_META_SUFFIX ".meta"
 #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 RGWMPObj;
+
+struct RGWUploadPartInfo {
+  uint32_t num;
+  uint64_t size;
+  uint64_t accounted_size{0};
+  std::string etag;
+  ceph::real_time modified;
+  RGWObjManifest manifest;
+  RGWCompressionInfo cs_info;
+
+  RGWUploadPartInfo() : num(0), size(0) {}
+
+  void encode(bufferlist& bl) const {
+    ENCODE_START(4, 2, bl);
+    encode(num, bl);
+    encode(size, bl);
+    encode(etag, bl);
+    encode(modified, bl);
+    encode(manifest, bl);
+    encode(cs_info, bl);
+    encode(accounted_size, bl);
+    ENCODE_FINISH(bl);
+  }
+  void decode(bufferlist::const_iterator& bl) {
+    DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
+    decode(num, bl);
+    decode(size, bl);
+    decode(etag, bl);
+    decode(modified, bl);
+    if (struct_v >= 3)
+      decode(manifest, bl);
+    if (struct_v >= 4) {
+      decode(cs_info, bl);
+      decode(accounted_size, bl);
+    } else {
+      accounted_size = size;
+    }
+    DECODE_FINISH(bl);
+  }
+  void dump(Formatter *f) const;
+  static void generate_test_instances(std::list<RGWUploadPartInfo*>& o);
+};
+WRITE_CLASS_ENCODER(RGWUploadPartInfo)
+
 class RGWMultiCompleteUpload : public XMLObj
 {
 public:
@@ -19,19 +69,19 @@ public:
   ~RGWMultiCompleteUpload() override {}
   bool xml_end(const char *el) override;
 
-  std::map<int, string> parts;
+  std::map<int, std::string> parts;
 };
 
 class RGWMultiPart : public XMLObj
 {
-  string etag;
+  std::string etag;
   int num;
 public:
   RGWMultiPart() : num(0) {}
   ~RGWMultiPart() override {}
   bool xml_end(const char *el) override;
 
-  string& get_etag() { return etag; }
+  std::string& get_etag() { return etag; }
   int get_num() { return num; }
 };
 
@@ -54,55 +104,9 @@ class RGWMultiXMLParser : public RGWXMLParser
   XMLObj *alloc_obj(const char *el) override;
 public:
   RGWMultiXMLParser() {}
-  ~RGWMultiXMLParser() override {}
+  virtual ~RGWMultiXMLParser() override;
 };
 
-class MultipartMetaFilter : public RGWAccessListFilter {
-public:
-  MultipartMetaFilter() {}
-  bool filter(string& name, string& key) override {
-    int len = name.size();
-    if (len < 6)
-      return false;
-
-    size_t pos = name.find(MP_META_SUFFIX, len - 5);
-    if (pos == string::npos)
-      return false;
-
-    pos = name.rfind('.', pos - 1);
-    if (pos == string::npos)
-      return false;
-
-    key = name.substr(0, pos);
-
-    return true;
-  }
-};
-
-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,
-                                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,
-                                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,
-                                string& prefix, string& marker, string& delim,
-                                int& max_uploads, vector<rgw_bucket_dir_entry> *objs,
-                                map<string, bool> *common_prefixes, bool *is_truncated);
+extern bool is_v2_upload_id(const std::string& upload_id);
 
-extern int abort_bucket_multiparts(RGWRados *store, CephContext *cct, RGWBucketInfo& bucket_info,
-                                string& prefix, string& delim);
 #endif