Kagome
Polkadot Runtime Engine in C++17
|
#include <request_response_protocol.hpp>
Public Types | |
using | RequestType = Request |
using | ResponseType = Response |
using | ReadWriterType = ReadWriter |
Public Member Functions | |
RequestResponseProtocol (libp2p::Host &host, Protocol const &protocol, ProtocolName const &name) | |
virtual | ~RequestResponseProtocol () |
bool | start () override |
bool | stop () override |
const Protocol & | protocolName () const override |
void | doRequest (const PeerId &peer_id, RequestType request, std::function< void(outcome::result< ResponseType >)> &&response_handler) |
Public Member Functions inherited from kagome::network::ProtocolBase | |
ProtocolBase ()=default | |
ProtocolBase (ProtocolBase &&) noexcept=delete | |
ProtocolBase (const ProtocolBase &)=delete | |
virtual | ~ProtocolBase ()=default |
ProtocolBase & | operator= (ProtocolBase &&) noexcept=delete |
ProtocolBase & | operator= (ProtocolBase const &)=delete |
Protected Member Functions | |
virtual outcome::result< ResponseType > | onRxRequest (RequestType request, std::shared_ptr< Stream > stream)=0 |
virtual void | onTxRequest (RequestType const &request)=0 |
ProtocolBaseImpl & | base () |
Private Member Functions | |
void | onIncomingStream (std::shared_ptr< Stream > stream) override |
void | newOutgoingStream (const PeerInfo &peer_info, std::function< void(outcome::result< std::shared_ptr< Stream >>)> &&cb) override |
template<typename M > | |
void | write (std::shared_ptr< Stream > stream, M msg, std::function< void(outcome::result< void >, std::shared_ptr< Stream >)> &&cb) |
void | writeRequest (std::shared_ptr< Stream > stream, RequestType request, std::function< void(outcome::result< ResponseType >)> &&cb) |
void | writeResponse (std::shared_ptr< Stream > stream, ResponseType response) |
template<typename M > | |
void | read (std::shared_ptr< Stream > stream, std::function< void(outcome::result< M >, std::shared_ptr< Stream >)> &&cb) |
void | readResponse (std::shared_ptr< Stream > stream, std::function< void(outcome::result< ResponseType >)> &&cb) |
void | readRequest (std::shared_ptr< Stream > stream) |
Private Attributes | |
ProtocolBaseImpl | base_ |
Protocol const | protocol_ |
Friends | |
class | ProtocolBaseImpl |
Definition at line 18 of file request_response_protocol.hpp.
using kagome::network::RequestResponseProtocol< Request, Response, ReadWriter >::ReadWriterType = ReadWriter |
Definition at line 24 of file request_response_protocol.hpp.
using kagome::network::RequestResponseProtocol< Request, Response, ReadWriter >::RequestType = Request |
Definition at line 22 of file request_response_protocol.hpp.
using kagome::network::RequestResponseProtocol< Request, Response, ReadWriter >::ResponseType = Response |
Definition at line 23 of file request_response_protocol.hpp.
|
inline |
Definition at line 26 of file request_response_protocol.hpp.
|
inlinevirtual |
Definition at line 30 of file request_response_protocol.hpp.
|
inlineprotected |
Definition at line 90 of file request_response_protocol.hpp.
|
inline |
Definition at line 43 of file request_response_protocol.hpp.
|
inlineoverrideprivatevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 102 of file request_response_protocol.hpp.
|
inlineoverrideprivatevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 97 of file request_response_protocol.hpp.
|
protectedpure virtual |
|
protectedpure virtual |
|
inlineoverridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 39 of file request_response_protocol.hpp.
|
inlineprivate |
Definition at line 221 of file request_response_protocol.hpp.
|
inlineprivate |
Definition at line 278 of file request_response_protocol.hpp.
|
inlineprivate |
Definition at line 261 of file request_response_protocol.hpp.
|
inlineoverridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 32 of file request_response_protocol.hpp.
|
inlineoverridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 35 of file request_response_protocol.hpp.
|
inlineprivate |
Definition at line 139 of file request_response_protocol.hpp.
|
inlineprivate |
Definition at line 184 of file request_response_protocol.hpp.
|
inlineprivate |
Definition at line 205 of file request_response_protocol.hpp.
|
friend |
Definition at line 95 of file request_response_protocol.hpp.
|
private |
Definition at line 306 of file request_response_protocol.hpp.
|
private |
Definition at line 307 of file request_response_protocol.hpp.