]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common/errorator: add futurize::apply
authorSamuel Just <sjust@redhat.com>
Wed, 2 Jun 2021 02:52:27 +0000 (19:52 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 23 Jun 2021 18:23:34 +0000 (18:23 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/errorator.h

index e9685bc3a1fb4b959c46d5d56e72f032eb38eec0..aa9f196cec9b218b72f7c433f96b49a813f2dbdc 100644 (file)
@@ -1211,6 +1211,18 @@ struct futurize<Container<::crimson::errorated_future_marker<Value>>> {
   using type = typename errorator_type::template future<Value>;
   using value_type = seastar::internal::future_stored_type_t<Value>;
 
+  template<typename Func, typename... FuncArgs>
+  [[gnu::always_inline]]
+  static type apply(Func&& func, std::tuple<FuncArgs...>&& args) noexcept {
+    try {
+      return std::apply(
+       std::forward<Func>(func),
+       std::forward<std::tuple<FuncArgs...>>(args));
+    } catch (...) {
+      return make_exception_future(std::current_exception());
+    }
+  }
+
   template<typename Func, typename... FuncArgs>
   [[gnu::always_inline]]
   static inline type invoke(Func&& func, FuncArgs&&... args) noexcept {