Kagome
Polkadot Runtime Engine in C++17
kagome::network::BlockAnnounceProtocol Class Referencefinal

#include <block_announce_protocol.hpp>

Inheritance diagram for kagome::network::BlockAnnounceProtocol:
Collaboration diagram for kagome::network::BlockAnnounceProtocol:

Public Member Functions

 BlockAnnounceProtocol ()=delete
 
 ~BlockAnnounceProtocol () override=default
 
 BlockAnnounceProtocol (libp2p::Host &host, const application::AppConfiguration &app_config, const application::ChainSpec &chain_spec, std::shared_ptr< StreamEngine > stream_engine, std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< BlockAnnounceObserver > observer, std::shared_ptr< PeerManager > peer_manager)
 
bool start () override
 
bool stop () override
 
const std::string & protocolName () const override
 
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
 
void blockAnnounce (BlockAnnounce &&announce)
 
- 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
 

Private Types

enum  Direction { Direction::INCOMING, Direction::OUTGOING }
 

Private Member Functions

outcome::result< StatuscreateStatus () const
 
void readStatus (std::shared_ptr< Stream > stream, Direction direction, std::function< void(outcome::result< void >)> &&cb)
 
void writeStatus (std::shared_ptr< Stream > stream, Direction direction, std::function< void(outcome::result< void >)> &&cb)
 
void readAnnounce (std::shared_ptr< Stream > stream)
 
- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 
- Private Member Functions inherited from NonMovable
 NonMovable (NonMovable &&)=delete
 
NonMovableoperator= (NonMovable &&)=delete
 
 NonMovable ()=default
 
 ~NonMovable ()=default
 

Private Attributes

ProtocolBaseImpl base_
 
const application::AppConfigurationapp_config_
 
std::shared_ptr< StreamEnginestream_engine_
 
std::shared_ptr< blockchain::BlockTreeblock_tree_
 
std::shared_ptr< BlockAnnounceObserverobserver_
 
std::shared_ptr< PeerManagerpeer_manager_
 

Static Private Attributes

static const auto kBlockAnnounceProtocolName
 

Detailed Description

Definition at line 35 of file block_announce_protocol.hpp.

Member Enumeration Documentation

Enumerator
INCOMING 
OUTGOING 

Definition at line 70 of file block_announce_protocol.hpp.

Constructor & Destructor Documentation

kagome::network::BlockAnnounceProtocol::BlockAnnounceProtocol ( )
delete
kagome::network::BlockAnnounceProtocol::~BlockAnnounceProtocol ( )
overridedefault
kagome::network::BlockAnnounceProtocol::BlockAnnounceProtocol ( libp2p::Host &  host,
const application::AppConfiguration app_config,
const application::ChainSpec chain_spec,
std::shared_ptr< StreamEngine stream_engine,
std::shared_ptr< blockchain::BlockTree block_tree,
std::shared_ptr< BlockAnnounceObserver observer,
std::shared_ptr< PeerManager peer_manager 
)

Definition at line 18 of file block_announce_protocol.cpp.

Member Function Documentation

void kagome::network::BlockAnnounceProtocol::blockAnnounce ( BlockAnnounce &&  announce)

Definition at line 352 of file block_announce_protocol.cpp.

outcome::result< Status > kagome::network::BlockAnnounceProtocol::createStatus ( ) const
private

Roles

Best block info

Definition at line 49 of file block_announce_protocol.cpp.

void kagome::network::BlockAnnounceProtocol::newOutgoingStream ( const PeerInfo peer_info)
overridevirtual

Implements kagome::network::ProtocolBase.

Definition at line 118 of file block_announce_protocol.cpp.

void kagome::network::BlockAnnounceProtocol::onIncomingStream ( std::shared_ptr< Stream stream)
overridevirtual

Implements kagome::network::ProtocolBase.

Definition at line 72 of file block_announce_protocol.cpp.

const std::string& kagome::network::BlockAnnounceProtocol::protocolName ( ) const
inlineoverridevirtual

Implements kagome::network::ProtocolBase.

Definition at line 55 of file block_announce_protocol.hpp.

void kagome::network::BlockAnnounceProtocol::readAnnounce ( std::shared_ptr< Stream stream)
private

Definition at line 312 of file block_announce_protocol.cpp.

void kagome::network::BlockAnnounceProtocol::readStatus ( std::shared_ptr< Stream stream,
Direction  direction,
std::function< void(outcome::result< void >)> &&  cb 
)
private

Definition at line 195 of file block_announce_protocol.cpp.

bool kagome::network::BlockAnnounceProtocol::start ( )
overridevirtual

Implements kagome::network::ProtocolBase.

Definition at line 41 of file block_announce_protocol.cpp.

bool kagome::network::BlockAnnounceProtocol::stop ( )
overridevirtual

Implements kagome::network::ProtocolBase.

Definition at line 45 of file block_announce_protocol.cpp.

void kagome::network::BlockAnnounceProtocol::writeStatus ( std::shared_ptr< Stream stream,
Direction  direction,
std::function< void(outcome::result< void >)> &&  cb 
)
private

Definition at line 257 of file block_announce_protocol.cpp.

Member Data Documentation

const application::AppConfiguration& kagome::network::BlockAnnounceProtocol::app_config_
private

Definition at line 84 of file block_announce_protocol.hpp.

ProtocolBaseImpl kagome::network::BlockAnnounceProtocol::base_
private

Definition at line 83 of file block_announce_protocol.hpp.

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

Definition at line 86 of file block_announce_protocol.hpp.

const auto kagome::network::BlockAnnounceProtocol::kBlockAnnounceProtocolName
inlinestaticprivate
Initial value:
=
"BlockAnnounceProtocol"s

Definition at line 81 of file block_announce_protocol.hpp.

std::shared_ptr<BlockAnnounceObserver> kagome::network::BlockAnnounceProtocol::observer_
private

Definition at line 87 of file block_announce_protocol.hpp.

std::shared_ptr<PeerManager> kagome::network::BlockAnnounceProtocol::peer_manager_
private

Definition at line 88 of file block_announce_protocol.hpp.

std::shared_ptr<StreamEngine> kagome::network::BlockAnnounceProtocol::stream_engine_
private

Definition at line 85 of file block_announce_protocol.hpp.


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