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

#include <propagate_transactions_protocol.hpp>

Inheritance diagram for kagome::network::PropagateTransactionsProtocol:
Collaboration diagram for kagome::network::PropagateTransactionsProtocol:

Public Member Functions

 PropagateTransactionsProtocol ()=delete
 
 ~PropagateTransactionsProtocol () override=default
 
 PropagateTransactionsProtocol (libp2p::Host &host, const application::AppConfiguration &app_config, const application::ChainSpec &chain_spec, std::shared_ptr< consensus::babe::Babe > babe, std::shared_ptr< ExtrinsicObserver > extrinsic_observer, std::shared_ptr< StreamEngine > stream_engine, std::shared_ptr< primitives::events::ExtrinsicSubscriptionEngine > extrinsic_events_engine, std::shared_ptr< subscription::ExtrinsicEventKeyRepository > ext_event_key_repo)
 
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 propagateTransactions (gsl::span< const primitives::Transaction > txs)
 
- 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

void readHandshake (std::shared_ptr< Stream > stream, Direction direction, std::function< void(outcome::result< void >)> &&cb)
 
void writeHandshake (std::shared_ptr< Stream > stream, Direction direction, std::function< void(outcome::result< void >)> &&cb)
 
void readPropagatedExtrinsics (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< consensus::babe::Babebabe_
 
std::shared_ptr< ExtrinsicObserverextrinsic_observer_
 
std::shared_ptr< StreamEnginestream_engine_
 
std::shared_ptr< primitives::events::ExtrinsicSubscriptionEngineextrinsic_events_engine_
 
std::shared_ptr< subscription::ExtrinsicEventKeyRepositoryext_event_key_repo_
 
metrics::RegistryPtr metrics_registry_ = metrics::createRegistry()
 
metrics::Countermetric_propagated_tx_counter_
 

Static Private Attributes

static const auto kPropogateTransacionsProtocolName
 

Detailed Description

Definition at line 37 of file propagate_transactions_protocol.hpp.

Member Enumeration Documentation

Enumerator
INCOMING 
OUTGOING 

Definition at line 74 of file propagate_transactions_protocol.hpp.

Constructor & Destructor Documentation

kagome::network::PropagateTransactionsProtocol::PropagateTransactionsProtocol ( )
delete
kagome::network::PropagateTransactionsProtocol::~PropagateTransactionsProtocol ( )
overridedefault
kagome::network::PropagateTransactionsProtocol::PropagateTransactionsProtocol ( libp2p::Host &  host,
const application::AppConfiguration app_config,
const application::ChainSpec chain_spec,
std::shared_ptr< consensus::babe::Babe babe,
std::shared_ptr< ExtrinsicObserver extrinsic_observer,
std::shared_ptr< StreamEngine stream_engine,
std::shared_ptr< primitives::events::ExtrinsicSubscriptionEngine extrinsic_events_engine,
std::shared_ptr< subscription::ExtrinsicEventKeyRepository ext_event_key_repo 
)

Definition at line 22 of file propagate_transactions_protocol.cpp.

Member Function Documentation

void kagome::network::PropagateTransactionsProtocol::newOutgoingStream ( const PeerInfo peer_info)
overridevirtual
void kagome::network::PropagateTransactionsProtocol::onIncomingStream ( std::shared_ptr< Stream stream)
overridevirtual

Implements kagome::network::ProtocolBase.

Definition at line 64 of file propagate_transactions_protocol.cpp.

void kagome::network::PropagateTransactionsProtocol::propagateTransactions ( gsl::span< const primitives::Transaction txs)

Definition at line 318 of file propagate_transactions_protocol.cpp.

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

Implements kagome::network::ProtocolBase.

Definition at line 61 of file propagate_transactions_protocol.hpp.

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

Definition at line 179 of file propagate_transactions_protocol.cpp.

void kagome::network::PropagateTransactionsProtocol::readPropagatedExtrinsics ( std::shared_ptr< Stream stream)
private

Definition at line 267 of file propagate_transactions_protocol.cpp.

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

Implements kagome::network::ProtocolBase.

Definition at line 56 of file propagate_transactions_protocol.cpp.

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

Implements kagome::network::ProtocolBase.

Definition at line 60 of file propagate_transactions_protocol.cpp.

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

Definition at line 221 of file propagate_transactions_protocol.cpp.

Member Data Documentation

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

Definition at line 88 of file propagate_transactions_protocol.hpp.

std::shared_ptr<consensus::babe::Babe> kagome::network::PropagateTransactionsProtocol::babe_
private

Definition at line 89 of file propagate_transactions_protocol.hpp.

ProtocolBaseImpl kagome::network::PropagateTransactionsProtocol::base_
private

Definition at line 87 of file propagate_transactions_protocol.hpp.

std::shared_ptr<subscription::ExtrinsicEventKeyRepository> kagome::network::PropagateTransactionsProtocol::ext_event_key_repo_
private

Definition at line 95 of file propagate_transactions_protocol.hpp.

std::shared_ptr<primitives::events::ExtrinsicSubscriptionEngine> kagome::network::PropagateTransactionsProtocol::extrinsic_events_engine_
private

Definition at line 93 of file propagate_transactions_protocol.hpp.

std::shared_ptr<ExtrinsicObserver> kagome::network::PropagateTransactionsProtocol::extrinsic_observer_
private

Definition at line 90 of file propagate_transactions_protocol.hpp.

const auto kagome::network::PropagateTransactionsProtocol::kPropogateTransacionsProtocolName
inlinestaticprivate
Initial value:
=
"PropagateTransactionsProtocol"s

Definition at line 85 of file propagate_transactions_protocol.hpp.

metrics::Counter* kagome::network::PropagateTransactionsProtocol::metric_propagated_tx_counter_
private

Definition at line 99 of file propagate_transactions_protocol.hpp.

metrics::RegistryPtr kagome::network::PropagateTransactionsProtocol::metrics_registry_ = metrics::createRegistry()
private

Definition at line 98 of file propagate_transactions_protocol.hpp.

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

Definition at line 91 of file propagate_transactions_protocol.hpp.


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