]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: dump progress through swift object copy
authorYehuda Sadeh <yehuda@inktank.com>
Sat, 20 Jul 2013 04:35:47 +0000 (21:35 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 22 Jul 2013 21:44:39 +0000 (14:44 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h

index 157158e7ed7d7a148f0339afeb7cb467ed780a07..f9d8c2eb3a97422243e41b85f746da2fefe7f9fd 100644 (file)
@@ -475,13 +475,37 @@ int RGWCopyObj_ObjStore_SWIFT::get_params()
   return 0;
 }
 
+void RGWCopyObj_ObjStore_SWIFT::send_partial_response(off_t ofs)
+{
+  if (!sent_header) {
+    if (!ret)
+      ret = STATUS_CREATED;
+    set_req_state_err(s, ret);
+    dump_errno(s);
+    end_header(s);
+
+    if (ret == 0) {
+      s->formatter->open_array_section("progress");
+    }
+    sent_header = true;
+  } else {
+    s->formatter->dump_int("ofs", (uint64_t)ofs);
+  }
+  rgw_flush_formatter(s, s->formatter);
+}
+
 void RGWCopyObj_ObjStore_SWIFT::send_response()
 {
-  if (!ret)
-    ret = STATUS_CREATED;
-  set_req_state_err(s, ret);
-  dump_errno(s);
-  end_header(s);
+  if (!sent_header) {
+   if (!ret)
+      ret = STATUS_CREATED;
+    set_req_state_err(s, ret);
+    dump_errno(s);
+    end_header(s);
+  } else {
+    s->formatter->close_section();
+    rgw_flush_formatter(s, s->formatter);
+  }
 }
 
 int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
index e4b6f0bccee1074683c236fd3fae80d12728e800..1c23ab29204beac10b14b75a3935587a73e0e81e 100644 (file)
@@ -100,13 +100,15 @@ public:
 };
 
 class RGWCopyObj_ObjStore_SWIFT : public RGWCopyObj_ObjStore {
+  bool sent_header;
 public:
-  RGWCopyObj_ObjStore_SWIFT() {}
+  RGWCopyObj_ObjStore_SWIFT() : sent_header(false) {}
   ~RGWCopyObj_ObjStore_SWIFT() {}
 
   int init_dest_policy();
   int get_params();
   void send_response();
+  void send_partial_response(off_t ofs);
 };
 
 class RGWGetACLs_ObjStore_SWIFT : public RGWGetACLs_ObjStore {