]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common: implement satisfy_with_result_of() in errorator's futurize.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 7 Jul 2020 13:11:07 +0000 (15:11 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 6 Aug 2020 21:59:06 +0000 (17:59 -0400)
This is needed due to the recent changes in `seastar::future`'s
implementation.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/common/errorator.h

index 7efc41836776e57ccb97f9c167977cc0ce52cd25..d6301769394af39b9a2fa2ea6ba5b061a19c3940 100644 (file)
@@ -352,6 +352,14 @@ private:
     template <class ErrorVisitor, class Futurator>
     friend class maybe_handle_error_t;
 
+    // any `seastar::futurize` specialization must be able to access the base.
+    // see : `satisfy_with_result_of()` far below.
+    template <typename>
+    friend class seastar::futurize;
+
+    template <typename T1, typename T2, typename... More>
+    friend auto seastar::internal::do_with_impl(T1&& rv1, T2&& rv2, More&&... more);
+
     template <class, class = std::void_t<>>
     struct get_errorator {
       // generic template for non-errorated things (plain types and
@@ -1059,6 +1067,21 @@ struct futurize<Container<::crimson::errorated_future_marker<Values...>>> {
   static type make_exception_future(Arg&& arg) {
     return errorator_type::template make_exception_future2<Values...>(std::forward<Arg>(arg));
   }
+
+private:
+  template<typename PromiseT, typename Func>
+  static void satisfy_with_result_of(PromiseT&& pr, Func&& func) {
+    // this may use the protected variant of `seastar::future::forward_to()`
+    // because:
+    //   1. `seastar::future` established a friendship with with all
+    //      specializations of `seastar::futurize`, including this
+    //      one (we're in the `seastar` namespace!) WHILE
+    //   2. any errorated future declares now the friendship with any
+    //      `seastar::futurize<...>`.
+    func().forward_to(std::move(pr));
+  }
+  template <typename... U>
+  friend class future;
 };
 
 namespace internal {