hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
block_loader_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_BLOCK_LOADER_IMPL_HPP
7 #define IROHA_BLOCK_LOADER_IMPL_HPP
8 
10 
11 #include <unordered_map>
12 
16 #include "loader.grpc.pb.h"
17 #include "logger/logger_fwd.hpp"
18 
19 namespace iroha {
20  namespace network {
21  template <typename Service>
22  class ClientFactory;
23 
24  class BlockLoaderImpl : public BlockLoader {
25  public:
26  using Service = proto::Loader;
28 
29  // TODO 30.01.2019 lebdron: IR-264 Remove PeerQueryFactory
31  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory,
32  std::shared_ptr<shared_model::proto::ProtoBlockFactory> factory,
34  std::unique_ptr<ClientFactory> client_factory);
35 
38  shared_model::interface::types::PublicKeyHexStringView peer_pubkey)
39  override;
40 
42  std::string>
44  shared_model::interface::types::PublicKeyHexStringView peer_pubkey,
45  shared_model::interface::types::HeightType block_height) override;
46 
47  private:
54  std::string>
55  findPeer(shared_model::interface::types::PublicKeyHexStringView pubkey);
56 
57  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory_;
58  std::shared_ptr<shared_model::proto::ProtoBlockFactory> block_factory_;
59  std::shared_ptr<ClientFactory> client_factory_;
60 
61  logger::LoggerPtr log_;
62  };
63  } // namespace network
64 } // namespace iroha
65 
66 #endif // IROHA_BLOCK_LOADER_IMPL_HPP
BlockLoaderImpl(std::shared_ptr< ametsuchi::PeerQueryFactory > peer_query_factory, std::shared_ptr< shared_model::proto::ProtoBlockFactory > factory, logger::LoggerPtr log, std::unique_ptr< ClientFactory > client_factory)
Definition: block_loader_impl.cpp:80
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
proto::Loader Service
Definition: block_loader_impl.hpp:26
Definition: result_fwd.hpp:27
expected::Result< std::unique_ptr< BlockReader > > retrieveBlocks(const shared_model::interface::types::HeightType height, shared_model::interface::types::PublicKeyHexStringView peer_pubkey) override
Definition: block_loader_impl.cpp:90
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
iroha::expected::Result< std::unique_ptr< shared_model::interface::Block >, std::string > retrieveBlock(shared_model::interface::types::PublicKeyHexStringView peer_pubkey, shared_model::interface::types::HeightType block_height) override
Definition: block_loader_impl.cpp:112
Definition: block_loader.hpp:36
Definition: block_query.hpp:15
Definition: block_loader_impl.hpp:24
Definition: mst_transport_grpc.hpp:29