20#ifndef RIPPLE_APP_MISC_HASHROUTER_H_INCLUDED
21#define RIPPLE_APP_MISC_HASHROUTER_H_INCLUDED
23#include <xrpl/basics/CountedObject.h>
24#include <xrpl/basics/UnorderedContainers.h>
25#include <xrpl/basics/base_uint.h>
26#include <xrpl/basics/chrono.h>
27#include <xrpl/beast/container/aged_unordered_map.h>
38#define SF_TRUSTED 0x10
42#define SF_PRIVATE1 0x0100
43#define SF_PRIVATE2 0x0200
44#define SF_PRIVATE3 0x0400
45#define SF_PRIVATE4 0x0800
46#define SF_PRIVATE5 0x1000
47#define SF_PRIVATE6 0x2000
typename Clock::time_point time_point
std::chrono::steady_clock clock_type
Associative container where each element is also indexed by time.
Tracks the number of instances of an object.
An entry in the routing table.
void setFlags(int flagsToSet)
std::optional< Stopwatch::time_point > processed_
std::set< PeerShortID > peers_
std::optional< Stopwatch::time_point > relayed() const
Return seated relay time point if the message has been relayed.
std::optional< Stopwatch::time_point > relayed_
void addPeer(PeerShortID peer)
std::set< PeerShortID > releasePeerSet()
Return set of peers we've relayed to and reset tracking.
bool shouldRelay(Stopwatch::time_point const &now, std::chrono::seconds relayTime)
Determines if this item should be relayed.
bool shouldProcess(Stopwatch::time_point now, std::chrono::seconds interval)
Routing table for objects identified by hash.
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)
virtual ~HashRouter()=default
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.
HashRouter & operator=(HashRouter const &)=delete
HashRouter(Setup const &setup, Stopwatch &clock)
bool setFlags(uint256 const &key, int flags)
Set the flags on a hash.
std::pair< Entry &, bool > emplace(uint256 const &)
void addSuppression(uint256 const &key)
Seed functor once per construction.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
HashRouter::Setup setup_HashRouter(Config const &config)
Structure used to customize HashRouter behavior.
Setup()=default
Default constructor.
seconds holdTime
Expiration time for a hash entry.
seconds relayTime
Amount of time required before a relayed item will be relayed again.