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>
10 #include "logger/logger_fwd.hpp"
13 
14 namespace iroha {
16  private:
17  // -----------------------------| private API |-----------------------------
18 
25  auto getState(const shared_model::crypto::PublicKey &target_peer_key);
26 
27  public:
28  // ----------------------------| interface API |----------------------------
29  MstStorageStateImpl(const CompleterType &completer,
30  logger::LoggerPtr mst_state_logger,
31  logger::LoggerPtr log);
32 
33  auto applyImpl(const shared_model::crypto::PublicKey &target_peer_key,
34  const MstState &new_state)
35  -> decltype(apply(target_peer_key, new_state)) override;
36 
37  auto updateOwnStateImpl(const DataType &tx)
38  -> decltype(updateOwnState(tx)) override;
39 
40  auto extractExpiredTransactionsImpl(const TimeType &current_time)
41  -> decltype(extractExpiredTransactions(current_time)) override;
42 
43  auto getDiffStateImpl(
44  const shared_model::crypto::PublicKey &target_peer_key,
45  const TimeType &current_time)
46  -> decltype(getDiffState(target_peer_key, current_time)) override;
47 
48  auto whatsNewImpl(ConstRefState new_state) const
49  -> decltype(whatsNew(new_state)) override;
50 
51  bool batchInStorageImpl(const DataType &batch) const override;
52 
53  private:
54  // ---------------------------| private fields |----------------------------
55 
56  const CompleterType completer_;
57  std::unordered_map<shared_model::crypto::PublicKey,
58  MstState,
60  peer_states_;
61  MstState own_state_;
62 
63  logger::LoggerPtr mst_state_logger_;
64  };
66 } // namespace iroha
67 
68 #endif // IROHA_MST_STORAGE_IMPL_HPP
Definition: hash.hpp:24
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:15
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:33
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
MstState whatsNew(ConstRefState new_state) const
Definition: mst_storage.cpp:38
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
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