20#include <xrpld/app/misc/HashRouter.h>
27 auto iter = suppressionMap_.find(key);
29 if (iter != suppressionMap_.end())
31 suppressionMap_.touch(iter);
36 expire(suppressionMap_, holdTime_);
39 std::ref(suppressionMap_.emplace(key,
Entry()).first->second),
true);
62 result.first.addPeer(peer);
63 return {result.second, result.first.relayed()};
71 auto [s, created] =
emplace(key);
87 auto& s = result.first;
101 auto& entry =
emplace(key).first;
103 return entry.shouldProcessForPeer(
112 return emplace(key).first.getFlags();
118 XRPL_ASSERT(flags,
"ripple::HashRouter::setFlags : valid input");
124 if ((s.getFlags() & flags) == flags)
137 auto& s = emplace(key).first;
139 if (!s.shouldRelay(suppressionMap_.clock().now(), holdTime_))
142 return s.releasePeerSet();
150 auto& s = emplace(key).first;
151 return s.peekPeerSet();
An entry in the routing table.
beast::aged_unordered_map< uint256, Entry, Stopwatch::clock_type, hardened_hash< strong_hash > > suppressionMap_
std::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
bool shouldProcess(uint256 const &key, PeerShortID peer, int &flags, std::chrono::seconds tx_interval)
int getFlags(uint256 const &key)
bool shouldProcessForPeer(uint256 const &key, PeerShortID peer, std::chrono::seconds interval)
Determines whether the hashed item should be processed for the given peer.
bool addSuppressionPeer(uint256 const &key, PeerShortID peer)
std::pair< bool, std::optional< Stopwatch::time_point > > addSuppressionPeerWithStatus(uint256 const &key, PeerShortID peer)
Add a suppression peer and get message's relay status.
bool setFlags(uint256 const &key, int flags)
Set the flags on a hash.
std::set< PeerShortID > getPeers(uint256 const &key)
Returns a copy of the set of peers in the Entry for the key.
std::pair< Entry &, bool > emplace(uint256 const &)
void addSuppression(uint256 const &key)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.