hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
yac_proposal_storage.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_YAC_PROPOSAL_STORAGE_HPP
7 #define IROHA_YAC_PROPOSAL_STORAGE_HPP
8 
9 #include <memory>
10 #include <vector>
11 
12 #include <boost/optional.hpp>
18 #include "logger/logger_fwd.hpp"
20 
21 namespace iroha {
22  namespace consensus {
23  namespace yac {
24 
25  struct VoteMessage;
26 
32  private:
33  // --------| private api |--------
34 
41  auto findStore(const YacHash &store_hash);
42 
43  public:
44  // --------| public api |--------
45 
47  Round store_round,
48  PeersNumberType peers_in_round,
49  std::shared_ptr<SupermajorityChecker> supermajority_checker,
50  logger::LoggerManagerTreePtr log_manager);
51 
59  boost::optional<Answer> insert(VoteMessage vote);
60 
67  boost::optional<Answer> insert(std::vector<VoteMessage> messages);
68 
72  const Round &getStorageKey() const;
73 
77  boost::optional<Answer> getState() const;
78 
79  private:
80  // --------| private api |--------
81 
87  bool shouldInsert(const VoteMessage &msg);
88 
94  bool checkProposalRound(const Round &vote_round);
95 
100  bool checkPeerUniqueness(const VoteMessage &msg);
101 
108  boost::optional<Answer> findRejectProof();
109 
110  // --------| fields |--------
111 
115  boost::optional<Answer> current_state_;
116 
120  std::vector<YacBlockStorage> block_storages_;
121 
125  Round storage_key_;
126 
130  PeersNumberType peers_in_round_;
131 
135  std::shared_ptr<SupermajorityChecker> supermajority_checker_;
136 
140  logger::LoggerManagerTreePtr log_manager_;
141 
145  logger::LoggerPtr log_;
146  };
147  } // namespace yac
148  } // namespace consensus
149 } // namespace iroha
150 #endif // IROHA_YAC_PROPOSAL_STORAGE_HPP
boost::optional< Answer > insert(VoteMessage vote)
Definition: yac_proposal_storage.cpp:57
YacProposalStorage(Round store_round, PeersNumberType peers_in_round, std::shared_ptr< SupermajorityChecker > supermajority_checker, logger::LoggerManagerTreePtr log_manager)
Definition: yac_proposal_storage.cpp:45
Definition: yac_hash_provider.hpp:30
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:14
const Round & getStorageKey() const
Definition: yac_proposal_storage.cpp:94
std::shared_ptr< LoggerManagerTree > LoggerManagerTreePtr
Definition: logger_manager_fwd.hpp:14
size_t PeersNumberType
Type for number of peers in round.
Definition: yac_types.hpp:16
boost::optional< Answer > getState() const
Definition: yac_proposal_storage.cpp:98
Definition: vote_message.hpp:22
Definition: yac_proposal_storage.hpp:31
Definition: round.hpp:31