]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add rgw::putobj::ManifestObjectProcessor
authorCasey Bodley <cbodley@redhat.com>
Wed, 10 Oct 2018 19:12:02 +0000 (15:12 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 16 Oct 2018 15:06:14 +0000 (11:06 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_putobj_processor.h

index 12fccedd5b6e485c4f8ac328cab97628b5a92d2d..c671fffd0b1d54ea1f497fc56b55f5cce8d0b22a 100644 (file)
@@ -163,4 +163,31 @@ RadosWriter::~RadosWriter()
   }
 }
 
+
+// advance to the next stripe
+int ManifestObjectProcessor::next(uint64_t offset, uint64_t *pstripe_size)
+{
+  // advance the manifest
+  int r = manifest_gen.create_next(offset);
+  if (r < 0) {
+    return r;
+  }
+
+  rgw_raw_obj stripe_obj = manifest_gen.get_cur_obj(store);
+
+  uint64_t chunk_size = 0;
+  r = store->get_max_chunk_size(stripe_obj.pool, &chunk_size);
+  if (r < 0) {
+    return r;
+  }
+  r = writer.set_stripe_obj(std::move(stripe_obj));
+  if (r < 0) {
+    return r;
+  }
+
+  chunk = ChunkProcessor(&writer, chunk_size);
+  *pstripe_size = manifest_gen.cur_stripe_max_size();
+  return 0;
+}
+
 } // namespace rgw::putobj
index 2057cc26d5155131a2cdccf8afb763c8e2d527b3..3e5a9077e8193b40b70a3adae244d20aa592b7c6 100644 (file)
@@ -104,4 +104,36 @@ class RadosWriter : public DataProcessor {
   void clear_written() { written.clear(); }
 };
 
+// a rados object processor that stripes according to RGWObjManifest
+class ManifestObjectProcessor : public HeadObjectProcessor,
+                                public StripeGenerator {
+ protected:
+  RGWRados *const store;
+  const RGWBucketInfo& bucket_info;
+  const rgw_user& owner;
+  RGWObjectCtx& obj_ctx;
+  rgw_obj head_obj;
+
+  RadosWriter writer;
+  RGWObjManifest manifest;
+  RGWObjManifest::generator manifest_gen;
+  ChunkProcessor chunk;
+  StripeProcessor stripe;
+
+  // implements StripeGenerator
+  int next(uint64_t offset, uint64_t *stripe_size) override;
+
+ public:
+  ManifestObjectProcessor(Aio *aio, RGWRados *store,
+                          const RGWBucketInfo& bucket_info,
+                          const rgw_user& owner, RGWObjectCtx& obj_ctx,
+                          const rgw_obj& head_obj)
+    : HeadObjectProcessor(0),
+      store(store), bucket_info(bucket_info), owner(owner),
+      obj_ctx(obj_ctx), head_obj(head_obj),
+      writer(aio, store, bucket_info, obj_ctx, head_obj),
+      chunk(&writer, 0), stripe(&chunk, this, 0)
+  {}
+};
+
 } // namespace rgw::putobj