From 648e61b874fcbf7709453aaf9d0e65cd38c469d1 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 17 Oct 2019 10:56:22 +0200 Subject: [PATCH] crimson: drop ceph::do_with(). Specialize sestar::do_with() instead. Signed-off-by: Radoslaw Zarzynski --- src/crimson/common/errorator.h | 42 ++++++++++------------------------ src/crimson/osd/pg.cc | 4 ++-- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index fa532cd69dc..d07c48c7d5a 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -43,19 +43,6 @@ inline auto do_for_each(Container& c, AsyncAction action) { return ::crimson::do_for_each(std::begin(c), std::end(c), std::move(action)); } -template -static inline auto do_with(T&& rvalue, F&& f) { - using FuncReturn = decltype(std::move(f)(rvalue)); - using Errorator = typename FuncReturn::errorator_type; - using Futurator = typename Errorator::template futurize; - return typename Futurator::type { - seastar::do_with(std::move(rvalue), - [f = std::move(f)] (T& moved_rvalue) mutable { - return Errorator::plainify(std::move(f)(moved_rvalue)); - }) - }; -} - // define the interface between error types and errorator template class error_t { @@ -368,6 +355,10 @@ private: public: using errorator_type = ::crimson::errorator; + using promise_type = seastar::promise; + + using base_t::available; + using base_t::failed; [[gnu::always_inline]] _future(base_t&& base) @@ -543,11 +534,6 @@ private: Iterator end, AsyncAction action); - // for the sake of `plainify()` let any errorator convert errorated - // future into plain one. - template - friend class errorator; - template friend class ::seastar::future; }; @@ -632,15 +618,6 @@ public: }; private: - template - static decltype(auto) plainify(seastar::future&& fut) { - return std::forward>(fut); - } - template - static decltype(auto) plainify(Arg&& arg) { - return std::forward(arg); - } - template > class futurize { using vanilla_futurize = seastar::futurize; @@ -706,9 +683,6 @@ private: // we were exploiting before. template friend class errorator; - - template - friend inline auto do_with(T&&, F&&); }; // class errorator, generic template // no errors? errorator<>::future is plain seastar::future then! @@ -825,4 +799,12 @@ struct futurize>> { } }; +namespace internal { +template