xrpld
Loading...
Searching...
No Matches
xrpl::PeerSetImpl Class Reference
Inheritance diagram for xrpl::PeerSetImpl:
Collaboration diagram for xrpl::PeerSetImpl:

Public Member Functions

 PeerSetImpl (Application &app)
void addPeers (std::size_t limit, std::function< bool(std::shared_ptr< Peer > const &)> hasItem, std::function< void(std::shared_ptr< Peer > const &)> onPeerAdded) override
 Try add more peers.
void sendRequest (::google::protobuf::Message const &message, protocol::MessageType type, std::shared_ptr< Peer > const &peer) override
 Send a message to one or all peers.
std::set< Peer::id_t > const & getPeerIds () const override
 get the set of ids of previously added peers
template<typename MessageType>
void sendRequest (MessageType const &message, std::shared_ptr< Peer > const &peer)
 send a message

Private Attributes

Applicationapp_
beast::Journal journal_
std::set< Peer::id_tpeers_
 The identifiers of the peers we are tracking.

Detailed Description

Definition at line 25 of file PeerSet.cpp.

Constructor & Destructor Documentation

◆ PeerSetImpl()

xrpl::PeerSetImpl::PeerSetImpl ( Application & app)

Definition at line 56 of file PeerSet.cpp.

Member Function Documentation

◆ addPeers()

void xrpl::PeerSetImpl::addPeers ( std::size_t limit,
std::function< bool(std::shared_ptr< Peer > const &)> hasItem,
std::function< void(std::shared_ptr< Peer > const &)> onPeerAdded )
overridevirtual

Try add more peers.

Parameters
limitnumber of peers to add
hasItemcallback that helps to select peers
onPeerAddedcallback called when a peer is added

Implements xrpl::PeerSet.

Definition at line 61 of file PeerSet.cpp.

◆ sendRequest() [1/2]

void xrpl::PeerSetImpl::sendRequest ( ::google::protobuf::Message const & message,
protocol::MessageType type,
std::shared_ptr< Peer > const & peer )
overridevirtual

Send a message to one or all peers.

Implements xrpl::PeerSet.

Definition at line 94 of file PeerSet.cpp.

◆ getPeerIds()

std::set< Peer::id_t > const & xrpl::PeerSetImpl::getPeerIds ( ) const
nodiscardoverridevirtual

get the set of ids of previously added peers

Implements xrpl::PeerSet.

Definition at line 114 of file PeerSet.cpp.

◆ sendRequest() [2/2]

template<typename MessageType>
void xrpl::PeerSet::sendRequest ( MessageType const & message,
std::shared_ptr< Peer > const & peer )
inherited

send a message

Definition at line 39 of file PeerSet.h.

Member Data Documentation

◆ app_

Application& xrpl::PeerSetImpl::app_
private

Definition at line 49 of file PeerSet.cpp.

◆ journal_

beast::Journal xrpl::PeerSetImpl::journal_
private

Definition at line 50 of file PeerSet.cpp.

◆ peers_

std::set<Peer::id_t> xrpl::PeerSetImpl::peers_
private

The identifiers of the peers we are tracking.

Definition at line 53 of file PeerSet.cpp.