From 72b9d64604a78f09b26e7058d7873943c00c166d Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Thu, 4 May 2017 15:16:03 +0200 Subject: [PATCH] rgw es: add support for obj tags Signed-off-by: Abhishek Lekshmanan (cherry picked from commit 7bff49bd3eadca59d5c23fe1eafa18bb40292463) --- src/rgw/rgw_sync_module_es.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_sync_module_es.cc b/src/rgw/rgw_sync_module_es.cc index 484352dc835c..6c8c65c5a14c 100644 --- a/src/rgw/rgw_sync_module_es.cc +++ b/src/rgw/rgw_sync_module_es.cc @@ -263,6 +263,7 @@ struct es_obj_metadata { map custom_meta; RGWAccessControlPolicy policy; set permissions; + RGWObjTags obj_tags; for (auto i : attrs) { const string& attr_name = i.first; @@ -302,6 +303,9 @@ struct es_obj_metadata { } } } + } else if (name == "x-amz-tagging") { + auto tags_bl = val.begin(); + ::decode(obj_tags, tags_bl); } else { if (name != "pg_ver" && name != "source_zone" && @@ -396,7 +400,18 @@ struct es_obj_metadata { } f->close_section(); } - f->close_section(); + f->close_section(); // meta + const auto& m = obj_tags.get_tags(); + if (m.size() > 0){ + f->open_array_section("tagging"); + for (const auto &it : m) { + f->open_object_section("tag"); + ::encode_json("key", it.first, f); + ::encode_json("value",it.second, f); + f->close_section(); + } + f->close_section(); // tagging + } } }; -- 2.47.3