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 
37  rxcpp::observable<std::shared_ptr<shared_model::interface::Block>>,
38  std::string>
40  shared_model::interface::types::PublicKeyHexStringView
41  peer_pubkey) override;
42 
44  std::string>
46  shared_model::interface::types::PublicKeyHexStringView peer_pubkey,
47  shared_model::interface::types::HeightType block_height) override;
48 
49  private:
56  std::string>
57  findPeer(shared_model::interface::types::PublicKeyHexStringView pubkey);
58 
59  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory_;
60  std::shared_ptr<shared_model::proto::ProtoBlockFactory> block_factory_;
61  std::shared_ptr<ClientFactory> client_factory_;
62 
63  logger::LoggerPtr log_;
64  };
65  } // namespace network
66 } // namespace iroha
67 
68 #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:28
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
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:80
Definition: block_loader.hpp:20
iroha::expected::Result< rxcpp::observable< std::shared_ptr< shared_model::interface::Block > >, std::string > retrieveBlocks(const shared_model::interface::types::HeightType height, shared_model::interface::types::PublicKeyHexStringView peer_pubkey) override
Definition: block_loader_impl.cpp:39
Definition: block_query.hpp:15
Definition: block_loader_impl.hpp:24
Definition: mst_transport_grpc.hpp:29