virtual int clone_obj(void *ctx, rgw_obj& dst_obj, off_t dst_ofs,
rgw_obj& src_obj, off_t src_ofs,
- uint64_t size, map<string, bufferlist> attrs) {
+ uint64_t size, time_t *pmtime,
+ map<string, bufferlist> attrs) {
RGWCloneRangeInfo info;
vector<RGWCloneRangeInfo> v;
info.src = src_obj;
info.dst_ofs = dst_ofs;
info.len = size;
v.push_back(info);
- return clone_objs(ctx, dst_obj, v, attrs, true);
+ return clone_objs(ctx, dst_obj, v, attrs, pmtime, true);
}
virtual int clone_objs(void *ctx, rgw_obj& dst_obj,
vector<RGWCloneRangeInfo>& ranges,
- map<string, bufferlist> attrs, bool truncate_dest) { return -ENOTSUP; }
+ map<string, bufferlist> attrs, time_t *pmtime,
+ bool truncate_dest) { return -ENOTSUP; }
/**
* a simple object read without keeping state
*/
if (!multipart) {
rgw_obj dst_obj(s->bucket_str, s->object_str);
rgwstore->set_atomic(s->obj_ctx, dst_obj);
- ret = rgwstore->clone_obj(s->obj_ctx, dst_obj, 0, obj, 0, s->obj_size, attrs);
+ ret = rgwstore->clone_obj(s->obj_ctx, dst_obj, 0, obj, 0, s->obj_size, NULL, attrs);
if (ret < 0)
goto done_err;
if (created_obj) {
ofs += obj_iter->second.size;
}
- ret = rgwstore->clone_objs(s->obj_ctx, target_obj, ranges, attrs, true);
+ ret = rgwstore->clone_objs(s->obj_ctx, target_obj, ranges, attrs, NULL, true);
if (ret < 0)
goto done;
}
attrs = attrset;
- ret = clone_obj(ctx, dest_obj, 0, tmp_obj, 0, end + 1, attrs);
+ ret = clone_obj(ctx, dest_obj, 0, tmp_obj, 0, end + 1, NULL, attrs);
if (mtime)
obj_stat(ctx, tmp_obj, NULL, mtime);
/* FIXME: clone obj should be conditional, should check src object id-tag */
pair<string, bufferlist> cond(RGW_ATTR_ID_TAG, state->obj_tag);
- r = clone_obj_cond(NULL, dest_obj, 0, obj, 0, state->size, state->attrset, &cond);
+ r = clone_obj_cond(NULL, dest_obj, 0, obj, 0, state->size, state->attrset, &state->mtime, &cond);
if (r == -ECANCELED) {
/* we lost in a race here, original object was replaced, we assume it was cloned
as required */
int RGWRados::clone_objs(void *ctx, rgw_obj& dst_obj,
vector<RGWCloneRangeInfo>& ranges,
map<string, bufferlist> attrs,
+ time_t *pmtime,
bool truncate_dest,
pair<string, bufferlist> *xattr_cond)
{
}
}
+ if (pmtime)
+ op.mtime(pmtime);
+
bufferlist outbl;
int ret = io_ctx.operate(dst_oid, &op, &outbl);
return ret;
virtual bool aio_completed(void *handle);
virtual int clone_objs(void *ctx, rgw_obj& dst_obj,
vector<RGWCloneRangeInfo>& ranges,
- map<string, bufferlist> attrs, bool truncate_dest) {
- return clone_objs(ctx, dst_obj, ranges, attrs, truncate_dest, NULL);
+ map<string, bufferlist> attrs, time_t *pmtime, bool truncate_dest) {
+ return clone_objs(ctx, dst_obj, ranges, attrs, pmtime, truncate_dest, NULL);
}
int clone_objs(void *ctx, rgw_obj& dst_obj,
vector<RGWCloneRangeInfo>& ranges,
- map<string, bufferlist> attrs, bool truncate_dest,
+ map<string, bufferlist> attrs,
+ time_t *pmtime,
+ bool truncate_dest,
pair<string, bufferlist> *cmp_xattr);
int clone_obj_cond(void *ctx, rgw_obj& dst_obj, off_t dst_ofs,
rgw_obj& src_obj, off_t src_ofs,
uint64_t size, map<string, bufferlist> attrs,
+ time_t *pmtime,
pair<string, bufferlist> *xattr_cond) {
RGWCloneRangeInfo info;
vector<RGWCloneRangeInfo> v;
info.dst_ofs = dst_ofs;
info.len = size;
v.push_back(info);
- return clone_objs(ctx, dst_obj, v, attrs, true, xattr_cond);
+ return clone_objs(ctx, dst_obj, v, attrs, pmtime, true, xattr_cond);
}
/** Copy an object, with many extra options */