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 
15 #include "loader.grpc.pb.h"
16 #include "logger/logger_fwd.hpp"
17 
18 namespace iroha {
19  namespace network {
20  class BlockLoaderImpl : public BlockLoader {
21  public:
22  // TODO 30.01.2019 lebdron: IR-264 Remove PeerQueryFactory
24  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory,
26  logger::LoggerPtr log);
27 
28  rxcpp::observable<std::shared_ptr<shared_model::interface::Block>>
31  const shared_model::crypto::PublicKey &peer_pubkey) override;
32 
33  boost::optional<std::shared_ptr<shared_model::interface::Block>>
35  const shared_model::crypto::PublicKey &peer_pubkey,
36  const shared_model::interface::types::HashType &block_hash) override;
37 
38  private:
45  boost::optional<std::shared_ptr<shared_model::interface::Peer>> findPeer(
46  const shared_model::crypto::PublicKey &pubkey);
52  proto::Loader::Stub &getPeerStub(
53  const shared_model::interface::Peer &peer);
54 
56  std::unique_ptr<proto::Loader::Stub>>
57  peer_connections_;
58  std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory_;
60 
61  logger::LoggerPtr log_;
62  };
63  } // namespace network
64 } // namespace iroha
65 
66 #endif // IROHA_BLOCK_LOADER_IMPL_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:39
Definition: hash.hpp:18
std::string AddressType
Type of peer address.
Definition: types.hpp:41
Definition: peer.hpp:18
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_loader.hpp:21
Definition: block_query.hpp:16
Definition: public_key.hpp:16
rxcpp::observable< std::shared_ptr< shared_model::interface::Block > > retrieveBlocks(const shared_model::interface::types::HeightType height, const shared_model::crypto::PublicKey &peer_pubkey) override
Definition: block_loader_impl.cpp:38
BlockLoaderImpl(std::shared_ptr< ametsuchi::PeerQueryFactory > peer_query_factory, shared_model::proto::ProtoBlockFactory factory, logger::LoggerPtr log)
Definition: block_loader_impl.cpp:30
boost::optional< std::shared_ptr< shared_model::interface::Block > > retrieveBlock(const shared_model::crypto::PublicKey &peer_pubkey, const shared_model::interface::types::HashType &block_hash) override
Definition: block_loader_impl.cpp:81
Definition: block_loader_impl.hpp:20
Definition: proto_block_factory.hpp:20