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

#include <synchronizer.hpp>

Inheritance diagram for kagome::network::Synchronizer:
Collaboration diagram for kagome::network::Synchronizer:

Public Types

using SyncResultHandler = std::function< void(outcome::result< primitives::BlockInfo >)>
 

Public Member Functions

virtual ~Synchronizer ()=default
 
virtual bool syncByBlockInfo (const primitives::BlockInfo &block_info, const libp2p::peer::PeerId &peer_id, SyncResultHandler &&handler, bool subscribe_to_block)=0
 
virtual bool syncByBlockHeader (const primitives::BlockHeader &header, const libp2p::peer::PeerId &peer_id, SyncResultHandler &&handler)=0
 
virtual void syncMissingJustifications (const libp2p::peer::PeerId &peer_id, primitives::BlockInfo target_block, std::optional< uint32_t > limit, SyncResultHandler &&handler)=0
 
virtual void syncState (const libp2p::peer::PeerId &peer_id, const primitives::BlockInfo &block, SyncResultHandler &&handler)=0
 
virtual bool hasIncompleteRequestOfStateSync () const =0
 

Detailed Description

Definition at line 18 of file synchronizer.hpp.

Member Typedef Documentation

using kagome::network::Synchronizer::SyncResultHandler = std::function<void(outcome::result<primitives::BlockInfo>)>

Definition at line 21 of file synchronizer.hpp.

Constructor & Destructor Documentation

virtual kagome::network::Synchronizer::~Synchronizer ( )
virtualdefault

Member Function Documentation

virtual bool kagome::network::Synchronizer::hasIncompleteRequestOfStateSync ( ) const
pure virtual
virtual bool kagome::network::Synchronizer::syncByBlockHeader ( const primitives::BlockHeader header,
const libp2p::peer::PeerId &  peer_id,
SyncResultHandler &&  handler 
)
pure virtual

Try to load and apply block with header {

Parameters
block_header}from peer {
peer_id}.If provided block is the best after applying, {
handler}be called
Returns
true if sync is ran (peer is not busy)
Note
Is used for finish catching up if it possible, and start/continue than otherwise

Implemented in kagome::network::SynchronizerImpl.

virtual bool kagome::network::Synchronizer::syncByBlockInfo ( const primitives::BlockInfo block_info,
const libp2p::peer::PeerId &  peer_id,
SyncResultHandler &&  handler,
bool  subscribe_to_block 
)
pure virtual

Enqueues loading (and applying) blocks from peer {

Parameters
peer_id}since best common block up to provided {
block_info}.{
handler}will be called when this process is finished or failed
Returns
true if sync is ran (peer is not busy)
Note
Is used for start/continue catching up.

Implemented in kagome::network::SynchronizerImpl.

virtual void kagome::network::Synchronizer::syncMissingJustifications ( const libp2p::peer::PeerId &  peer_id,
primitives::BlockInfo  target_block,
std::optional< uint32_t >  limit,
SyncResultHandler &&  handler 
)
pure virtual

Tries to request block justifications from {

Parameters
peer_id}for {
target_block}or a range of blocks up to {
limit}count. Calls {
handler}when operation finishes

Implemented in kagome::network::SynchronizerImpl.

virtual void kagome::network::Synchronizer::syncState ( const libp2p::peer::PeerId &  peer_id,
const primitives::BlockInfo block,
SyncResultHandler &&  handler 
)
pure virtual

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