hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
synchronizer_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SYNCHRONIZER_IMPL_HPP
7 #define IROHA_SYNCHRONIZER_IMPL_HPP
8 
10 
14 #include "common/result_fwd.hpp"
15 #include "logger/logger_fwd.hpp"
16 #include "network/block_loader.hpp"
18 
19 namespace iroha {
20 
21  namespace ametsuchi {
22  class BlockQueryFactory;
23  class CommandExecutor;
24  } // namespace ametsuchi
25 
26  namespace synchronizer {
27 
28  class SynchronizerImpl : public Synchronizer {
29  public:
31  std::unique_ptr<iroha::ametsuchi::CommandExecutor> command_executor,
32  std::shared_ptr<validation::ChainValidator> validator,
33  std::shared_ptr<ametsuchi::MutableFactory> mutable_factory,
34  std::shared_ptr<ametsuchi::BlockQueryFactory> block_query_factory,
35  std::shared_ptr<network::BlockLoader> block_loader,
36  logger::LoggerPtr log);
37 
38  std::optional<SynchronizationEvent> processOutcome(
39  consensus::GateObject object) override;
40 
41  private:
50  ametsuchi::CommitResult downloadAndCommitMissingBlocks(
54  &public_keys);
55 
56  std::optional<SynchronizationEvent> processNext(
57  const consensus::PairValid &msg);
58 
64  std::optional<SynchronizationEvent> processDifferent(
65  const consensus::Synchronizable &msg,
67 
69  std::string>
70  getStorage();
71 
72  std::shared_ptr<iroha::ametsuchi::CommandExecutor> command_executor_;
73 
74  std::shared_ptr<validation::ChainValidator> validator_;
75  std::shared_ptr<ametsuchi::MutableFactory> mutable_factory_;
76  std::shared_ptr<ametsuchi::BlockQueryFactory> block_query_factory_;
77  std::shared_ptr<network::BlockLoader> block_loader_;
78 
79  logger::LoggerPtr log_;
80  };
81 
82  } // namespace synchronizer
83 } // namespace iroha
84 
85 #endif // IROHA_SYNCHRONIZER_IMPL_HPP
Current pair is valid.
Definition: gate_object.hpp:35
Definition: block_query.hpp:17
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
Definition: synchronizer_impl.hpp:28
Definition: synchronizer.hpp:19
std::variant< PairValid, VoteOther, ProposalReject, BlockReject, AgreementOnNone, Future > GateObject
Definition: gate_object.hpp:96
Definition: result_fwd.hpp:27
std::vector< std::string > PublicKeyCollectionType
Type of public keys&#39; collection.
Definition: types.hpp:54
Definition: gate_object.hpp:45
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:15