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>
12 
13 namespace iroha {
15  private:
16  // -----------------------------| private API |-----------------------------
17 
24  auto getState(const shared_model::crypto::PublicKey &target_peer_key);
25 
26  public:
27  // ----------------------------| interface API |----------------------------
28  explicit MstStorageStateImpl(const CompleterType &completer);
29 
30  auto applyImpl(const shared_model::crypto::PublicKey &target_peer_key,
31  const MstState &new_state)
32  -> decltype(apply(target_peer_key, new_state)) override;
33 
34  auto updateOwnStateImpl(const DataType &tx)
35  -> decltype(updateOwnState(tx)) override;
36 
37  auto getExpiredTransactionsImpl(const TimeType &current_time)
38  -> decltype(getExpiredTransactions(current_time)) override;
39 
40  auto getDiffStateImpl(
41  const shared_model::crypto::PublicKey &target_peer_key,
42  const TimeType &current_time)
43  -> decltype(getDiffState(target_peer_key, current_time)) override;
44 
45  auto whatsNewImpl(ConstRefState new_state) const
46  -> decltype(whatsNew(new_state)) override;
47 
48  bool batchInStorageImpl(const DataType &batch) const override;
49 
50  private:
51  // ---------------------------| private fields |----------------------------
52 
53  const CompleterType completer_;
54  std::unordered_map<shared_model::crypto::PublicKey,
55  MstState,
57  peer_states_;
58  MstState own_state_;
59  };
60 } // namespace iroha
61 
62 #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:30
auto whatsNewImpl(ConstRefState new_state) const -> decltype(whatsNew(new_state)) override
Definition: mst_storage_impl.cpp:57
Definition: mst_storage_impl.hpp:14
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:47
Definition: mst_storage.hpp:23
StateUpdateResult apply(const shared_model::crypto::PublicKey &target_peer_key, const MstState &new_state)
Definition: mst_storage.cpp:13
MstStorageStateImpl(const CompleterType &completer)
Definition: mst_storage_impl.cpp:22
Definition: mst_state.hpp:79
StateUpdateResult updateOwnState(const DataType &tx)
Definition: mst_storage.cpp:20
std::shared_ptr< const Completer > CompleterType
Definition: mst_state.hpp:77
Definition: block_query.hpp:16
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:27
shared_model::interface::types::TimestampType TimeType
Definition: mst_types.hpp:25
MstState whatsNew(ConstRefState new_state) const
Definition: mst_storage.cpp:37
bool batchInStorageImpl(const DataType &batch) const override
Definition: mst_storage_impl.cpp:62
BatchPtr DataType
Definition: mst_types.hpp:40
Definition: public_key.hpp:16
auto getExpiredTransactionsImpl(const TimeType &current_time) -> decltype(getExpiredTransactions(current_time)) override
Definition: mst_storage_impl.cpp:41
auto updateOwnStateImpl(const DataType &tx) -> decltype(updateOwnState(tx)) override
Definition: mst_storage_impl.cpp:36
MstState getExpiredTransactions(const TimeType &current_time)
Definition: mst_storage.cpp:25
ConstRefT< MstState > ConstRefState
Definition: mst_types.hpp:38