]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add RGWRadosTimelogTrimCR
authorCasey Bodley <cbodley@redhat.com>
Wed, 8 Jun 2016 19:54:31 +0000 (15:54 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 22 Jul 2016 16:08:22 +0000 (12:08 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 19fb94944d6d975f5c2dd4c10b275f2ba736f31f..99f8427e45178c98ed3f090d88d9cf49cf21cb0d 100644 (file)
@@ -651,6 +651,47 @@ int RGWRadosTimelogAddCR::request_complete()
   return r;
 }
 
+RGWRadosTimelogTrimCR::RGWRadosTimelogTrimCR(RGWRados *store,
+                                             const std::string& oid,
+                                             const real_time& start_time,
+                                             const real_time& end_time,
+                                             const std::string& from_marker,
+                                             const std::string& to_marker)
+  : RGWSimpleCoroutine(store->ctx()), store(store), oid(oid),
+    start_time(start_time), end_time(end_time),
+    from_marker(from_marker), to_marker(to_marker)
+{
+  set_description() << "timelog trim oid=" <<  oid
+      << " start_time=" << start_time << " end_time=" << end_time
+      << " from_marker=" << from_marker << " to_marker=" << to_marker;
+}
+
+RGWRadosTimelogTrimCR::~RGWRadosTimelogTrimCR()
+{
+  if (cn) {
+    cn->put();
+  }
+}
+
+int RGWRadosTimelogTrimCR::send_request()
+{
+  set_status() << "sending request";
+
+  cn = stack->create_completion_notifier();
+  cn->get();
+  return store->time_log_trim(oid, start_time, end_time, from_marker,
+                              to_marker, cn->completion());
+}
+
+int RGWRadosTimelogTrimCR::request_complete()
+{
+  int r = cn->completion()->get_return_value();
+
+  set_status() << "request complete; ret=" << r;
+
+  return r;
+}
+
 int RGWAsyncStatObj::_send_request()
 {
   return store->raw_obj_stat(obj, psize, pmtime, pepoch,
index 81cae4d281302d16ce51851a2da060cc5ba4205c..5174ab6e1f29bf88e928e1a2b103317642dd8e03 100644 (file)
@@ -981,6 +981,26 @@ public:
   int request_complete();
 };
 
+class RGWRadosTimelogTrimCR : public RGWSimpleCoroutine {
+  RGWRados *store;
+  RGWAioCompletionNotifier *cn{nullptr};
+  std::string oid;
+  real_time start_time;
+  real_time end_time;
+  std::string from_marker;
+  std::string to_marker;
+
+public:
+  RGWRadosTimelogTrimCR(RGWRados *store, const std::string& oid,
+                        const real_time& start_time, const real_time& end_time,
+                        const std::string& from_marker,
+                        const std::string& to_marker);
+  ~RGWRadosTimelogTrimCR();
+
+  int send_request() override;
+  int request_complete() override;
+};
+
 class RGWAsyncStatObj : public RGWAsyncRadosRequest {
   RGWRados *store;
   rgw_obj obj;