6 #ifndef KAGOME_NETWORK_PEERMANAGER 7 #define KAGOME_NETWORK_PEERMANAGER 10 #include <unordered_set> 12 #include <libp2p/peer/peer_id.hpp> 13 #include <libp2p/peer/peer_info.hpp> 48 std::optional<RoundNumber> round_number = std::nullopt;
49 std::optional<VoterSetId> set_id = std::nullopt;
51 std::optional<CollatorState> collator_state = std::nullopt;
69 std::pair<network::CollatorPublicKey const &, network::ParachainId>>;
76 virtual void connectToPeer(
const PeerInfo &peer_info) = 0;
81 virtual void reserveStreams(
const PeerId &peer_id)
const = 0;
86 virtual std::shared_ptr<StreamEngine> getStreamEngine() = 0;
91 virtual void keepAlive(
const PeerId &peer_id) = 0;
96 virtual void startPingingPeer(
const PeerId &peer_id) = 0;
101 virtual void updatePeerState(
const PeerId &peer_id,
102 const Status &status) = 0;
107 virtual void updatePeerState(
const PeerId &peer_id,
113 virtual outcome::result<
114 std::pair<network::CollatorPublicKey const &, network::ParachainId>>
115 insert_advertisement(
PeerState &peer_state,
128 virtual void setCollating(
const PeerId &peer_id,
136 virtual void updatePeerState(
143 virtual std::optional<std::reference_wrapper<PeerState>> getPeerState(
144 const PeerId &peer_id) = 0;
149 virtual size_t activePeersNumber()
const = 0;
154 virtual void forEachPeer(
155 std::function<
void(
const PeerId &)> func)
const = 0;
160 virtual void forOnePeer(
const PeerId &peer_id,
161 std::function<
void(
const PeerId &)> func)
const = 0;
165 #endif // KAGOME_NETWORK_PEERMANAGER clock::SteadyClock::TimePoint time
libp2p::peer::PeerId PeerId
network::ParachainId parachain_id
std::unordered_set< BlockHash > advertisements
crypto::Sr25519PublicKey CollatorPublicKey
network::CollatorPublicKey collator_id
primitives::BlockInfo BlockInfo
std::unordered_map< BlockHash, bool > our_view
libp2p::peer::PeerInfo PeerInfo
libp2p::peer::PeerId PeerId
primitives::BlockNumber BlockNumber
libp2p::peer::PeerInfo PeerInfo
BlockHash const & relay_parent
libp2p::peer::PeerId const & peer_id
primitives::BlockHash BlockHash
detail::BlockInfoT< struct BlockInfoTag > BlockInfo
network::ParachainId para_id
outcome::result< std::pair< network::CollatorPublicKey const &, network::ParachainId >> AdvResult
typename ClockType::time_point TimePoint