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  class BlockLoaderImpl : public BlockLoader {
22  public:
23  // TODO 30.01.2019 lebdron: IR-264 Remove PeerQueryFactory
25  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory,
27  logger::LoggerPtr log);
28 
29  rxcpp::observable<std::shared_ptr<shared_model::interface::Block>>
31  shared_model::interface::types::PublicKeyHexStringView
32  peer_pubkey) override;
33 
34  boost::optional<std::shared_ptr<shared_model::interface::Block>>
36  shared_model::interface::types::PublicKeyHexStringView peer_pubkey,
37  shared_model::interface::types::HeightType block_height) override;
38 
39  private:
46  boost::optional<std::shared_ptr<shared_model::interface::Peer>> findPeer(
47  shared_model::interface::types::PublicKeyHexStringView pubkey);
53  proto::Loader::StubInterface &getPeerStub(
54  const shared_model::interface::Peer &peer);
55 
57  std::unique_ptr<proto::Loader::StubInterface>>
58  peer_connections_;
59  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory_;
61 
62  logger::LoggerPtr log_;
63  };
64  } // namespace network
65 } // namespace iroha
66 
67 #endif // IROHA_BLOCK_LOADER_IMPL_HPP
std::string AddressType
Type of peer address.
Definition: types.hpp:50
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
boost::optional< std::shared_ptr< shared_model::interface::Block > > retrieveBlock(shared_model::interface::types::PublicKeyHexStringView peer_pubkey, shared_model::interface::types::HeightType block_height) override
Definition: block_loader_impl.cpp:75
Definition: peer.hpp:20
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_loader.hpp:20
Definition: block_query.hpp:15
BlockLoaderImpl(std::shared_ptr< ametsuchi::PeerQueryFactory > peer_query_factory, shared_model::proto::ProtoBlockFactory factory, logger::LoggerPtr log)
Definition: block_loader_impl.cpp:30
Definition: block_loader_impl.hpp:21
rxcpp::observable< std::shared_ptr< shared_model::interface::Block > > retrieveBlocks(const shared_model::interface::types::HeightType height, shared_model::interface::types::PublicKeyHexStringView peer_pubkey) override
Definition: block_loader_impl.cpp:38
Definition: proto_block_factory.hpp:21