]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add a timelog add operation cr
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 15 Jan 2016 19:50:39 +0000 (11:50 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:56 +0000 (16:13 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 83b472cd7809e992583a1643cb9b60cf645fe73a..761acfee5aa37b93a82dcd5809ac6af37a35c8eb 100644 (file)
@@ -218,7 +218,9 @@ RGWRadosSetOmapKeysCR::RGWRadosSetOmapKeysCR(RGWRados *_store,
 
 RGWRadosSetOmapKeysCR::~RGWRadosSetOmapKeysCR()
 {
-  cn->put();
+  if (cn) {
+    cn->put();
+  }
 }
 
 int RGWRadosSetOmapKeysCR::send_request()
@@ -573,3 +575,38 @@ int RGWContinuousLeaseCR::operate()
   }
   return 0;
 }
+
+RGWRadosTimelogAddCR::RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid,
+                      const cls_log_entry& entry) : RGWSimpleCoroutine(_store->ctx()),
+                                                store(_store),
+                                                oid(_oid), cn(NULL)
+{
+  stringstream& s = set_description();
+  s << "timelog add entry oid=" <<  oid << "entry={id=" << entry.id << ", section=" << entry.section << ", name=" << entry.name << "}";
+  entries.push_back(entry);
+}
+
+RGWRadosTimelogAddCR::~RGWRadosTimelogAddCR()
+{
+  if (cn) {
+    cn->put();
+  }
+}
+
+int RGWRadosTimelogAddCR::send_request()
+{
+  set_status() << "sending request";
+
+  cn = stack->create_completion_notifier();
+  cn->get();
+  return store->time_log_add(oid, entries, cn->completion(), true);
+}
+
+int RGWRadosTimelogAddCR::request_complete()
+{
+  int r = cn->completion()->get_return_value();
+
+  set_status() << "request complete; ret=" << r;
+
+  return r;
+}
index 6f6c47438a45c9a005dad32a86d3deda00641265..52722578aff31f027c01d4280039b110e8489702 100644 (file)
@@ -869,5 +869,22 @@ public:
   }
 };
 
+class RGWRadosTimelogAddCR : public RGWSimpleCoroutine {
+  RGWRados *store;
+  list<cls_log_entry> entries;
+
+  string oid;
+
+  RGWAioCompletionNotifier *cn;
+
+public:
+  RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid,
+                       const cls_log_entry& entry);
+  ~RGWRadosTimelogAddCR();
+
+  int send_request();
+  int request_complete();
+};
+
 
 #endif