1#ifndef XRPL_OVERLAY_PREDICATES_H_INCLUDED
2#define XRPL_OVERLAY_PREDICATES_H_INCLUDED
4#include <xrpld/overlay/Message.h>
5#include <xrpld/overlay/Peer.h>
32template <
typename Predicate>
54template <
typename Predicate>
55send_if_pred<Predicate>
64template <
typename Predicate>
86template <
typename Predicate>
87send_if_not_pred<Predicate>
131 if (!peer->cluster())
152 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)