diff --git a/src/io/future.hpp b/src/io/future.hpp index 14fe813d1..bb2ef548c 100644 --- a/src/io/future.hpp +++ b/src/io/future.hpp @@ -148,6 +148,14 @@ class Future { old.consumed_or_moved_ = true; } + Future &operator=(Future &&old) noexcept { + MG_ASSERT(!old.consumed_or_moved_, "Future moved from after already being moved from or consumed."); + shared_ = std::move(old.shared_); + consumed_or_moved_ = old.consumed_or_moved_; + old.consumed_or_moved_ = true; + return *this; + } + Future(const Future &) = delete; Future &operator=(const Future &) = delete; ~Future() = default; diff --git a/src/io/rsm/rsm_client.hpp b/src/io/rsm/rsm_client.hpp index f837ee0ec..b60380b08 100644 --- a/src/io/rsm/rsm_client.hpp +++ b/src/io/rsm/rsm_client.hpp @@ -13,9 +13,11 @@ #include #include +#include #include #include "io/address.hpp" +#include "io/errors.hpp" #include "io/rsm/raft.hpp" #include "utils/result.hpp" @@ -43,21 +45,36 @@ class RsmClient { Address leader_; ServerPool server_addrs_; + /// State for single async read/write operations. In the future this could become a map + /// of async operations that can be accessed via an ID etc... + std::optional