]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: es sync module, keep object mtime
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 19 Aug 2016 11:39:38 +0000 (04:39 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 17:31:22 +0000 (10:31 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_sync_module_es.cc

index 3aed75ac6b478ecc342c6e1e377cb125e4c5056e..3e74f488266ee8333b1e83a563f55fbe2981f84e 100644 (file)
@@ -24,12 +24,14 @@ struct es_obj_metadata {
   CephContext *cct;
   RGWBucketInfo bucket_info;
   rgw_obj_key key;
+  ceph::real_time mtime;
   uint64_t size;
   map<string, bufferlist> attrs;
 
-  es_obj_metadata(CephContext *_cct, const RGWBucketInfo& _bucket_info, const rgw_obj_key& _key,
-                  uint64_t _size, map<string, bufferlist>& _attrs) : cct(_cct), bucket_info(_bucket_info), key(_key),
-                                                                     size(_size), attrs(std::move(_attrs)) {}
+  es_obj_metadata(CephContext *_cct, const RGWBucketInfo& _bucket_info,
+                  const rgw_obj_key& _key, ceph::real_time& _mtime, uint64_t _size,
+                  map<string, bufferlist>& _attrs) : cct(_cct), bucket_info(_bucket_info), key(_key),
+                                                     mtime(_mtime), size(_size), attrs(std::move(_attrs)) {}
 
   void dump(Formatter *f) const {
     map<string, string> out_attrs;
@@ -82,6 +84,10 @@ struct es_obj_metadata {
     ::encode_json("permissions", permissions, f);
     f->open_object_section("meta");
     ::encode_json("size", size, f);
+
+    string mtime_str;
+    rgw_to_iso8601(mtime, &mtime_str);
+    ::encode_json("mtime", mtime_str, f);
     for (auto i : out_attrs) {
       ::encode_json(i.first.c_str(), i.second, f);
     }
@@ -103,7 +109,7 @@ public:
                               << " attrs=" << attrs << dendl;
       yield {
         string path = es_get_obj_path(bucket_info, key);
-        es_obj_metadata doc(sync_env->cct, bucket_info, key, size, attrs);
+        es_obj_metadata doc(sync_env->cct, bucket_info, key, mtime, size, attrs);
 
         call(new RGWPutRESTResourceCR<es_obj_metadata, int>(sync_env->cct, conf.conn,
                                                             sync_env->http_manager,