|
Kagome
Polkadot Runtime Engine in C++17
|
#include <stream_engine.hpp>
Classes | |
| struct | ProtocolDescr |
| struct | ProtocolDescr.incoming |
| struct | ProtocolDescr.outgoing |
| struct | RandomGossipStrategy |
Public Types | |
| enum | Direction : uint8_t { Direction::INCOMING = 1, Direction::OUTGOING = 2, Direction::BIDIRECTIONAL = 3 } |
| using | PeerInfo = libp2p::peer::PeerInfo |
| using | PeerId = libp2p::peer::PeerId |
| using | Protocol = libp2p::peer::Protocol |
| using | Stream = libp2p::connection::Stream |
| using | StreamEnginePtr = std::shared_ptr< StreamEngine > |
Public Member Functions | |
| StreamEngine (const StreamEngine &)=delete | |
| StreamEngine & | operator= (const StreamEngine &)=delete |
| StreamEngine (StreamEngine &&)=delete | |
| StreamEngine & | operator= (StreamEngine &&)=delete |
| ~StreamEngine ()=default | |
| StreamEngine (std::shared_ptr< ReputationRepository > reputation_repository) | |
| outcome::result< void > | addIncoming (std::shared_ptr< Stream > stream, const std::shared_ptr< ProtocolBase > &protocol) |
| outcome::result< void > | addOutgoing (std::shared_ptr< Stream > stream, const std::shared_ptr< ProtocolBase > &protocol) |
| outcome::result< void > | addBidirectional (std::shared_ptr< Stream > stream, const std::shared_ptr< ProtocolBase > &protocol) |
| void | reserveStreams (const PeerId &peer_id, const std::shared_ptr< ProtocolBase > &protocol) |
| void | del (const PeerId &peer_id) |
| bool | reserveOutgoing (PeerId const &peer_id, std::shared_ptr< ProtocolBase > const &protocol) |
| void | dropReserveOutgoing (PeerId const &peer_id, std::shared_ptr< ProtocolBase > const &protocol) |
| bool | isAlive (PeerId const &peer_id, std::shared_ptr< ProtocolBase > const &protocol) const |
| template<typename T > | |
| void | send (const PeerId &peer_id, const std::shared_ptr< ProtocolBase > &protocol, std::shared_ptr< T > msg) |
| template<typename T > | |
| void | broadcast (const std::shared_ptr< ProtocolBase > &protocol, const std::shared_ptr< T > &msg, const std::function< bool(const PeerId &peer_id)> &predicate) |
| template<typename T > | |
| void | broadcast (const std::shared_ptr< ProtocolBase > &protocol, const std::shared_ptr< T > &msg) |
| int | outgoingStreamsNumber (const std::shared_ptr< ProtocolBase > &protocol) |
| template<typename F > | |
| size_t | count (F &&filter) const |
| template<typename TPeerId , typename = std::enable_if<std::is_same_v<PeerId, TPeerId>>> | |
| PeerInfo | from (TPeerId &&peer_id) const |
| outcome::result< PeerInfo > | from (std::shared_ptr< Stream > &stream) const |
| template<typename F > | |
| void | forEachPeer (F &&f) |
| template<typename F > | |
| void | forEachPeer (F &&f) const |
Static Public Member Functions | |
| template<typename... Args> | |
| static StreamEnginePtr | create (Args &&...args) |
Static Public Attributes | |
| static constexpr auto | kDownVoteByDisconnectionExpirationTimeout |
Private Types | |
| using | ProtocolMap = std::map< std::shared_ptr< ProtocolBase >, ProtocolDescr > |
| using | PeerMap = std::map< PeerId, ProtocolMap > |
Private Member Functions | |
| outcome::result< void > | add (std::shared_ptr< Stream > stream, const std::shared_ptr< ProtocolBase > &protocol, Direction direction) |
| void | uploadStream (std::shared_ptr< Stream > &dst, std::shared_ptr< Stream > const &src, std::shared_ptr< ProtocolBase > const &protocol, Direction direction) |
| template<typename T > | |
| void | send (PeerId const &peer_id, std::shared_ptr< ProtocolBase > const &protocol, std::shared_ptr< Stream > stream, std::shared_ptr< T > const &msg) |
| void | dump (std::string_view msg) |
| void | updateStream (PeerId const &peer_id, std::shared_ptr< ProtocolBase > const &protocol, ProtocolDescr &descr) |
| template<typename T > | |
| void | updateStream (const PeerId &peer_id, const std::shared_ptr< ProtocolBase > &protocol, std::shared_ptr< T > msg) |
Static Private Member Functions | |
| template<typename PM , typename F > | |
| static void | forProtocol (PM &proto_map, const std::shared_ptr< ProtocolBase > &protocol, F &&f) |
| template<typename PM , typename F > | |
| static void | forSubscriber (PeerId const &peer_id, PM &streams, std::shared_ptr< ProtocolBase > const &protocol, F &&f) |
Private Attributes | |
| std::shared_ptr< ReputationRepository > | reputation_repository_ |
| log::Logger | logger_ |
| SafeObject< PeerMap > | streams_ |
Is the manager class to manipulate streams. It supports next structure Peer ProtocolName_0 ProtocolPtr_0, Incoming_Stream_0 Outgoing_Stream_0 MessagesQueue for creating outgoing stream
Definition at line 40 of file stream_engine.hpp.
| struct kagome::network::StreamEngine::ProtocolDescr.incoming |
Definition at line 81 of file stream_engine.hpp.
| Class Members | ||
|---|---|---|
| shared_ptr< Stream > | stream | |
| struct kagome::network::StreamEngine::ProtocolDescr.outgoing |
Definition at line 85 of file stream_engine.hpp.
| Class Members | ||
|---|---|---|
| bool | reserved | |
| shared_ptr< Stream > | stream | |
| using kagome::network::StreamEngine::PeerId = libp2p::peer::PeerId |
Definition at line 42 of file stream_engine.hpp.
| using kagome::network::StreamEngine::PeerInfo = libp2p::peer::PeerInfo |
Definition at line 41 of file stream_engine.hpp.
|
private |
Definition at line 144 of file stream_engine.hpp.
| using kagome::network::StreamEngine::Protocol = libp2p::peer::Protocol |
Definition at line 43 of file stream_engine.hpp.
|
private |
Definition at line 143 of file stream_engine.hpp.
| using kagome::network::StreamEngine::Stream = libp2p::connection::Stream |
Definition at line 44 of file stream_engine.hpp.
| using kagome::network::StreamEngine::StreamEnginePtr = std::shared_ptr<StreamEngine> |
Definition at line 45 of file stream_engine.hpp.
|
strong |
| Enumerator | |
|---|---|
| INCOMING | |
| OUTGOING | |
| BIDIRECTIONAL | |
Definition at line 50 of file stream_engine.hpp.
|
delete |
|
delete |
|
default |
|
inline |
Definition at line 154 of file stream_engine.hpp.
|
inlineprivate |
Definition at line 164 of file stream_engine.hpp.
|
inline |
Definition at line 222 of file stream_engine.hpp.
|
inline |
Definition at line 210 of file stream_engine.hpp.
|
inline |
Definition at line 216 of file stream_engine.hpp.
|
inline |
Definition at line 319 of file stream_engine.hpp.
|
inline |
Definition at line 340 of file stream_engine.hpp.
|
inline |
Definition at line 361 of file stream_engine.hpp.
|
inlinestatic |
Definition at line 159 of file stream_engine.hpp.
|
inline |
Definition at line 245 of file stream_engine.hpp.
|
inline |
Definition at line 272 of file stream_engine.hpp.
|
inlineprivate |
Definition at line 492 of file stream_engine.hpp.
|
inline |
Definition at line 391 of file stream_engine.hpp.
|
inline |
Definition at line 400 of file stream_engine.hpp.
|
inlinestaticprivate |
Definition at line 471 of file stream_engine.hpp.
|
inlinestaticprivate |
Definition at line 481 of file stream_engine.hpp.
|
inline |
Definition at line 376 of file stream_engine.hpp.
|
inline |
Definition at line 380 of file stream_engine.hpp.
|
inline |
Definition at line 282 of file stream_engine.hpp.
|
delete |
|
delete |
|
inline |
Definition at line 347 of file stream_engine.hpp.
|
inline |
Definition at line 262 of file stream_engine.hpp.
|
inline |
Definition at line 228 of file stream_engine.hpp.
|
inline |
Definition at line 296 of file stream_engine.hpp.
|
inlineprivate |
Definition at line 442 of file stream_engine.hpp.
|
inlineprivate |
Definition at line 510 of file stream_engine.hpp.
|
inlineprivate |
Definition at line 576 of file stream_engine.hpp.
|
inlineprivate |
Definition at line 409 of file stream_engine.hpp.
|
static |
Definition at line 47 of file stream_engine.hpp.
|
private |
Definition at line 594 of file stream_engine.hpp.
|
private |
Definition at line 593 of file stream_engine.hpp.
|
private |
Definition at line 596 of file stream_engine.hpp.