#include "rgw_coroutine.h"
#include "rgw_rest_conn.h"
+#include "rgw_rados.h"
struct rgw_rest_obj {
encode_json("acl_mappings", acl_mappings, f);
encode_json("multipart_sync_threshold", multipart_sync_threshold, f);
encode_json("multipart_min_part_size", multipart_min_part_size, f);
+ encode_json("retain_object", retain_object, f);
}
void RGWZoneGroupPlacementTier::decode_json(JSONObj *obj)
JSONDecoder::decode_json("acl_mappings", acl_mappings, obj);
JSONDecoder::decode_json("multipart_sync_threshold", multipart_sync_threshold, obj);
JSONDecoder::decode_json("multipart_min_part_size", multipart_min_part_size, obj);
+ JSONDecoder::decode_json("retain_object", retain_object, obj);
}
void RGWZoneGroupPlacementTarget::dump(Formatter *f) const
return 0;
}
+ int delete_tier_obj(lc_op_ctx& oc, RGWLCCloudTierCtx& tier_ctx) {
+ int ret = -1;
+
+ /* XXX: do we need to check for retention/versioning attributes
+ * as done in RGWDeleteObj?
+ */
+ ret = oc.store->getRados()->delete_obj(oc.rctx, oc.bucket_info, oc.obj, 0);
+
+ return ret;
+ }
+
int update_tier_obj(lc_op_ctx& oc, RGWLCCloudTierCtx& tier_ctx) {
map<string, bufferlist> attrs;
RGWRados::Object op_target(tier_ctx.store->getRados(),
tier_ctx.bucket_info,
- tier_ctx.rctx, tier_ctx.obj);
+ tier_ctx.rctx, tier_ctx.obj);
RGWRados::Object::Read read_op(&op_target);
return ret;
}
- ret = update_tier_obj(oc, tier_ctx);
- if (ret < 0) {
- ldpp_dout(oc.dpp, 0) << "Updating tier object failed ret=" << ret << dendl;
- return ret;
+ if (oc.tier.retain_object) {
+ ret = update_tier_obj(oc, tier_ctx);
+ if (ret < 0) {
+ ldpp_dout(oc.dpp, 0) << "Updating tier object failed ret=" << ret << dendl;
+ return ret;
+ }
+ } else {
+ ret = delete_tier_obj(oc, tier_ctx);
+ if (ret < 0) {
+ ldpp_dout(oc.dpp, 0) << "Deleting tier object failed ret=" << ret << dendl;
+ return ret;
+ }
}
return 0;
if (config.exists("secret")) {
key.key = config["secret"];
}
+ if (config.exists("retain_object")) {
+ string s = config["retain_object"];
+ if (s == "true") {
+ retain_object = true;
+ } else {
+ retain_object = false;
+ }
+ }
if (config.exists("multipart_sync_threshold")) {
r = conf_to_uint64(config, "multipart_sync_threshold", &multipart_sync_threshold);
if (config.exists("secret")) {
key.key.clear();
}
+ if (config.exists("retain_object")) {
+ retain_object = false;
+ }
if (config.exists("multipart_sync_threshold")) {
multipart_sync_threshold = DEFAULT_MULTIPART_SYNC_PART_SIZE;
}
uint64_t multipart_sync_threshold{DEFAULT_MULTIPART_SYNC_PART_SIZE};
uint64_t multipart_min_part_size{DEFAULT_MULTIPART_SYNC_PART_SIZE};
+ bool retain_object = false;
+
int update_params(const JSONFormattable& config);
int clear_params(const JSONFormattable& config);
encode(acl_mappings, bl);
encode(multipart_sync_threshold, bl);
encode(multipart_min_part_size, bl);
+ encode(retain_object, bl);
ENCODE_FINISH(bl);
}
decode(acl_mappings, bl);
decode(multipart_sync_threshold, bl);
decode(multipart_min_part_size, bl);
+ decode(retain_object, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;