#include <optional>
#include "rgw_putobj.h"
-#include "rgw_rados.h"
#include "services/svc_rados.h"
#include "services/svc_tier_rados.h"
+#include "rgw_sal.h"
+#include "rgw_obj_manifest.h"
namespace rgw {
class RadosWriter : public DataProcessor {
Aio *const aio;
rgw::sal::RGWRadosStore *const store;
- const RGWBucketInfo& bucket_info;
+ rgw::sal::RGWBucket* bucket;
RGWObjectCtx& obj_ctx;
- const rgw_obj head_obj;
+ std::unique_ptr<rgw::sal::RGWObject> head_obj;
RGWSI_RADOS::Obj stripe_obj; // current stripe object
RawObjSet written; // set of written objects for deletion
const DoutPrefixProvider *dpp;
public:
RadosWriter(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
- RGWObjectCtx& obj_ctx, const rgw_obj& head_obj,
+ rgw::sal::RGWBucket* bucket,
+ RGWObjectCtx& obj_ctx, std::unique_ptr<rgw::sal::RGWObject> _head_obj,
const DoutPrefixProvider *dpp, optional_yield y)
- : aio(aio), store(store), bucket_info(bucket_info),
- obj_ctx(obj_ctx), head_obj(head_obj), dpp(dpp), y(y)
+ : aio(aio), store(store), bucket(bucket),
+ obj_ctx(obj_ctx), head_obj(std::move(_head_obj)), dpp(dpp), y(y)
{}
+ RadosWriter(RadosWriter&& r)
+ : aio(r.aio), store(r.store), bucket(r.bucket),
+ obj_ctx(r.obj_ctx), head_obj(std::move(r.head_obj)), dpp(r.dpp), y(r.y)
+ {}
+
~RadosWriter();
// change the current stripe object
public StripeGenerator {
protected:
rgw::sal::RGWRadosStore *const store;
- const RGWBucketInfo& bucket_info;
+ rgw::sal::RGWBucket* bucket;
rgw_placement_rule tail_placement_rule;
rgw_user owner;
RGWObjectCtx& obj_ctx;
- rgw_obj head_obj;
+ std::unique_ptr<rgw::sal::RGWObject> head_obj;
RadosWriter writer;
RGWObjManifest manifest;
public:
ManifestObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
const rgw_user& owner, RGWObjectCtx& obj_ctx,
- const rgw_obj& head_obj,
+ std::unique_ptr<rgw::sal::RGWObject> _head_obj,
const DoutPrefixProvider* dpp, optional_yield y)
: HeadObjectProcessor(0),
- store(store), bucket_info(bucket_info),
+ store(store), bucket(bucket),
owner(owner),
- obj_ctx(obj_ctx), head_obj(head_obj),
- writer(aio, store, bucket_info, obj_ctx, head_obj, dpp, y),
+ obj_ctx(obj_ctx), head_obj(std::move(_head_obj)),
+ writer(aio, store, bucket, obj_ctx, head_obj->clone(), dpp, y),
chunk(&writer, 0), stripe(&chunk, this, 0), dpp(dpp) {
if (ptail_placement_rule) {
tail_placement_rule = *ptail_placement_rule;
int process_first_chunk(bufferlist&& data, DataProcessor **processor) override;
public:
AtomicObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
const rgw_user& owner,
- RGWObjectCtx& obj_ctx, const rgw_obj& head_obj,
+ RGWObjectCtx& obj_ctx,
+ std::unique_ptr<rgw::sal::RGWObject> _head_obj,
std::optional<uint64_t> olh_epoch,
const std::string& unique_tag,
const DoutPrefixProvider *dpp, optional_yield y)
- : ManifestObjectProcessor(aio, store, bucket_info, ptail_placement_rule,
- owner, obj_ctx, head_obj, dpp, y),
+ : ManifestObjectProcessor(aio, store, bucket, ptail_placement_rule,
+ owner, obj_ctx, std::move(_head_obj), dpp, y),
olh_epoch(olh_epoch), unique_tag(unique_tag)
{}
// part's head is written with an exclusive create to detect racing uploads of
// the same part/upload id, which are restarted with a random oid prefix
class MultipartObjectProcessor : public ManifestObjectProcessor {
- const rgw_obj target_obj; // target multipart object
+ std::unique_ptr<rgw::sal::RGWObject> target_obj; // target multipart object
const std::string upload_id;
const int part_num;
const std::string part_num_str;
int prepare_head();
public:
MultipartObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
const rgw_user& owner, RGWObjectCtx& obj_ctx,
- const rgw_obj& head_obj,
+ std::unique_ptr<rgw::sal::RGWObject> _head_obj,
const std::string& upload_id, uint64_t part_num,
const std::string& part_num_str,
const DoutPrefixProvider *dpp, optional_yield y)
- : ManifestObjectProcessor(aio, store, bucket_info, ptail_placement_rule,
- owner, obj_ctx, head_obj, dpp, y),
- target_obj(head_obj), upload_id(upload_id),
+ : ManifestObjectProcessor(aio, store, bucket, ptail_placement_rule,
+ owner, obj_ctx, std::move(_head_obj), dpp, y),
+ target_obj(head_obj->clone()), upload_id(upload_id),
part_num(part_num), part_num_str(part_num_str),
- mp(head_obj.key.name, upload_id)
+ mp(head_obj->get_name(), upload_id)
{}
// prepare a multipart manifest
int process_first_chunk(bufferlist&& data, DataProcessor **processor) override;
public:
- AppendObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info,
+ AppendObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
- const rgw_user& owner, RGWObjectCtx& obj_ctx,const rgw_obj& head_obj,
+ const rgw_user& owner, RGWObjectCtx& obj_ctx,
+ std::unique_ptr<rgw::sal::RGWObject> _head_obj,
const std::string& unique_tag, uint64_t position,
uint64_t *cur_accounted_size,
const DoutPrefixProvider *dpp, optional_yield y)
- : ManifestObjectProcessor(aio, store, bucket_info, ptail_placement_rule,
- owner, obj_ctx, head_obj, dpp, y),
+ : ManifestObjectProcessor(aio, store, bucket, ptail_placement_rule,
+ owner, obj_ctx, std::move(_head_obj), dpp, y),
position(position), cur_size(0), cur_accounted_size(cur_accounted_size),
unique_tag(unique_tag), cur_manifest(nullptr)
{}