From: Yehuda Sadeh Date: Fri, 19 Aug 2016 09:19:29 +0000 (-0700) Subject: rgw: es sync module, store object attrs X-Git-Tag: v11.1.0~681^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=162c683d45a641ba94711e830ba8e4a03f76a7df;p=ceph.git rgw: es sync module, store object attrs Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_sync_module_es.cc b/src/rgw/rgw_sync_module_es.cc index ceb2b0569634..10fa43afcfc6 100644 --- a/src/rgw/rgw_sync_module_es.cc +++ b/src/rgw/rgw_sync_module_es.cc @@ -31,11 +31,35 @@ struct es_obj_metadata { size(_size), attrs(std::move(_attrs)) {} void dump(Formatter *f) const { - f->open_object_section("meta"); - ::encode_json("bucket", bucket_info.bucket.name, f); + map out_attrs; + for (auto i : attrs) { + const string& attr_name = i.first; + string name; + bufferlist& val = i.second; + + if (attr_name.compare(0, sizeof(RGW_ATTR_PREFIX) - 1, RGW_ATTR_PREFIX) != 0) { + continue; + } + + name = attr_name.substr(sizeof(RGW_ATTR_PREFIX) - 1); + + if (name == "acl") { + } else { + if (name != "pg_ver" && + name != "source_zone" && + name != "idtag") { + out_attrs[name] = string(val.c_str(), (val.length() > 0 ? val.length() - 1 : 0)); + } + } + } ::encode_json("name", key.name, f); ::encode_json("instance", key.instance, f); + f->open_object_section("meta"); + ::encode_json("bucket", bucket_info.bucket.name, f); ::encode_json("size", size, f); + for (auto i : out_attrs) { + ::encode_json(i.first.c_str(), i.second, f); + } f->close_section(); }