6 #ifndef IROHA_MST_STORAGE_IMPL_HPP 7 #define IROHA_MST_STORAGE_IMPL_HPP 10 #include <unordered_map> 12 #include <rxcpp/rx-lite.hpp> 20 struct private_tag {};
31 shared_model::interface::types::PublicKeyHexStringView target_peer_key);
43 static std::shared_ptr<MstStorageStateImpl>
create(
45 rxcpp::observable<shared_model::interface::types::HashType>
51 shared_model::interface::types::PublicKeyHexStringView target_peer_key,
53 -> decltype(
apply(target_peer_key, new_state))
override;
62 shared_model::interface::types::PublicKeyHexStringView target_peer_key,
64 -> decltype(
getDiffState(target_peer_key, current_time))
override;
67 -> decltype(
whatsNew(new_state))
override;
75 struct StringViewOrString {
79 explicit StringViewOrString(std::string_view v) : v(v) {}
80 explicit StringViewOrString(std::string s) : s(s), v(this->s) {}
82 StringViewOrString(StringViewOrString
const &o)
83 : s(o.s), v(not this->s.empty() ? this->s : o.v) {}
84 StringViewOrString(StringViewOrString &&o) noexcept
86 v(not this->s.empty() ? this->s : std::move(o).v) {}
88 bool operator==(StringViewOrString
const &x)
const {
93 std::size_t
operator()(StringViewOrString
const &x)
const {
94 return std::hash<std::string_view>()(x.v);
98 std::unordered_map<StringViewOrString, MstState, StringViewOrString::Hash>
107 #endif // IROHA_MST_STORAGE_IMPL_HPP MstStorageStateImpl & operator=(MstStorageStateImpl const &)=delete
std::size_t operator()(StringViewOrString const &x) const
Definition: mst_storage_impl.hpp:93
auto whatsNewImpl(ConstRefState new_state) const -> decltype(whatsNew(new_state)) override
Definition: mst_storage_impl.cpp:96
Definition: mst_storage_impl.hpp:18
StateUpdateResult apply(shared_model::interface::types::PublicKeyHexStringView target_peer_key, const MstState &new_state)
Definition: mst_storage.cpp:13
Definition: mst_storage.hpp:23
auto extractExpiredTransactionsImpl(const TimeType ¤t_time) -> decltype(extractExpiredTransactions(current_time)) override
Definition: mst_storage_impl.cpp:77
auto getDiffStateImpl(shared_model::interface::types::PublicKeyHexStringView target_peer_key, const TimeType ¤t_time) -> decltype(getDiffState(target_peer_key, current_time)) override
Definition: mst_storage_impl.cpp:86
Definition: mst_state.hpp:76
StateUpdateResult updateOwnState(const DataType &tx)
Definition: mst_storage.cpp:20
MstStorageStateImpl(MstStorageStateImpl::private_tag, CompleterType const &completer, logger::LoggerPtr mst_state_logger, logger::LoggerPtr log)
Definition: mst_storage_impl.cpp:24
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: mst_storage_impl.hpp:92
std::shared_ptr< const Completer > CompleterType
Definition: mst_state.hpp:74
Definition: block_query.hpp:15
shared_model::interface::types::TimestampType TimeType
Definition: mst_types.hpp:25
bool batchInStorageImpl(const DataType &batch) const override
Definition: mst_storage_impl.cpp:101
static std::shared_ptr< MstStorageStateImpl > create(CompleterType const &completer, rxcpp::observable< shared_model::interface::types::HashType > finalized_txs, logger::LoggerPtr mst_state_logger, logger::LoggerPtr log)
Definition: mst_storage_impl.cpp:33
BatchPtr DataType
Definition: mst_types.hpp:41
auto applyImpl(shared_model::interface::types::PublicKeyHexStringView target_peer_key, const MstState &new_state) -> decltype(apply(target_peer_key, new_state)) override
Definition: mst_storage_impl.cpp:63
MstState whatsNew(ConstRefState new_state) const
Definition: mst_storage.cpp:38
auto updateOwnStateImpl(const DataType &tx) -> decltype(updateOwnState(tx)) override
Definition: mst_storage_impl.cpp:72
MstState extractExpiredTransactions(const TimeType ¤t_time)
Definition: mst_storage.cpp:25
ConstRefT< MstState > ConstRefState
Definition: mst_types.hpp:39
MstState getDiffState(shared_model::interface::types::PublicKeyHexStringView target_peer_key, const TimeType ¤t_time)
Definition: mst_storage.cpp:31