RGWAccessControlPolicy * const bucket_policy,
uint64_t * const ptotal_len,
uint64_t * const pobj_size,
+ string * const pobj_sum,
int (*cb)(rgw_bucket& bucket,
const RGWObjEnt& ent,
RGWAccessControlPolicy * const bucket_policy,
list_op.params.prefix = obj_prefix;
list_op.params.delim = delim;
+ MD5 etag_sum;
do {
#define MAX_LIST_OBJS 100
int r = list_op.list_objects(MAX_LIST_OBJS, &objs, NULL, &is_truncated);
- if (r < 0)
+ if (r < 0) {
return r;
+ }
- vector<RGWObjEnt>::iterator viter;
-
- for (viter = objs.begin(); viter != objs.end(); ++viter) {
- RGWObjEnt& ent = *viter;
+ for (RGWObjEnt& ent : objs) {
uint64_t cur_total_len = obj_ofs;
uint64_t start_ofs = 0, end_ofs = ent.size;
}
obj_ofs += ent.size;
+ if (pobj_sum) {
+ etag_sum.Update((const byte *)ent.etag.c_str(),
+ ent.etag.length());
+ }
if (!found_end && obj_ofs > (uint64_t)end) {
end_ofs = end - cur_total_len + 1;
if (pobj_size) {
*pobj_size = obj_ofs;
}
+ if (pobj_sum) {
+ complete_etag(etag_sum, pobj_sum);
+ }
return 0;
}
bucket_policy = s->bucket_acl;
}
- /* dry run to find out total length */
+ /* dry run to find out:
+ * - total length (of the parts we are going to send to client),
+ * - overall DLO's content size,
+ * - md5 sum of overall DLO's content (for etag of Swift API). */
int r = iterate_user_manifest_parts(s->cct, store, ofs, end,
- bucket, obj_prefix, bucket_policy, &total_len, &s->obj_size,
- NULL, NULL);
+ bucket, obj_prefix, bucket_policy,
+ &total_len, &s->obj_size, &lo_etag,
+ nullptr /* cb */, nullptr /* cb arg */);
if (r < 0) {
return r;
}
}
r = iterate_user_manifest_parts(s->cct, store, ofs, end,
- bucket, obj_prefix, bucket_policy, NULL, NULL,
+ bucket, obj_prefix, bucket_policy,
+ nullptr, nullptr, nullptr,
get_obj_user_manifest_iterate_cb, (void *)this);
if (r < 0) {
return r;
return send_response_data(bl, 0, 0);
}
-int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl, off_t bl_ofs,
- off_t bl_len)
+int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl,
+ const off_t bl_ofs,
+ const off_t bl_len)
{
string content_type;
}
if (! op_ret) {
- map<string, bufferlist>::iterator iter = attrs.find(RGW_ATTR_ETAG);
- if (iter != attrs.end()) {
- bufferlist& bl = iter->second;
- if (bl.length()) {
- char *etag = bl.c_str();
- dump_etag(s, etag);
+ if (!lo_etag.empty()) {
+ dump_etag(s, ("\"" + lo_etag + "\"").c_str());
+ } else {
+ auto iter = attrs.find(RGW_ATTR_ETAG);
+ if (iter != attrs.end()) {
+ bufferlist& bl = iter->second;
+ if (bl.length()) {
+ char *etag = bl.c_str();
+ dump_etag(s, etag);
+ }
}
}