Kagome
Polkadot Runtime Engine in C++17
kagome::network::SyncProtocolObserverImpl Class Reference

#include <sync_protocol_observer_impl.hpp>

Inheritance diagram for kagome::network::SyncProtocolObserverImpl:
Collaboration diagram for kagome::network::SyncProtocolObserverImpl:

Public Types

enum  Error { Error::DUPLICATE_REQUEST_ID = 1 }
 

Public Member Functions

 SyncProtocolObserverImpl (std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< blockchain::BlockHeaderRepository > blocks_headers)
 
 ~SyncProtocolObserverImpl () override=default
 
outcome::result< BlocksResponseonBlocksRequest (const BlocksRequest &request) const override
 
- Public Member Functions inherited from kagome::network::SyncProtocolObserver
virtual ~SyncProtocolObserver ()=default
 

Private Member Functions

blockchain::BlockTree::BlockHashVecRes retrieveRequestedHashes (const network::BlocksRequest &request, const primitives::BlockHash &from_hash) const
 
void fillBlocksResponse (const network::BlocksRequest &request, network::BlocksResponse &response, const std::vector< primitives::BlockHash > &hash_chain) const
 

Private Attributes

std::shared_ptr< blockchain::BlockTreeblock_tree_
 
std::shared_ptr< blockchain::BlockHeaderRepositoryblocks_headers_
 
std::unordered_set< BlocksRequest::Fingerprintrequested_ids_
 
log::Logger log_
 

Detailed Description

Definition at line 22 of file sync_protocol_observer_impl.hpp.

Member Enumeration Documentation

Enumerator
DUPLICATE_REQUEST_ID 

Definition at line 26 of file sync_protocol_observer_impl.hpp.

Constructor & Destructor Documentation

kagome::network::SyncProtocolObserverImpl::SyncProtocolObserverImpl ( std::shared_ptr< blockchain::BlockTree block_tree,
std::shared_ptr< blockchain::BlockHeaderRepository blocks_headers 
)

Definition at line 28 of file sync_protocol_observer_impl.cpp.

kagome::network::SyncProtocolObserverImpl::~SyncProtocolObserverImpl ( )
overridedefault

Member Function Documentation

void kagome::network::SyncProtocolObserverImpl::fillBlocksResponse ( const network::BlocksRequest request,
network::BlocksResponse response,
const std::vector< primitives::BlockHash > &  hash_chain 
) const
private

Definition at line 147 of file sync_protocol_observer_impl.cpp.

outcome::result< network::BlocksResponse > kagome::network::SyncProtocolObserverImpl::onBlocksRequest ( const BlocksRequest request) const
overridevirtual

Process a blocks request

Parameters
requestto be processed
Returns
blocks request or error

Implements kagome::network::SyncProtocolObserver.

Definition at line 39 of file sync_protocol_observer_impl.cpp.

blockchain::BlockTree::BlockHashVecRes kagome::network::SyncProtocolObserverImpl::retrieveRequestedHashes ( const network::BlocksRequest request,
const primitives::BlockHash from_hash 
) const
private

Definition at line 110 of file sync_protocol_observer_impl.cpp.

Member Data Documentation

std::shared_ptr<blockchain::BlockTree> kagome::network::SyncProtocolObserverImpl::block_tree_
private

Definition at line 47 of file sync_protocol_observer_impl.hpp.

std::shared_ptr<blockchain::BlockHeaderRepository> kagome::network::SyncProtocolObserverImpl::blocks_headers_
private

Definition at line 48 of file sync_protocol_observer_impl.hpp.

log::Logger kagome::network::SyncProtocolObserverImpl::log_
private

Definition at line 52 of file sync_protocol_observer_impl.hpp.

std::unordered_set<BlocksRequest::Fingerprint> kagome::network::SyncProtocolObserverImpl::requested_ids_
mutableprivate

Definition at line 50 of file sync_protocol_observer_impl.hpp.


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