hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
supermajority_checker.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_CONSENSUS_SUPERMAJORITY_CHECKER_HPP
7 #define IROHA_CONSENSUS_SUPERMAJORITY_CHECKER_HPP
8 
9 #include <memory>
10 #include <vector>
11 
12 #include <boost/range/any_range.hpp>
17 
18 namespace shared_model {
19  namespace interface {
20  class Peer;
21  }
22 } // namespace shared_model
23 
24 namespace iroha {
25  namespace consensus {
26  namespace yac {
27 
32  public:
33  using VoteGroups = boost::any_range<PeersNumberType,
34  boost::forward_traversal_tag,
35  // reference type must be const for
36  // transform_iterator to be able to
37  // assign to any_iterator safely
38  const PeersNumberType,
39  std::ptrdiff_t>;
40 
41  virtual ~SupermajorityChecker() = default;
42 
49  virtual bool hasSupermajority(PeersNumberType current,
50  PeersNumberType all) const = 0;
51 
58  virtual bool canHaveSupermajority(const VoteGroups &votes,
59  PeersNumberType all) const = 0;
60  };
61 
63  std::unique_ptr<SupermajorityChecker> getSupermajorityChecker(
65 
66  } // namespace yac
67  } // namespace consensus
68 } // namespace iroha
69 
70 #endif // IROHA_CONSENSUS_SUPERMAJORITY_CHECKER_HPP
Definition: block_query.hpp:16
boost::any_range< PeersNumberType, boost::forward_traversal_tag, const PeersNumberType, std::ptrdiff_t > VoteGroups
Definition: supermajority_checker.hpp:39
size_t PeersNumberType
Type for number of peers in round.
Definition: yac_types.hpp:16
ConsistencyModel
Definition: consistency_model.hpp:13
std::unique_ptr< SupermajorityChecker > getSupermajorityChecker(ConsistencyModel c)
Get a SupermajorityChecker for the given consistency model.
Definition: supermajority_checker_getter.cpp:15
Definition: command_executor.hpp:12
Definition: supermajority_checker.hpp:31