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 <optional>
11 #include <vector>
12 
15 
21  public:
28  static std::optional<ClusterOrdering> create(
29  std::vector<std::shared_ptr<shared_model::interface::Peer>> const
30  &order,
31  std::vector<size_t> const &peer_positions);
32 
38  static std::optional<ClusterOrdering> create(
39  std::vector<std::shared_ptr<shared_model::interface::Peer>> const
40  &order);
41 
46 
52 
56  bool hasNext() const;
57 
59 
61 
62  virtual ~ClusterOrdering() = default;
63 
64  ClusterOrdering() = delete;
65 
66  private:
67  // prohibit creation of the object not from create method
68  explicit ClusterOrdering(
69  std::vector<std::shared_ptr<shared_model::interface::Peer>> const
70  &order,
71  std::vector<size_t> const &peer_positions);
72 
73  explicit ClusterOrdering(
74  std::vector<std::shared_ptr<shared_model::interface::Peer>> const
75  &order);
76 
77  std::vector<std::shared_ptr<shared_model::interface::Peer>> order_;
78  PeersNumberType index_ = 0;
79  };
80 } // namespace iroha::consensus::yac
81 
82 #endif // IROHA_CLUSTER_ORDER_HPP
const shared_model::interface::types::PeerList & getPeers() const
Definition: cluster_order.cpp:62
Definition: cluster_order.hpp:20
Definition: peer.hpp:20
static std::optional< ClusterOrdering > create(std::vector< std::shared_ptr< shared_model::interface::Peer >> const &order, std::vector< size_t > const &peer_positions)
Definition: cluster_order.cpp:12
ClusterOrdering & switchToNext()
Definition: cluster_order.cpp:57
size_t PeersNumberType
Type for number of peers in round.
Definition: yac_types.hpp:13
bool hasNext() const
Definition: cluster_order.cpp:53
PeersNumberType getNumberOfPeers() const
Definition: cluster_order.cpp:67
const shared_model::interface::Peer & currentLeader()
Definition: cluster_order.cpp:46
std::vector< std::shared_ptr< shared_model::interface::Peer > > PeerList
Type of peers collection.
Definition: types.hpp:95
Definition: cluster_order.hpp:16