|
Kagome
Polkadot Runtime Engine in C++17
|
#include <state_protocol_impl.hpp>
Public Member Functions | |
| StateProtocolImpl (libp2p::Host &host, const application::ChainSpec &chain_spec, std::shared_ptr< StateProtocolObserver > state_observer) | |
| 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 | request (const PeerId &peer_id, StateRequest state_request, std::function< void(outcome::result< StateResponse >)> &&response_handler) override |
| Make async request to peer and return response in callback. More... | |
| void | readRequest (std::shared_ptr< Stream > stream) |
| void | writeResponse (std::shared_ptr< Stream > stream, StateResponse state_response) |
| void | writeRequest (std::shared_ptr< Stream > stream, StateRequest state_request, std::function< void(outcome::result< void >)> &&cb) |
| void | readResponse (std::shared_ptr< Stream > stream, std::function< void(outcome::result< StateResponse >)> &&response_handler) |
Public Member Functions inherited from kagome::network::ProtocolBase | |
| ProtocolBase ()=default | |
| ProtocolBase (ProtocolBase &&) noexcept=delete | |
| ProtocolBase (const ProtocolBase &)=delete | |
| virtual | ~ProtocolBase ()=default |
| ProtocolBase & | operator= (ProtocolBase &&) noexcept=delete |
| ProtocolBase & | operator= (ProtocolBase const &)=delete |
Private Attributes | |
| libp2p::Host & | host_ |
| std::shared_ptr< StateProtocolObserver > | state_observer_ |
| const libp2p::peer::Protocol | protocol_ |
| log::Logger | log_ = log::createLogger("StateProtocol", "state_protocol") |
Static Private Attributes | |
| static const auto | kStateProtocolName = "StateProtocol"s |
Definition at line 27 of file state_protocol_impl.hpp.
| kagome::network::StateProtocolImpl::StateProtocolImpl | ( | libp2p::Host & | host, |
| const application::ChainSpec & | chain_spec, | ||
| std::shared_ptr< StateProtocolObserver > | state_observer | ||
| ) |
Definition at line 16 of file state_protocol_impl.cpp.
|
overridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 57 of file state_protocol_impl.cpp.
|
overridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 51 of file state_protocol_impl.cpp.
|
inlineoverridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 38 of file state_protocol_impl.hpp.
| void kagome::network::StateProtocolImpl::readRequest | ( | std::shared_ptr< Stream > | stream | ) |
Definition at line 94 of file state_protocol_impl.cpp.
| void kagome::network::StateProtocolImpl::readResponse | ( | std::shared_ptr< Stream > | stream, |
| std::function< void(outcome::result< StateResponse >)> && | response_handler | ||
| ) |
Definition at line 298 of file state_protocol_impl.cpp.
|
overridevirtual |
Make async request to peer and return response in callback.
| peer_id | of a peer to make request to |
| state_request | a request content |
| response_handler | a callback to call when response received |
Implements kagome::network::StateProtocol.
Definition at line 163 of file state_protocol_impl.cpp.
|
overridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 26 of file state_protocol_impl.cpp.
|
overridevirtual |
Implements kagome::network::ProtocolBase.
Definition at line 47 of file state_protocol_impl.cpp.
| void kagome::network::StateProtocolImpl::writeRequest | ( | std::shared_ptr< Stream > | stream, |
| StateRequest | state_request, | ||
| std::function< void(outcome::result< void >)> && | cb | ||
| ) |
Definition at line 254 of file state_protocol_impl.cpp.
| void kagome::network::StateProtocolImpl::writeResponse | ( | std::shared_ptr< Stream > | stream, |
| StateResponse | state_response | ||
| ) |
Definition at line 225 of file state_protocol_impl.cpp.
|
private |
Definition at line 68 of file state_protocol_impl.hpp.
|
inlinestaticprivate |
Definition at line 67 of file state_protocol_impl.hpp.
|
private |
Definition at line 71 of file state_protocol_impl.hpp.
|
private |
Definition at line 70 of file state_protocol_impl.hpp.
|
private |
Definition at line 69 of file state_protocol_impl.hpp.