hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
yac_vote_storage.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_YAC_VOTE_STORAGE_HPP
7 #define IROHA_YAC_VOTE_STORAGE_HPP
8 
9 #include <memory>
10 #include <unordered_map>
11 #include <vector>
12 
13 #include <boost/optional.hpp>
14 #include "consensus/yac/outcome_messages.hpp" // because messages passed by value
15 #include "consensus/yac/storage/storage_result.hpp" // for Answer
16 #include "consensus/yac/storage/yac_common.hpp" // for ProposalHash
19 
20 namespace iroha {
21  namespace consensus {
22  namespace yac {
23 
50  enum class ProposalState {
54  };
55 
60  private:
61  // --------| private api |--------
62 
68  auto getProposalStorage(const Round &round);
69 
78  auto findProposalStorage(const VoteMessage &msg,
79  PeersNumberType peers_in_round);
80 
81  public:
82  // --------| public api |--------
83 
91  boost::optional<Answer> store(std::vector<VoteMessage> state,
92  PeersNumberType peers_in_round);
93 
99  bool isCommitted(const Round &round);
100 
107  ProposalState getProcessingState(const Round &round);
108 
117  void nextProcessingState(const Round &round);
118 
119  private:
120  // --------| fields |--------
121 
125  std::vector<YacProposalStorage> proposal_storages_;
126 
132  std::unordered_map<Round, ProposalState, RoundTypeHasher>
133  processing_state_;
134  };
135 
136  } // namespace yac
137  } // namespace consensus
138 } // namespace iroha
139 
140 #endif // IROHA_YAC_VOTE_STORAGE_HPP
Definition: yac_vote_storage.hpp:59
ProposalState
Definition: yac_vote_storage.hpp:50
Definition: block_query.hpp:16
size_t PeersNumberType
Type for number of peers in round.
Definition: yac_types.hpp:16
Definition: vote_message.hpp:22
Definition: round.hpp:31