rgw: es sync module, store custom metadata

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2016-08-19 05:31:09 -07:00
parent 4c96e9b29a
commit 9b0bf845bd

View File

@ -35,8 +35,10 @@ struct es_obj_metadata {
void dump(Formatter *f) const {
map<string, string> out_attrs;
map<string, string> custom_meta;
RGWAccessControlPolicy policy;
set<string> permissions;
for (auto i : attrs) {
const string& attr_name = i.first;
string name;
@ -46,6 +48,12 @@ struct es_obj_metadata {
continue;
}
if (attr_name.compare(0, sizeof(RGW_ATTR_META_PREFIX) - 1, RGW_ATTR_META_PREFIX) == 0) {
name = attr_name.substr(sizeof(RGW_ATTR_META_PREFIX) - 1);
custom_meta[name] = string(val.c_str(), (val.length() > 0 ? val.length() - 1 : 0));
continue;
}
name = attr_name.substr(sizeof(RGW_ATTR_PREFIX) - 1);
if (name == "acl") {
@ -91,6 +99,13 @@ struct es_obj_metadata {
for (auto i : out_attrs) {
::encode_json(i.first.c_str(), i.second, f);
}
if (!custom_meta.empty()) {
f->open_object_section("custom");
for (auto i : custom_meta) {
::encode_json(i.first.c_str(), i.second, f);
}
f->close_section();
}
f->close_section();
}