hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
mst_storage_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_MST_STORAGE_IMPL_HPP
7 #define IROHA_MST_STORAGE_IMPL_HPP
8 
9 #include <unordered_map>
11 #include "logger/logger_fwd.hpp"
14 
15 namespace iroha {
17  private:
18  // -----------------------------| private API |-----------------------------
19 
26  auto getState(const shared_model::crypto::PublicKey &target_peer_key);
27 
28  public:
29  // ----------------------------| interface API |----------------------------
30  MstStorageStateImpl(const CompleterType &completer,
31  logger::LoggerPtr mst_state_logger,
32  logger::LoggerPtr log);
33 
34  auto applyImpl(const shared_model::crypto::PublicKey &target_peer_key,
35  const MstState &new_state)
36  -> decltype(apply(target_peer_key, new_state)) override;
37 
38  auto updateOwnStateImpl(const DataType &tx)
39  -> decltype(updateOwnState(tx)) override;
40 
41  auto extractExpiredTransactionsImpl(const TimeType &current_time)
42  -> decltype(extractExpiredTransactions(current_time)) override;
43 
44  auto getDiffStateImpl(
45  const shared_model::crypto::PublicKey &target_peer_key,
46  const TimeType &current_time)
47  -> decltype(getDiffState(target_peer_key, current_time)) override;
48 
49  auto whatsNewImpl(ConstRefState new_state) const
50  -> decltype(whatsNew(new_state)) override;
51 
52  bool batchInStorageImpl(const DataType &batch) const override;
53 
54  private:
55  // ---------------------------| private fields |----------------------------
56 
57  const CompleterType completer_;
58  std::unordered_map<shared_model::crypto::PublicKey,
59  MstState,
61  peer_states_;
62  MstState own_state_;
63 
64  logger::LoggerPtr mst_state_logger_;
65  };
67 } // namespace iroha
68 
69 #endif // IROHA_MST_STORAGE_IMPL_HPP
MstState getDiffState(const shared_model::crypto::PublicKey &target_peer_key, const TimeType &current_time)
Definition: mst_storage.cpp:31
auto whatsNewImpl(ConstRefState new_state) const -> decltype(whatsNew(new_state)) override
Definition: mst_storage_impl.cpp:65
Definition: mst_storage_impl.hpp:16
auto getDiffStateImpl(const shared_model::crypto::PublicKey &target_peer_key, const TimeType &current_time) -> decltype(getDiffState(target_peer_key, current_time)) override
Definition: mst_storage_impl.cpp:55
Definition: mst_storage.hpp:23
MstStorageStateImpl(const CompleterType &completer, logger::LoggerPtr mst_state_logger, logger::LoggerPtr log)
Definition: mst_storage_impl.cpp:24
StateUpdateResult apply(const shared_model::crypto::PublicKey &target_peer_key, const MstState &new_state)
Definition: mst_storage.cpp:13
auto extractExpiredTransactionsImpl(const TimeType &current_time) -> decltype(extractExpiredTransactions(current_time)) override
Definition: mst_storage_impl.cpp:46
Definition: mst_state.hpp:89
StateUpdateResult updateOwnState(const DataType &tx)
Definition: mst_storage.cpp:20
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
std::shared_ptr< const Completer > CompleterType
Definition: mst_state.hpp:87
Definition: block_query.hpp:14
const char * PublicKey
Definition: iroha_conf_literals.cpp:47
auto applyImpl(const shared_model::crypto::PublicKey &target_peer_key, const MstState &new_state) -> decltype(apply(target_peer_key, new_state)) override
Definition: mst_storage_impl.cpp:32
shared_model::interface::types::TimestampType TimeType
Definition: mst_types.hpp:25
bool batchInStorageImpl(const DataType &batch) const override
Definition: mst_storage_impl.cpp:70
BatchPtr DataType
Definition: mst_types.hpp:40
Definition: public_key.hpp:16
Definition: blob_hasher.hpp:18
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 &current_time)
Definition: mst_storage.cpp:25
ConstRefT< MstState > ConstRefState
Definition: mst_types.hpp:38