CatapultServer  v0.5.0.1 (Elephant)
RemoteChainApi.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ChainApi.h"
23 #include "RemoteApi.h"
24 
25 namespace catapult {
26  namespace ionet { class PacketIo; }
27  namespace model { class TransactionRegistry; }
28 }
29 
30 namespace catapult { namespace api {
31 
36  {}
37 
40  BlocksFromOptions(uint32_t numBlocks, uint32_t numBytes)
41  : NumBlocks(numBlocks)
42  , NumBytes(numBytes)
43  {}
44 
46  uint32_t NumBlocks;
47 
49  uint32_t NumBytes;
50  };
51 
53  class RemoteChainApi : public RemoteApi, public ChainApi {
54  protected:
57  {}
58 
59  public:
62 
65 
68  virtual thread::future<model::BlockRange> blocksFrom(Height height, const BlocksFromOptions& options) const = 0;
69  };
70 
72  std::unique_ptr<ChainApi> CreateRemoteChainApiWithoutRegistry(ionet::PacketIo& io);
73 
76  std::unique_ptr<RemoteChainApi> CreateRemoteChainApi(
77  ionet::PacketIo& io,
78  const Key& remotePublicKey,
79  const model::TransactionRegistry& registry);
80 }}
catapult::api::RemoteChainApi::blockAt
virtual thread::future< std::shared_ptr< const model::Block > > blockAt(Height height) const =0
Gets the block at height.
catapult::api::CreateRemoteChainApi
std::unique_ptr< RemoteChainApi > CreateRemoteChainApi(ionet::PacketIo &io, const Key &remotePublicKey, const model::TransactionRegistry &registry)
Definition: RemoteChainApi.cpp:164
catapult::api::BlocksFromOptions::BlocksFromOptions
BlocksFromOptions(uint32_t numBlocks, uint32_t numBytes)
Definition: RemoteChainApi.h:40
PacketEntityUtils.h
m_impl
RemoteRequestDispatcher m_impl
Definition: RemoteChainApi.cpp:155
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::api::ChainApi
An api for retrieving chain information from a node.
Definition: ChainApi.h:40
ChainApi.h
catapult::api::BlocksFromOptions::NumBytes
uint32_t NumBytes
Requested number of bytes.
Definition: RemoteChainApi.h:49
RemoteApi.h
Friendly_Name
static constexpr auto Friendly_Name
Definition: RemoteChainApi.cpp:36
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::api::BlocksFromOptions::BlocksFromOptions
BlocksFromOptions()
Creates blocks-from options.
Definition: RemoteChainApi.h:35
catapult::api::CreateRemoteChainApiWithoutRegistry
std::unique_ptr< ChainApi > CreateRemoteChainApiWithoutRegistry(ionet::PacketIo &io)
Creates a chain api for interacting with a remote node with the specified io.
Definition: RemoteChainApi.cpp:159
catapult::api::RegistryDependentTraits::RegistryDependentTraits
RegistryDependentTraits(const model::TransactionRegistry &registry)
Creates traits around registry.
Definition: RemoteApiUtils.h:34
catapult::ionet::PacketIo
An interface for reading and writing packets.
Definition: PacketIo.h:31
catapult::api::RemoteChainApi::blocksFrom
virtual thread::future< model::BlockRange > blocksFrom(Height height, const BlocksFromOptions &options) const =0
catapult::api::BlocksFromOptions::NumBlocks
uint32_t NumBlocks
Requested number of blocks.
Definition: RemoteChainApi.h:46
catapult::thread::future
Provides a way to access the result of an asynchronous operation.
Definition: Future.h:29
m_pRegistry
const model::TransactionRegistry * m_pRegistry
Definition: RemoteChainApi.cpp:154
catapult::api::RemoteApi::remotePublicKey
const Key & remotePublicKey() const
Gets the remote node public key.
Definition: RemoteApi.h:38
catapult::model::HashRange
EntityRange< Hash256 > HashRange
An entity range composed of hashes.
Definition: RangeTypes.h:35
catapult::api::RemoteChainApi::blockLast
virtual thread::future< std::shared_ptr< const model::Block > > blockLast() const =0
Gets the last block.
ChainPackets.h
catapult::model::BlockRange
EntityRange< Block > BlockRange
An entity range composed of blocks.
Definition: RangeTypes.h:29
ChainScore
model::ChainScore ChainScore
Definition: tools/health/main.cpp:43
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::api::RemoteApi
An api for retrieving information from a remote node.
Definition: RemoteApi.h:27
catapult::model::TransactionRegistry
A registry of transaction plugins.
Definition: TransactionPlugin.h:98
Packet_Type
static constexpr auto Packet_Type
Definition: RemoteChainApi.cpp:35
RemoteRequestDispatcher.h
catapult::utils::ByteArray
Base class for wrappers of byte array types, to provide some type-safety.
Definition: ByteArray.h:29
catapult::api::RemoteChainApi::RemoteChainApi
RemoteChainApi(const Key &remotePublicKey)
Creates a remote api for the node with specified public key (remotePublicKey).
Definition: RemoteChainApi.h:56
RemoteChainApi.h
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
RemoteApiUtils.h
catapult::api::BlocksFromOptions
Options for a blocks-from request.
Definition: RemoteChainApi.h:33
catapult::api::RemoteChainApi
An api for retrieving chain information from a remote node.
Definition: RemoteChainApi.h:53