]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: make PhaseOperationT able to deal with interruptors
authorRadosław Zarzyński <rzarzyns@redhat.com>
Wed, 13 Apr 2022 07:17:46 +0000 (09:17 +0200)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 5 May 2022 02:06:31 +0000 (04:06 +0200)
Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/crimson/osd/osd_operation.h
src/crimson/osd/osd_operations/client_request.cc

index 4b36852017ad31f570aa5cf312c69e455845b8f2..66f2ef9eb77b46f34456d1dc71285a9901b5ec2d 100644 (file)
@@ -158,11 +158,17 @@ protected:
     get_event<EventT>().trigger(*that(), std::forward<Args>(args)...);
   }
 
-  template <class BlockingEventT, class F>
+  template <class BlockingEventT, class InterruptorT=void, class F>
   auto with_blocking_event(F&& f) {
-    return std::forward<F>(f)(typename BlockingEventT::template Trigger<T>{
+    auto ret = std::forward<F>(f)(typename BlockingEventT::template Trigger<T>{
       get_event<BlockingEventT>(), *that()
     });
+    if constexpr (std::is_same_v<InterruptorT, void>) {
+      return ret;
+    } else {
+      using ret_t = decltype(ret);
+      return typename InterruptorT::template futurize_t<ret_t>{std::move(ret)};
+    }
   }
 };
 
@@ -172,11 +178,12 @@ class PhasedOperationT : public TrackableOperationT<T> {
 protected:
   using TrackableOperationT<T>::TrackableOperationT;
 
-  template <class StageT>
+  template <class InterruptorT=void, class StageT>
   auto enter_stage(StageT& stage) {
-    return this->template with_blocking_event<typename StageT::BlockingEvent>(
+    return this->template with_blocking_event<typename StageT::BlockingEvent,
+                                             InterruptorT>(
       [&stage, this] (auto&& trigger) {
-      return handle.enter<T>(stage, std::move(trigger));
+        return handle.enter<T>(stage, std::move(trigger));
     });
   }
 
index 649293460f3b8e4ea00b7293bf25dfedc6f1f342..7a7e6286f5143519ab9190ff3120cdb968c22dbe 100644 (file)
@@ -85,7 +85,7 @@ seastar::future<> ClientRequest::start()
   track_event<StartEvent>();
   return seastar::repeat([this, opref=IRef{this}]() mutable {
       logger().debug("{}: in repeat", *this);
-      return enter_stage(cp().await_map).then([this]() {
+      return enter_stage<>(cp().await_map).then([this]() {
        return with_blocking_event<OSD_OSDMapGate::OSDMapBlocker::BlockingEvent>(
          [this](auto&& trigger) {
          return osd.osdmap_gate.wait_for_map(std::move(trigger),