20 #include <ripple/app/main/Application.h> 
   21 #include <ripple/core/JobQueue.h> 
   22 #include <ripple/overlay/Overlay.h> 
   23 #include <ripple/overlay/PeerSet.h> 
   41         ::google::protobuf::Message 
const& message,
 
   42         protocol::MessageType type,
 
   59     : app_(app), journal_(app.journal(
"PeerSet"))
 
   76     overlay.foreach([&](
auto const& peer) {
 
   77         auto const score = peer->getScore(hasItem(peer));
 
   84         [](ScoredPeer 
const& lhs, ScoredPeer 
const& rhs) {
 
   85             return lhs.first > rhs.first;
 
   89     for (
auto const& pair : pairs)
 
   91         auto const peer = pair.second;
 
   92         if (!
peers_.insert(peer->id()).second)
 
  102     ::google::protobuf::Message 
const& message,
 
  103     protocol::MessageType type,
 
  106     auto packet = std::make_shared<Message>(message, type);
 
  136         return std::make_unique<PeerSetImpl>(
app_);
 
  146     return std::make_unique<PeerSetBuilderImpl>(app);
 
  162         JLOG(
j_.
error()) << 
"DummyPeerSet addPeers should not be called";
 
  167         ::google::protobuf::Message 
const& message,
 
  168         protocol::MessageType type,
 
  171         JLOG(
j_.
error()) << 
"DummyPeerSet sendRequest should not be called";
 
  178         JLOG(
j_.
error()) << 
"DummyPeerSet getPeerIds should not be called";
 
  189     return std::make_unique<DummyPeerSet>(app);
 
  
std::unique_ptr< PeerSet > make_DummyPeerSet(Application &app)
Make a dummy PeerSet that does not do anything.
std::set< Peer::id_t > peers_
The identifiers of the peers we are tracking.
void sendRequest(::google::protobuf::Message const &message, protocol::MessageType type, std::shared_ptr< Peer > const &peer) override
PeerSetBuilderImpl(Application &app)
virtual std::unique_ptr< PeerSet > build() override
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 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.
A generic endpoint for log messages.
const std::set< Peer::id_t > & getPeerIds() const override
get the set of ids of previously added peers
@ accepted
Manifest is valid.
DummyPeerSet(Application &app)
T emplace_back(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::unique_ptr< PeerSetBuilder > make_PeerSetBuilder(Application &app)
Supports data retrieval by managing a set of peers.
virtual Overlay & overlay()=0
virtual std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const =0
Returns the peer with the matching short id, or null.
PeerSetImpl(Application &app)
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.
const std::set< Peer::id_t > & getPeerIds() const override
get the set of ids of previously added peers