1#include <xrpl/core/HashRouter.h>
3#include <xrpl/basics/base_uint.h>
4#include <xrpl/basics/chrono.h>
5#include <xrpl/beast/container/detail/aged_unordered_container.h>
6#include <xrpl/beast/utility/instrumentation.h>
54 result.first.addPeer(peer);
55 return {result.second, result.first.relayed()};
63 auto [s, created] =
emplace(key);
79 auto& s = result.first;
90 return emplace(key).first.getFlags();
96 XRPL_ASSERT(
static_cast<bool>(flags),
"xrpl::HashRouter::setFlags : valid input");
102 if ((s.getFlags() & flags) == flags)
119 return s.releasePeerSet();
An entry in the routing table.
std::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
HashRouterFlags getFlags(uint256 const &key)
bool addSuppressionPeer(uint256 const &key, PeerShortID peer)
bool setFlags(uint256 const &key, HashRouterFlags flags)
Set the flags on a hash.
std::pair< bool, std::optional< Stopwatch::time_point > > addSuppressionPeerWithStatus(uint256 const &key, PeerShortID peer)
Add a suppression peer and get message's relay status.
std::pair< Entry &, bool > emplace(uint256 const &)
bool shouldProcess(uint256 const &key, PeerShortID peer, HashRouterFlags &flags, std::chrono::seconds txInterval)
beast::aged_unordered_map< uint256, Entry, Stopwatch::clock_type, HardenedHash< strong_hash > > suppressionMap_
void addSuppression(uint256 const &key)
std::uint32_t PeerShortID
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.