hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
consensus_init.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_CONSENSUS_INIT_HPP
7 #define IROHA_CONSENSUS_INIT_HPP
8 
9 #include <memory>
10 #include <string>
11 #include <vector>
12 
16 #include "consensus/yac/timer.hpp"
18 #include "consensus/yac/yac.hpp"
22 #include "cryptography/keypair.hpp"
24 #include "network/block_loader.hpp"
26 
27 namespace iroha {
28  namespace consensus {
29  namespace yac {
30 
31  class YacInit {
32  private:
33  // ----------| Yac dependencies |----------
34 
35  auto createPeerOrderer(
36  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory);
37 
38  auto createNetwork(std::shared_ptr<iroha::network::AsyncGrpcClient<
39  google::protobuf::Empty>> async_call);
40 
41  auto createCryptoProvider(
42  const shared_model::crypto::Keypair &keypair,
43  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
44  common_objects_factory);
45 
46  auto createTimer(std::chrono::milliseconds delay_milliseconds);
47 
48  auto createHashProvider();
49 
50  std::shared_ptr<consensus::yac::Yac> createYac(
51  ClusterOrdering initial_order,
52  const shared_model::crypto::Keypair &keypair,
53  std::chrono::milliseconds delay_milliseconds,
54  std::shared_ptr<
56  async_call,
57  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
58  common_objects_factory);
59 
60  // coordinator has a worker, and a factory for coordinated
61  // observables, subscribers and schedulable functions.
62  //
63  // A new thread scheduler is created
64  // by calling .create_coordinator().get_scheduler()
65  rxcpp::observe_on_one_worker coordination_{
66  rxcpp::observe_on_new_thread()};
67 
68  public:
69  std::shared_ptr<YacGate> initConsensusGate(
70  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory,
71  std::shared_ptr<simulator::BlockCreator> block_creator,
72  std::shared_ptr<network::BlockLoader> block_loader,
73  const shared_model::crypto::Keypair &keypair,
74  std::shared_ptr<consensus::ConsensusResultCache> block_cache,
75  std::chrono::milliseconds vote_delay_milliseconds,
76  std::shared_ptr<
78  async_call,
79  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
80  common_objects_factory);
81 
82  std::shared_ptr<NetworkImpl> consensus_network;
83  };
84  } // namespace yac
85  } // namespace consensus
86 } // namespace iroha
87 
88 #endif // IROHA_CONSENSUS_INIT_HPP
Definition: cluster_order.hpp:28
Definition: consensus_init.hpp:31
Definition: keypair.hpp:19
Definition: block_query.hpp:16
std::shared_ptr< NetworkImpl > consensus_network
Definition: consensus_init.hpp:82
std::shared_ptr< YacGate > initConsensusGate(std::shared_ptr< ametsuchi::PeerQueryFactory > peer_query_factory, std::shared_ptr< simulator::BlockCreator > block_creator, std::shared_ptr< network::BlockLoader > block_loader, const shared_model::crypto::Keypair &keypair, std::shared_ptr< consensus::ConsensusResultCache > block_cache, std::chrono::milliseconds vote_delay_milliseconds, std::shared_ptr< iroha::network::AsyncGrpcClient< google::protobuf::Empty >> async_call, std::shared_ptr< shared_model::interface::CommonObjectsFactory > common_objects_factory)
Definition: consensus_init.cpp:80
Definition: async_grpc_client.hpp:25