CatapultServer  v0.5.0.1 (Elephant)
RemoteNodeApi.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/ionet/Node.h"
23 #include "catapult/thread/Future.h"
24 
25 namespace catapult { namespace ionet { class PacketIo; } }
26 
27 namespace catapult { namespace api {
28 
30  class RemoteNodeApi {
31  public:
32  virtual ~RemoteNodeApi() = default;
33 
34  public:
36  virtual thread::future<ionet::Node> nodeInfo() const = 0;
37 
39  virtual thread::future<ionet::NodeSet> peersInfo() const = 0;
40  };
41 
43  std::unique_ptr<RemoteNodeApi> CreateRemoteNodeApi(ionet::PacketIo& io);
44 }}
catapult::validators::DEFINE_STATEFUL_VALIDATOR
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto &notification, const auto &context) { cache::ImportanceView view(context.Cache.template sub< cache::AccountStateCache >());return view.canHarvest(notification.Signer, context.Height) ? ValidationResult::Success :Failure_Core_Block_Harvester_Ineligible;})
catapult::api::CreateRemoteNodeApi
std::unique_ptr< RemoteNodeApi > CreateRemoteNodeApi(ionet::PacketIo &io)
Creates a node api for interacting with a remote node with the specified io.
Definition: RemoteNodeApi.cpp:87
catapult::nodediscovery::TryParseNodesPacket
bool TryParseNodesPacket(const ionet::Packet &packet, ionet::NodeSet &nodes)
Tries to parse packet into nodes.
Definition: NodePingUtils.cpp:39
catapult::api::RemoteNodeApi::~RemoteNodeApi
virtual ~RemoteNodeApi()=default
catapult::UnresolvedAddress
utils::ByteArray< Address_Decoded_Size, UnresolvedAddress_tag > UnresolvedAddress
Definition: src/catapult/types.h:66
catapult::state::IsRemote
bool IsRemote(AccountType accountType)
Returns true if accountType corresponds to a remote account.
Definition: AccountState.cpp:41
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
ValidatorContext.h
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::api::RemoteNodeApi
An api for retrieving node information from a remote node.
Definition: RemoteNodeApi.h:30
RemoteNodeApi.h
Friendly_Name
static constexpr auto Friendly_Name
Definition: RemoteNodeApi.cpp:34
Packet_Type
static constexpr auto Packet_Type
Definition: RemoteNodeApi.cpp:33
catapult::ionet::PacketIo
An interface for reading and writing packets.
Definition: PacketIo.h:31
catapult::nodediscovery::TryParseNodePacket
bool TryParseNodePacket(const ionet::Packet &packet, ionet::Node &node)
Tries to parse packet into node.
Definition: NodePingUtils.cpp:28
catapult::ionet::NodeSet
std::unordered_set< Node, NodeHasher > NodeSet
A set of nodes.
Definition: Node.h:128
catapult::thread::future
Provides a way to access the result of an asynchronous operation.
Definition: Future.h:29
Node.h
m_impl
RemoteRequestDispatcher m_impl
Definition: RemoteNodeApi.cpp:83
AccountStateCache.h
catapult::api::RemoteNodeApi::peersInfo
virtual thread::future< ionet::NodeSet > peersInfo() const =0
Gets information about the node's peers.
AccountState.h
catapult::Address
utils::ByteArray< Address_Decoded_Size, Address_tag > Address
Definition: src/catapult/types.h:63
catapult::api::RemoteNodeApi::nodeInfo
virtual thread::future< ionet::Node > nodeInfo() const =0
Gets information about the node.
catapult::validators::ValidationResult::Success
Validation succeeded.
Node
ionet::Node Node
Definition: PacketWriters.cpp:45
catapult
Definition: AddressExtractionExtension.cpp:28
NodePingUtils.h
AccountLinkTransaction.h
Future.h
RemoteRequestDispatcher.h
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41