CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
26 #include <unordered_map>
28 namespace catapult {
namespace consumers {
59 std::unordered_map<Hash256, Timestamp, utils::ArrayHasher<Hash256>>
m_cache;
uint64_t CacheDuration
Amount of time a hash should be cached.
Definition: HashCheckOptions.h:42
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
size_t size() const
Gets the size of the cache.
Definition: RecentHashCache.cpp:33
def warning(*args)
Definition: colorPrint.py:10
bool add(const Hash256 &hash)
Definition: RecentHashCache.cpp:37
HashCheckOptions m_options
Definition: RecentHashCache.h:57
std::unordered_map< Hash256, Timestamp, utils::ArrayHasher< Hash256 > > m_cache
Definition: RecentHashCache.h:59
void tryAddToCache(const Hash256 &hash, const Timestamp &time)
Definition: RecentHashCache.cpp:72
Timestamp m_lastPruneTime
Definition: RecentHashCache.h:58
TimeSupplier m_timeSupplier
Definition: JointValidator.cpp:85
bool contains(const Hash256 &hash) const
Returns true if the cache contains hash, false otherwise.
Definition: RecentHashCache.cpp:48
void map_erase_if(TMap &map, TPredicate predicate)
Removes all entries from map that fulfill the given predicate.
Definition: ContainerHelpers.h:27
uint64_t PruneInterval
Minimum amount of time between cache pruning.
Definition: HashCheckOptions.h:45
CompareChainsOptions m_options
Definition: CompareChains.cpp:165
supplier< Timestamp > TimeSupplier
Supplies a timestamp.
Definition: ChainFunctions.h:39
utils::BaseValue< uint64_t, Timestamp_tag > Timestamp
Definition: src/catapult/types.h:73
uint64_t MaxCacheSize
Maximum size of the cache.
Definition: HashCheckOptions.h:48
Definition: AddressExtractionExtension.cpp:28
void pruneCache(const Timestamp &time)
Definition: RecentHashCache.cpp:62
RecentHashCache(const chain::TimeSupplier &timeSupplier, const HashCheckOptions &options)
Creates a recent hash cache around timeSupplier and options.
Definition: RecentHashCache.cpp:27
Options for configuring the hash check consumer.
Definition: HashCheckOptions.h:27
chain::TimeSupplier m_timeSupplier
Definition: RecentHashCache.h:56
A hash cache that holds recently seen hashes.
Definition: RecentHashCache.h:31
bool checkAndUpdateExisting(const Hash256 &hash, const Timestamp &time)
Definition: RecentHashCache.cpp:52