// global "interrupt_cond" with the interruption condition, and go ahead
// executing the Func.
assert(interrupt_condition);
- auto [interrupt, fut] = interrupt_condition->template may_interrupt<
+ auto fut = interrupt_condition->template may_interrupt<
typename futurator_t::type>();
INTR_FUT_DEBUG(
"call_with_interruption_impl: may_interrupt: {}, "
"local interrupt_condition: {}, "
"global interrupt_cond: {},{}",
- interrupt,
+ (bool)fut,
(void*)interrupt_condition.get(),
(void*)interrupt_cond<InterruptCond>.interrupt_cond.get(),
typeid(InterruptCond).name());
- if (interrupt) {
+ if (fut) {
return std::move(*fut);
}
interrupt_cond<InterruptCond>.set(interrupt_condition);
Func&& func, T&&... args)
{
assert(interrupt_condition);
- auto [interrupt, fut] = interrupt_condition->template may_interrupt<seastar::future<>>();
+ auto fut = interrupt_condition->template may_interrupt<seastar::future<>>();
INTR_FUT_DEBUG(
"non_futurized_call_with_interruption may_interrupt: {}, "
"interrupt_condition: {}, interrupt_cond: {},{}",
- interrupt,
+ (bool)fut,
(void*)interrupt_condition.get(),
(void*)interrupt_cond<InterruptCond>.interrupt_cond.get(),
typeid(InterruptCond).name());
- if (interrupt) {
+ if (fut) {
std::rethrow_exception(fut->get_exception());
}
interrupt_cond<InterruptCond>.set(interrupt_condition);
TransactionConflictCondition(Transaction &t) : t(t) {}
template <typename Fut>
- std::pair<bool, std::optional<Fut>> may_interrupt() {
+ std::optional<Fut> may_interrupt() {
if (t.conflicted) {
- return {
- true,
- seastar::futurize<Fut>::make_exception_future(
- transaction_conflict())};
+ return seastar::futurize<Fut>::make_exception_future(
+ transaction_conflict());
} else {
- return {false, std::optional<Fut>()};
+ return std::optional<Fut>();
}
}
bool is_primary();
template <typename Fut>
- std::pair<bool, std::optional<Fut>> may_interrupt() {
+ std::optional<Fut> may_interrupt() {
if (new_interval_created()) {
- return {true, seastar::futurize<Fut>::make_exception_future(
- ::crimson::common::actingset_changed(is_primary()))};
+ return seastar::futurize<Fut>::make_exception_future(
+ ::crimson::common::actingset_changed(is_primary()));
}
if (is_stopping()) {
- return {true, seastar::futurize<Fut>::make_exception_future(
- ::crimson::common::system_shutdown_exception())};
+ return seastar::futurize<Fut>::make_exception_future(
+ ::crimson::common::system_shutdown_exception());
}
- return {false, std::optional<Fut>()};
+ return std::optional<Fut>();
}
template <typename T>
: interrupt(interrupt) {}
template <typename T>
- std::pair<bool, std::optional<T>> may_interrupt() {
- if (interrupt)
- return std::pair<bool, std::optional<T>>(
- true, seastar::futurize<T>::make_exception_future(test_interruption()));
- else
- return std::pair<bool, std::optional<T>>(false, std::optional<T>());
+ std::optional<T> may_interrupt() {
+ if (interrupt) {
+ return seastar::futurize<T>::make_exception_future(test_interruption());
+ } else {
+ return std::optional<T>();
+ }
}
template <typename T>