]> git.apps.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>
Mon, 22 Jan 2018 20:43:14 +0000 (15:43 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 20f31a412d3479efe71d5745c55575173c3fe9e8)

src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 8da06d359649ad86029718d7a962b9b7128a261e..cf0c14f284740ff0c088c256b4877e047e36c1d7 100644 (file)
@@ -660,6 +660,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 5b28896e873023750abe565842e9994bbcc7a254..fc68ba5f1e05f85680e7756fead45c7c8b192f83 100644 (file)
@@ -984,6 +984,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;