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.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::Logger log = logger::log("YacGate"));
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  std::shared_ptr<HashGate> hash_gate_;
57  std::shared_ptr<YacPeerOrderer> orderer_;
58  std::shared_ptr<YacHashProvider> hash_provider_;
59  std::shared_ptr<simulator::BlockCreator> block_creator_;
60 
61  std::shared_ptr<consensus::ConsensusResultCache>
62  consensus_result_cache_;
63 
64  logger::Logger log_;
65 
66  boost::optional<std::shared_ptr<shared_model::interface::Block>>
67  current_block_;
68  YacHash current_hash_;
69  };
70 
71  } // namespace yac
72  } // namespace consensus
73 } // namespace iroha
74 
75 #endif // IROHA_YAC_GATE_IMPL_HPP
Definition: block_creator_common.hpp:33
Definition: yac_hash_provider.hpp:30
std::shared_ptr< spdlog::logger > Logger
Definition: logger.hpp:26
Definition: block_loader.hpp:21
Definition: block_query.hpp:16
Definition: yac_gate.hpp:21
Logger log(const std::string &tag)
Definition: logger.cpp:48
Definition: outcome_messages.hpp:45
Definition: block_creator.hpp:22
Definition: outcome_messages.hpp:22
Definition: yac_gate_impl.hpp:33