20 #ifndef RIPPLE_APP_MISC_HASHROUTER_H_INCLUDED
21 #define RIPPLE_APP_MISC_HASHROUTER_H_INCLUDED
23 #include <ripple/basics/CountedObject.h>
24 #include <ripple/basics/UnorderedContainers.h>
25 #include <ripple/basics/base_uint.h>
26 #include <ripple/basics/chrono.h>
27 #include <ripple/beast/container/aged_unordered_map.h>
28 #include <boost/optional.hpp>
33 #define SF_BAD 0x02 // Temporarily bad
35 #define SF_TRUSTED 0x10 // comes from trusted source
39 #define SF_PRIVATE1 0x0100
40 #define SF_PRIVATE2 0x0200
41 #define SF_PRIVATE3 0x0400
42 #define SF_PRIVATE4 0x0800
43 #define SF_PRIVATE5 0x1000
44 #define SF_PRIVATE6 0x2000
67 return "HashRouterEntry";
221 boost::optional<std::set<PeerShortID>>
bool shouldRelay(Stopwatch::time_point const &now, std::chrono::seconds holdTime)
Determines if this item should be relayed.
void setFlags(int flagsToSet)
Tracks the number of instances of an object.
bool addSuppressionPeer(uint256 const &key, PeerShortID peer)
boost::optional< Stopwatch::time_point > relayed_
std::pair< Entry &, bool > emplace(uint256 const &)
int getFlags(uint256 const &key)
std::set< PeerShortID > releasePeerSet()
Return set of peers we've relayed to and reset tracking.
An entry in the routing table.
bool shouldProcess(uint256 const &key, PeerShortID peer, int &flags, std::chrono::seconds tx_interval)
std::chrono::steady_clock clock_type
Routing table for objects identified by hash.
virtual ~HashRouter()=default
bool shouldRecover(std::uint32_t limit)
Determines if this item should be recovered from the open ledger.
HashRouter(Stopwatch &clock, std::chrono::seconds entryHoldTimeInSeconds, std::uint32_t recoverLimit)
static char const * getCountedObjectName()
static std::uint32_t getDefaultRecoverLimit()
beast::aged_unordered_map< uint256, Entry, Stopwatch::clock_type, hardened_hash< strong_hash > > suppressionMap_
const std::chrono::seconds holdTime_
static std::chrono::seconds getDefaultHoldTime()
void addSuppression(uint256 const &key)
Seed functor once per construction.
bool shouldRecover(uint256 const &key)
Determines whether the hashed item should be recovered from the open ledger into the next open ledger...
boost::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
HashRouter & operator=(HashRouter const &)=delete
boost::optional< Stopwatch::time_point > processed_
std::uint32_t recoveries_
void addPeer(PeerShortID peer)
Associative container where each element is also indexed by time.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool shouldProcess(Stopwatch::time_point now, std::chrono::seconds interval)
std::uint32_t PeerShortID
const std::uint32_t recoverLimit_
typename std::chrono::steady_clock ::time_point time_point
bool setFlags(uint256 const &key, int flags)
Set the flags on a hash.
std::set< PeerShortID > peers_