hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
yac_gate_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_YAC_GATE_IMPL_HPP
7 #define IROHA_YAC_GATE_IMPL_HPP
8 
10 
11 #include <memory>
12 
15 #include "logger/logger_fwd.hpp"
16 
17 namespace iroha {
18 
19  namespace simulator {
20  class BlockCreator;
21  }
22 
23  namespace network {
24  class BlockLoader;
25  }
26 
27  namespace consensus {
28  namespace yac {
29 
30  struct CommitMessage;
31  class YacPeerOrderer;
32 
33  class YacGateImpl : public YacGate {
34  public:
35  YacGateImpl(std::shared_ptr<HashGate> hash_gate,
36  std::shared_ptr<YacPeerOrderer> orderer,
37  std::shared_ptr<YacHashProvider> hash_provider,
38  std::shared_ptr<simulator::BlockCreator> block_creator,
39  std::shared_ptr<consensus::ConsensusResultCache>
40  consensus_result_cache,
41  logger::LoggerPtr log);
42  void vote(const simulator::BlockCreatorEvent &event) override;
43 
44  rxcpp::observable<GateObject> onOutcome() override;
45 
46  private:
51  void copySignatures(const CommitMessage &commit);
52 
53  rxcpp::observable<GateObject> handleCommit(const CommitMessage &msg);
54  rxcpp::observable<GateObject> handleReject(const RejectMessage &msg);
55 
56  logger::LoggerPtr log_;
57 
58  boost::optional<std::shared_ptr<shared_model::interface::Block>>
59  current_block_;
60  YacHash current_hash_;
61  std::shared_ptr<LedgerState> current_ledger_state_;
62 
63  rxcpp::observable<GateObject> published_events_;
64  std::shared_ptr<YacPeerOrderer> orderer_;
65  std::shared_ptr<YacHashProvider> hash_provider_;
66  std::shared_ptr<simulator::BlockCreator> block_creator_;
67  std::shared_ptr<consensus::ConsensusResultCache>
68  consensus_result_cache_;
69  std::shared_ptr<HashGate> hash_gate_;
70  };
71 
72  } // namespace yac
73  } // namespace consensus
74 } // namespace iroha
75 
76 #endif // IROHA_YAC_GATE_IMPL_HPP
Definition: block_creator_common.hpp:34
Definition: yac_hash_provider.hpp:30
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_loader.hpp:21
Definition: block_query.hpp:16
Definition: yac_gate.hpp:21
Definition: outcome_messages.hpp:45
Definition: block_creator.hpp:22
Definition: outcome_messages.hpp:22
Definition: yac_gate_impl.hpp:33