6 #ifndef IROHA_MST_STORAGE_IMPL_HPP 7 #define IROHA_MST_STORAGE_IMPL_HPP 10 #include <unordered_map> 28 shared_model::interface::types::PublicKeyHexStringView target_peer_key);
40 shared_model::interface::types::PublicKeyHexStringView target_peer_key,
42 -> decltype(
apply(target_peer_key, new_state))
override;
51 shared_model::interface::types::PublicKeyHexStringView target_peer_key,
53 -> decltype(
getDiffState(target_peer_key, current_time))
override;
56 -> decltype(
whatsNew(new_state))
override;
67 struct StringViewOrString {
71 explicit StringViewOrString(std::string_view v) : v(v) {}
72 explicit StringViewOrString(std::string s) : s(s), v(this->s) {}
74 StringViewOrString(StringViewOrString
const &o)
75 : s(o.s), v(not this->s.empty() ? this->s : o.v) {}
76 StringViewOrString(StringViewOrString &&o) noexcept
78 v(not this->s.empty() ? this->s : std::move(o).v) {}
80 bool operator==(StringViewOrString
const &x)
const {
85 std::size_t
operator()(StringViewOrString
const &x)
const {
86 return std::hash<std::string_view>()(x.v);
90 std::unordered_map<StringViewOrString, MstState, StringViewOrString::Hash>
99 #endif // IROHA_MST_STORAGE_IMPL_HPP MstStorageStateImpl & operator=(MstStorageStateImpl const &)=delete
std::size_t operator()(StringViewOrString const &x) const
Definition: mst_storage_impl.hpp:85
auto whatsNewImpl(ConstRefState new_state) const -> decltype(whatsNew(new_state)) override
Definition: mst_storage_impl.cpp:65
Definition: mst_storage_impl.hpp:17
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:46
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:55
void processFinalizedTransactionImpl(shared_model::interface::types::HashType const &hash) override
Definition: mst_storage_impl.cpp:74
Definition: mst_state.hpp:76
StateUpdateResult updateOwnState(const DataType &tx)
Definition: mst_storage.cpp:20
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: mst_storage_impl.hpp:84
std::shared_ptr< const Completer > CompleterType
Definition: mst_state.hpp:74
Definition: block_query.hpp:15
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
shared_model::interface::types::TimestampType TimeType
Definition: mst_types.hpp:25
MstStorageStateImpl(CompleterType const &completer, logger::LoggerPtr mst_state_logger, logger::LoggerPtr log)
Definition: mst_storage_impl.cpp:24
bool batchInStorageImpl(const DataType &batch) const override
Definition: mst_storage_impl.cpp:70
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:32
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:41
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