protected:
int prepare(RGWRados *store, string *oid_rand);
- int do_complete(string& etag, real_time *mtime, real_time set_mtime,
- map<string, bufferlist>& attrs, real_time delete_at,
- const char *if_match = NULL, const char *if_nomatch = NULL);
+ int do_complete(size_t accounted_size, const string& etag, real_time *mtime,
+ real_time set_mtime, map<string, bufferlist>& attrs,
+ real_time delete_at, const char *if_match,
+ const char *if_nomatch) override;
public:
bool immutable_head() { return true; }
(strncmp(uid, MULTIPART_UPLOAD_ID_PREFIX_LEGACY, sizeof(MULTIPART_UPLOAD_ID_PREFIX_LEGACY) - 1) == 0);
}
-int RGWPutObjProcessor_Multipart::do_complete(string& etag, real_time *mtime, real_time set_mtime,
- map<string, bufferlist>& attrs, real_time delete_at,
- const char *if_match, const char *if_nomatch)
+int RGWPutObjProcessor_Multipart::do_complete(size_t accounted_size,
+ const string& etag,
+ real_time *mtime, real_time set_mtime,
+ map<string, bufferlist>& attrs,
+ real_time delete_at,
+ const char *if_match,
+ const char *if_nomatch)
{
complete_writing_data();
head_obj_op.meta.owner = s->owner.get_id();
head_obj_op.meta.delete_at = delete_at;
- int r = head_obj_op.write_meta(obj_len, obj_len, attrs);
+ int r = head_obj_op.write_meta(obj_len, accounted_size, attrs);
if (r < 0)
return r;
}
info.num = atoi(part_num.c_str());
info.etag = etag;
- info.size = s->obj_size;
- info.accounted_size = s->obj_size; // TODO
+ info.size = obj_len;
+ info.accounted_size = accounted_size;
info.modified = real_clock::now();
info.manifest = manifest;
emplace_attr(RGW_ATTR_SLO_UINDICATOR, std::move(slo_userindicator_bl));
}
- op_ret = processor->complete(etag, &mtime, real_time(), attrs, delete_at,
- if_match, if_nomatch);
+ op_ret = processor->complete(s->obj_size, etag, &mtime, real_time(), attrs,
+ delete_at, if_match, if_nomatch);
/* produce torrent */
if (s->cct->_conf->rgw_torrent_flag && (ofs == torrent.get_data_len()))
emplace_attr(RGW_ATTR_COMPRESSION, std::move(tmp));
}
- op_ret = processor.complete(etag, NULL, real_time(), attrs, delete_at);
+ op_ret = processor.complete(s->obj_size, etag, NULL, real_time(), attrs, delete_at);
}
obj_op.meta.ptag = &s->req_id; /* use req_id as operation tag */
obj_op.meta.owner = s->owner.get_id();
obj_op.meta.flags = PUT_OBJ_CREATE;
- op_ret = obj_op.write_meta(ofs, ofs, attrs);
+ op_ret = obj_op.write_meta(ofs, accounted_size, attrs);
if (op_ret < 0)
return;
append_rand_alpha(cct, write_version.tag, write_version.tag, TAG_LEN);
}
-int RGWPutObjProcessor::complete(string& etag, real_time *mtime, real_time set_mtime,
+int RGWPutObjProcessor::complete(size_t accounted_size, const string& etag,
+ real_time *mtime, real_time set_mtime,
map<string, bufferlist>& attrs, real_time delete_at,
- const char *if_match, const char * if_nomatch)
+ const char *if_match, const char *if_nomatch)
{
- int r = do_complete(etag, mtime, set_mtime, attrs, delete_at, if_match, if_nomatch);
+ int r = do_complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at, if_match, if_nomatch);
if (r < 0)
return r;
return 0;
}
-int RGWPutObjProcessor_Atomic::do_complete(string& etag, real_time *mtime, real_time set_mtime,
- map<string, bufferlist>& attrs, real_time delete_at,
+int RGWPutObjProcessor_Atomic::do_complete(size_t accounted_size, const string& etag,
+ real_time *mtime, real_time set_mtime,
+ map<string, bufferlist>& attrs,
+ real_time delete_at,
const char *if_match,
const char *if_nomatch) {
int r = complete_writing_data();
obj_op.meta.olh_epoch = olh_epoch;
obj_op.meta.delete_at = delete_at;
- r = obj_op.write_meta(obj_len, obj_len, attrs);
+ r = obj_op.write_meta(obj_len, accounted_size, attrs);
if (r < 0) {
return r;
}
return data_len;
}
- int complete(string& etag, real_time *mtime, real_time set_mtime, map<string, bufferlist>& attrs, real_time delete_at) {
- return processor->complete(etag, mtime, set_mtime, attrs, delete_at);
+ int complete(const string& etag, real_time *mtime, real_time set_mtime,
+ map<string, bufferlist>& attrs, real_time delete_at) {
+ return processor->complete(data_len, etag, mtime, set_mtime, attrs, delete_at);
}
bool is_canceled() {
}
}
- ret = processor.complete(etag, mtime, set_mtime, attrs, delete_at);
+ // XXX: need to copy over compression attr and its orig_size here?
+ ret = processor.complete(ofs, etag, mtime, set_mtime, attrs, delete_at);
return ret;
}
RGWBucketInfo bucket_info;
bool canceled;
- virtual int do_complete(string& etag, ceph::real_time *mtime, ceph::real_time set_mtime,
+ virtual int do_complete(size_t accounted_size, const string& etag,
+ ceph::real_time *mtime, ceph::real_time set_mtime,
map<string, bufferlist>& attrs, ceph::real_time delete_at,
- const char *if_match = NULL, const char *if_nomatch = NULL) = 0;
+ const char *if_match, const char *if_nomatch) = 0;
public:
RGWPutObjProcessor(RGWObjectCtx& _obj_ctx, RGWBucketInfo& _bi) : store(NULL),
return 0;
}
- virtual int complete(string& etag, ceph::real_time *mtime, ceph::real_time set_mtime,
- map<string, bufferlist>& attrs, ceph::real_time delete_at,
- const char *if_match = NULL, const char *if_nomatch = NULL);
+ int complete(size_t accounted_size, const string& etag,
+ ceph::real_time *mtime, ceph::real_time set_mtime,
+ map<string, bufferlist>& attrs, ceph::real_time delete_at,
+ const char *if_match = NULL, const char *if_nomatch = NULL);
CephContext *ctx();
RGWObjManifest::generator manifest_gen;
int write_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool exclusive);
- virtual int do_complete(string& etag, ceph::real_time *mtime, ceph::real_time set_mtime,
- map<string, bufferlist>& attrs, ceph::real_time delete_at,
- const char *if_match = NULL, const char *if_nomatch = NULL);
+ int do_complete(size_t accounted_size, const string& etag,
+ ceph::real_time *mtime, ceph::real_time set_mtime,
+ map<string, bufferlist>& attrs, ceph::real_time delete_at,
+ const char *if_match, const char *if_nomatch) override;
int prepare_next_part(off_t ofs);
int complete_parts();