Kagome
Polkadot Runtime Engine in C++17
kagome::network::SyncProtocol Class Referenceabstract

Class for communication via /{chainType}/sync/2 according to sync protocol specification https://spec.polkadot.network/#sect-msg-block-request. More...

#include <sync_protocol.hpp>

Inheritance diagram for kagome::network::SyncProtocol:
Collaboration diagram for kagome::network::SyncProtocol:

Public Member Functions

virtual void request (const PeerId &peer_id, BlocksRequest block_request, std::function< void(outcome::result< BlocksResponse >)> &&response_handler)=0
 Make async request to peer and return response in callback. More...
 
- Public Member Functions inherited from kagome::network::ProtocolBase
 ProtocolBase ()=default
 
 ProtocolBase (ProtocolBase &&) noexcept=delete
 
 ProtocolBase (const ProtocolBase &)=delete
 
virtual ~ProtocolBase ()=default
 
ProtocolBaseoperator= (ProtocolBase &&) noexcept=delete
 
ProtocolBaseoperator= (ProtocolBase const &)=delete
 
virtual const std::string & protocolName () const =0
 
virtual bool start ()=0
 
virtual bool stop ()=0
 
virtual void onIncomingStream (std::shared_ptr< Stream > stream)=0
 
virtual void newOutgoingStream (const PeerInfo &peer_info, std::function< void(outcome::result< std::shared_ptr< Stream >>)> &&cb)=0
 

Detailed Description

Class for communication via /{chainType}/sync/2 according to sync protocol specification https://spec.polkadot.network/#sect-msg-block-request.

Definition at line 32 of file sync_protocol.hpp.

Member Function Documentation

virtual void kagome::network::SyncProtocol::request ( const PeerId peer_id,
BlocksRequest  block_request,
std::function< void(outcome::result< BlocksResponse >)> &&  response_handler 
)
pure virtual

Make async request to peer and return response in callback.

Parameters
peer_idof a peer to make request to
block_requesta request content
response_handlera callback to call when response received

Implemented in kagome::network::SyncProtocolImpl.


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