CatapultServer  v0.5.0.1 (Elephant)
catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker > Class Template Reference
Inheritance diagram for catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >:
Collaboration diagram for catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >:

Classes

class  NodeRequest
 

Public Types

using ResponseType = typename TRequestPolicy::ResponseType
 Remote node response type. More...
 
using CallbackType = consumer< NodeRequestResult, const ResponseType & >
 Request completion callback type. More...
 

Public Member Functions

 BriefServerRequestor (const std::shared_ptr< thread::IoThreadPool > &pPool, const crypto::KeyPair &keyPair, const ConnectionSettings &settings, const TResponseCompatibilityChecker &responseCompatibilityChecker)
 
size_t numActiveConnections () const
 Gets the number of active connections. More...
 
size_t numTotalRequests () const
 Gets the number of total requests. More...
 
size_t numSuccessfulRequests () const
 Gets the number of successful requests. More...
 
void beginRequest (const ionet::Node &node, const CallbackType &callback)
 Initiates a request for data from node and calls callback on completion. More...
 
void shutdown ()
 Shuts down all connections. More...
 

Private Attributes

std::shared_ptr< thread::IoThreadPoolm_pPool
 
TResponseCompatibilityChecker m_responseCompatibilityChecker
 
utils::TimeSpan m_requestTimeout
 
std::shared_ptr< ServerConnectorm_pConnector
 
std::atomic< size_t > m_numTotalRequests
 
std::atomic< size_t > m_numSuccessfulRequests
 

Detailed Description

template<typename TRequestPolicy, typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
class catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >

Establishes timed, short-term connections with external nodes for single requests that this (local) node initiates.

Note
Connections are ephemeral and intended to be used for a single request then response operation.

Member Typedef Documentation

◆ CallbackType

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
using catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::CallbackType = consumer<NodeRequestResult, const ResponseType&>

Request completion callback type.

◆ ResponseType

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
using catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::ResponseType = typename TRequestPolicy::ResponseType

Remote node response type.

Constructor & Destructor Documentation

◆ BriefServerRequestor()

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::BriefServerRequestor ( const std::shared_ptr< thread::IoThreadPool > &  pPool,
const crypto::KeyPair keyPair,
const ConnectionSettings settings,
const TResponseCompatibilityChecker &  responseCompatibilityChecker 
)
inline

Creates a server requestor for a server with a key pair of keyPair using pPool and configured with settings and a custom response compatibility checker (responseCompatibilityChecker).

Member Function Documentation

◆ beginRequest()

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
void catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::beginRequest ( const ionet::Node node,
const CallbackType callback 
)
inline

Initiates a request for data from node and calls callback on completion.

◆ numActiveConnections()

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
size_t catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::numActiveConnections ( ) const
inline

Gets the number of active connections.

◆ numSuccessfulRequests()

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
size_t catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::numSuccessfulRequests ( ) const
inline

Gets the number of successful requests.

◆ numTotalRequests()

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
size_t catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::numTotalRequests ( ) const
inline

Gets the number of total requests.

◆ shutdown()

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
void catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::shutdown ( )
inline

Shuts down all connections.

Member Data Documentation

◆ m_numSuccessfulRequests

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
std::atomic<size_t> catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::m_numSuccessfulRequests
private

◆ m_numTotalRequests

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
std::atomic<size_t> catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::m_numTotalRequests
private

◆ m_pConnector

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
std::shared_ptr<ServerConnector> catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::m_pConnector
private

◆ m_pPool

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
std::shared_ptr<thread::IoThreadPool> catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::m_pPool
private

◆ m_requestTimeout

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
utils::TimeSpan catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::m_requestTimeout
private

◆ m_responseCompatibilityChecker

template<typename TRequestPolicy , typename TResponseCompatibilityChecker = detail::AlwaysCompatibleResponseCompatibilityChecker>
TResponseCompatibilityChecker catapult::net::BriefServerRequestor< TRequestPolicy, TResponseCompatibilityChecker >::m_responseCompatibilityChecker
private

The documentation for this class was generated from the following file: