mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Template abstract_clock on Clock:
The abstract_clock is now templated on a type meeting the requirements of the Clock concept. It inherits the nested types of the Clock on which it is based. This resolves a problem with the original design which broke the type-safety of time_point from different abstract clocks.
This commit is contained in:
committed by
Nik Bougalis
parent
7d72dfe0be
commit
55637f7508
@@ -36,8 +36,8 @@ namespace Validators {
|
||||
// Forward declare unit test so it can be a friend to LRUCache.
|
||||
class Logic_test;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
namespace detail {
|
||||
|
||||
// The LRUCache class (ab)uses an aged_unordered_set so it can hold on
|
||||
// to a limited number of values. When the container gets too full the
|
||||
// LRUCache expires the oldest values.
|
||||
@@ -58,10 +58,9 @@ template <class Key,
|
||||
class LRUCache
|
||||
{
|
||||
private:
|
||||
typedef std::chrono::seconds Duration;
|
||||
typedef beast::manual_clock <Duration> Clock;
|
||||
typedef beast::manual_clock <std::chrono::steady_clock> Clock;
|
||||
typedef beast::aged_unordered_set <
|
||||
Key, Duration, Hash, KeyEqual, Allocator> ContainerType;
|
||||
Key, std::chrono::steady_clock, Hash, KeyEqual, Allocator> ContainerType;
|
||||
|
||||
public:
|
||||
LRUCache () = delete;
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
// Holds the Entry of all recent ledgers for this validator.
|
||||
#if 1
|
||||
typedef beast::aged_unordered_map <RippleLedgerHash, Entry,
|
||||
std::chrono::seconds, beast::hardened_hash<>,
|
||||
std::chrono::steady_clock, beast::hardened_hash<>,
|
||||
RippleLedgerHash::key_equal> Table;
|
||||
#else
|
||||
typedef beast::aged_map <RippleLedgerHash, Entry,
|
||||
|
||||
Reference in New Issue
Block a user