hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
on_demand_ordering_init.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ON_DEMAND_ORDERING_INIT_HPP
7 #define IROHA_ON_DEMAND_ORDERING_INIT_HPP
8 
9 #include <rxcpp/rx-lite.hpp>
10 #include "ametsuchi/storage.hpp"
13 #include "logger/logger_fwd.hpp"
18 #include "ordering.grpc.pb.h"
23 
24 namespace iroha {
25  namespace network {
26 
31  public:
32  using TransportFactoryType =
35  iroha::protocol::Proposal>;
36 
37  private:
42  auto createNotificationFactory(
44  async_call,
45  std::shared_ptr<TransportFactoryType> proposal_transport_factory,
46  std::chrono::milliseconds delay,
47  const logger::LoggerManagerTreePtr &ordering_log_manager);
48 
54  auto createConnectionManager(
56  async_call,
57  std::shared_ptr<TransportFactoryType> proposal_transport_factory,
58  std::chrono::milliseconds delay,
59  std::vector<shared_model::interface::types::HashType> initial_hashes,
60  const logger::LoggerManagerTreePtr &ordering_log_manager);
61 
66  auto createGate(
67  std::shared_ptr<ordering::OnDemandOrderingService> ordering_service,
68  std::unique_ptr<ordering::transport::OdOsNotification> network_client,
69  std::shared_ptr<ordering::cache::OrderingGateCache> cache,
70  std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
71  proposal_factory,
72  std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache,
73  std::shared_ptr<ordering::ProposalCreationStrategy> creation_strategy,
74  size_t max_number_of_transactions,
75  const logger::LoggerManagerTreePtr &ordering_log_manager);
76 
81  auto createService(
82  size_t max_number_of_transactions,
83  std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
84  proposal_factory,
85  std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache,
86  std::shared_ptr<ordering::ProposalCreationStrategy> creation_strategy,
87  const logger::LoggerManagerTreePtr &ordering_log_manager);
88 
89  rxcpp::composite_subscription sync_event_notifier_lifetime_;
90  rxcpp::composite_subscription commit_notifier_lifetime_;
91 
92  public:
96 
98 
121  std::shared_ptr<network::OrderingGate> initOrderingGate(
122  size_t max_number_of_transactions,
123  std::chrono::milliseconds delay,
124  std::vector<shared_model::interface::types::HashType> initial_hashes,
125  std::shared_ptr<
127  transaction_factory,
128  std::shared_ptr<shared_model::interface::TransactionBatchParser>
129  batch_parser,
130  std::shared_ptr<shared_model::interface::TransactionBatchFactory>
131  transaction_batch_factory,
133  async_call,
134  std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
135  proposal_factory,
136  std::shared_ptr<TransportFactoryType> proposal_transport_factory,
137  std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache,
138  std::shared_ptr<ordering::ProposalCreationStrategy> creation_strategy,
139  logger::LoggerManagerTreePtr ordering_log_manager);
140 
142  std::shared_ptr<ordering::proto::OnDemandOrdering::Service> service;
143 
145  rxcpp::subjects::subject<decltype(std::declval<PeerCommunicationService>()
146  .onSynchronization())::value_type>
148  rxcpp::subjects::subject<decltype(
149  std::declval<iroha::ametsuchi::Storage>().on_commit())::value_type>
151 
152  private:
153  logger::LoggerPtr log_;
154 
155  std::vector<std::shared_ptr<shared_model::interface::Peer>>
156  current_peers_;
157 
159  enum RoundType { kCurrentRound, kNextRound, kRoundAfterNext, kCount };
160 
161  template <RoundType V>
162  using RoundTypeConstant = std::integral_constant<RoundType, V>;
163 
165  std::array<std::vector<size_t>, kCount> permutations_;
166  };
167  } // namespace network
168 } // namespace iroha
169 
170 #endif // IROHA_ON_DEMAND_ORDERING_INIT_HPP
OnDemandOrderingInit(logger::LoggerPtr log)
Definition: on_demand_ordering_init.cpp:34
~OnDemandOrderingInit()
Definition: on_demand_ordering_init.cpp:262
Definition: proposal.hpp:17
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:15
std::shared_ptr< network::OrderingGate > initOrderingGate(size_t max_number_of_transactions, std::chrono::milliseconds delay, std::vector< shared_model::interface::types::HashType > initial_hashes, std::shared_ptr< ordering::transport::OnDemandOsServerGrpc::TransportFactoryType > transaction_factory, std::shared_ptr< shared_model::interface::TransactionBatchParser > batch_parser, std::shared_ptr< shared_model::interface::TransactionBatchFactory > transaction_batch_factory, std::shared_ptr< network::AsyncGrpcClient< google::protobuf::Empty >> async_call, std::shared_ptr< shared_model::interface::UnsafeProposalFactory > proposal_factory, std::shared_ptr< TransportFactoryType > proposal_transport_factory, std::shared_ptr< ametsuchi::TxPresenceCache > tx_cache, std::shared_ptr< ordering::ProposalCreationStrategy > creation_strategy, logger::LoggerManagerTreePtr ordering_log_manager)
Definition: on_demand_ordering_init.cpp:268
std::shared_ptr< LoggerManagerTree > LoggerManagerTreePtr
Definition: logger_manager_fwd.hpp:14
Definition: on_demand_ordering_init.hpp:30
Definition: async_grpc_client.hpp:25
std::shared_ptr< ordering::proto::OnDemandOrdering::Service > service
gRPC service for ordering service
Definition: on_demand_ordering_init.hpp:142
rxcpp::subjects::subject< decltype(std::declval< PeerCommunicationService >) .onSynchronization())::value_type > sync_event_notifier
commit notifier from peer communication service
Definition: on_demand_ordering_init.hpp:147
rxcpp::subjects::subject< decltype(std::declval< iroha::ametsuchi::Storage >).on_commit())::value_type > commit_notifier
Definition: on_demand_ordering_init.hpp:150