hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
cluster_order.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_CLUSTER_ORDER_HPP
7 #define IROHA_CLUSTER_ORDER_HPP
8 
9 #include <memory>
10 #include <vector>
11 
12 #include <boost/optional.hpp>
14 
15 namespace shared_model {
16  namespace interface {
17  class Peer;
18  }
19 } // namespace shared_model
20 
21 namespace iroha {
22  namespace consensus {
23  namespace yac {
24 
29  public:
35  static boost::optional<ClusterOrdering> create(
36  const std::vector<std::shared_ptr<shared_model::interface::Peer>>
37  &order);
38 
42  const shared_model::interface::Peer &currentLeader();
43 
48  ClusterOrdering &switchToNext();
49 
53  bool hasNext() const;
54 
55  const std::vector<std::shared_ptr<shared_model::interface::Peer>>
56  &getPeers() const;
57 
58  PeersNumberType getNumberOfPeers() const;
59 
60  virtual ~ClusterOrdering() = default;
61 
62  ClusterOrdering() = delete;
63 
64  private:
65  // prohibit creation of the object not from create method
66  explicit ClusterOrdering(
67  std::vector<std::shared_ptr<shared_model::interface::Peer>> order);
68 
69  std::vector<std::shared_ptr<shared_model::interface::Peer>> order_;
70  PeersNumberType index_ = 0;
71  };
72  } // namespace yac
73  } // namespace consensus
74 } // namespace iroha
75 #endif // IROHA_CLUSTER_ORDER_HPP
Definition: cluster_order.hpp:28
Definition: peer.hpp:18
Definition: block_query.hpp:14
size_t PeersNumberType
Type for number of peers in round.
Definition: yac_types.hpp:16
Definition: command_executor.hpp:12