20#ifndef RIPPLE_OVERLAY_PREDICATES_H_INCLUDED
21#define RIPPLE_OVERLAY_PREDICATES_H_INCLUDED
23#include <xrpld/overlay/Message.h>
24#include <xrpld/overlay/Peer.h>
51template <
typename Predicate>
73template <
typename Predicate>
74send_if_pred<Predicate>
83template <
typename Predicate>
105template <
typename Predicate>
106send_if_not_pred<Predicate>
150 if (!peer->cluster())
171 if (
peerSet.count(peer->id()) == 0)
Represents a peer connection in the overlay.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
send_if_not_pred< Predicate > send_if_not(std::shared_ptr< Message > const &m, Predicate const &f)
Helper function to aid in type deduction.
send_if_pred< Predicate > send_if(std::shared_ptr< Message > const &m, Predicate const &f)
Helper function to aid in type deduction.
Select the specific peer.
bool operator()(std::shared_ptr< Peer > const &peer) const
match_peer(Peer const *match=nullptr)
Select all peers (except optional excluded) that are in our cluster.
bool operator()(std::shared_ptr< Peer > const &peer) const
peer_in_cluster(Peer const *skip=nullptr)
Select all peers that are in the specified set.
peer_in_set(std::set< Peer::id_t > const &peers)
std::set< Peer::id_t > const & peerSet
bool operator()(std::shared_ptr< Peer > const &peer) const
Sends a message to all peers.
std::shared_ptr< Message > const & msg
send_always(std::shared_ptr< Message > const &m)
void operator()(std::shared_ptr< Peer > const &peer) const
Sends a message to non-matching peers.
Predicate const & predicate
void operator()(std::shared_ptr< Peer > const &peer) const
std::shared_ptr< Message > const & msg
send_if_not_pred(std::shared_ptr< Message > const &m, Predicate const &p)
Sends a message to match peers.
std::shared_ptr< Message > const & msg
void operator()(std::shared_ptr< Peer > const &peer) const
Predicate const & predicate
send_if_pred(std::shared_ptr< Message > const &m, Predicate const &p)