hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
block_loader.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_BLOCK_LOADER_HPP
7 #define IROHA_BLOCK_LOADER_HPP
8 
9 #include <memory>
10 #include <variant>
11 
14 
15 namespace iroha {
16  namespace network {
17  class BlockReader {
18  public:
23  struct iteration_complete {};
24  virtual std::variant<
26  std::shared_ptr<const shared_model::interface::Block>,
27  std::string>
28  read() = 0;
29 
30  virtual ~BlockReader() = default;
31  };
32 
36  class BlockLoader {
37  public:
44  virtual expected::Result<std::unique_ptr<BlockReader>> retrieveBlocks(
46  shared_model::interface::types::PublicKeyHexStringView
47  peer_pubkey) = 0;
48 
57  std::unique_ptr<shared_model::interface::Block>,
58  std::string>
59  retrieveBlock(
60  shared_model::interface::types::PublicKeyHexStringView peer_pubkey,
62 
63  virtual ~BlockLoader() = default;
64  };
65  } // namespace network
66 } // namespace iroha
67 
68 #endif // IROHA_BLOCK_LOADER_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
Definition: block_loader.hpp:17
Definition: result_fwd.hpp:27
Definition: block_loader.hpp:36
Definition: block_query.hpp:15
virtual std::variant< iteration_complete, std::shared_ptr< const shared_model::interface::Block >, std::string > read()=0
virtual ~BlockReader()=default