26 #ifndef NFD_DAEMON_TABLE_DEAD_NONCE_LIST_HPP
27 #define NFD_DAEMON_TABLE_DEAD_NONCE_LIST_HPP
31 #include <boost/multi_index_container.hpp>
32 #include <boost/multi_index/hashed_index.hpp>
33 #include <boost/multi_index/sequenced_index.hpp>
72 has(
const Name& name, Interest::Nonce nonce)
const;
78 add(
const Name& name, Interest::Nonce nonce);
97 using Entry = uint64_t;
100 makeEntry(
const Name& name, Interest::Nonce nonce);
132 const time::nanoseconds m_lifetime;
136 using Container = boost::multi_index_container<
138 boost::multi_index::indexed_by<
139 boost::multi_index::sequenced<boost::multi_index::tag<Queue>>,
140 boost::multi_index::hashed_non_unique<boost::multi_index::tag<Hashtable>,
141 boost::multi_index::identity<Entry>>
146 Container::index<Queue>::type& m_queue = m_index.get<
Queue>();
147 Container::index<Hashtable>::type& m_ht = m_index.get<Hashtable>();
162 static constexpr
size_t INITIAL_CAPACITY = 1 << 14;
168 static constexpr
size_t MIN_CAPACITY = 1 << 10;
174 static constexpr
size_t MAX_CAPACITY = 1 << 24;
184 static constexpr Entry MARK = 0;
187 static constexpr
size_t EXPECTED_MARK_COUNT = 5;
194 std::multiset<size_t> m_actualMarkCounts;
196 const time::nanoseconds m_markInterval;
197 scheduler::ScopedEventId m_markEvent;
201 static constexpr
double CAPACITY_UP = 1.2;
202 static constexpr
double CAPACITY_DOWN = 0.9;
203 const time::nanoseconds m_adjustCapacityInterval;
204 scheduler::ScopedEventId m_adjustCapacityEvent;
207 static constexpr
size_t EVICT_LIMIT = 64;
Represents the Dead Nonce List.
time::nanoseconds getLifetime() const
Returns the expected nonce lifetime.
static constexpr time::nanoseconds MIN_LIFETIME
Minimum entry lifetime.
static constexpr time::nanoseconds DEFAULT_LIFETIME
Default entry lifetime.
DeadNonceList(time::nanoseconds lifetime=DEFAULT_LIFETIME)
Constructs the Dead Nonce List.
size_t size() const
Returns the number of stored nonces.
void add(const Name &name, Interest::Nonce nonce)
Adds name+nonce to the list.
bool has(const Name &name, Interest::Nonce nonce) const
Determines if name+nonce is in the list.
#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE
boost::multi_index_container< Policy::EntryRef, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::ordered_unique< boost::multi_index::identity< Policy::EntryRef > > > > Queue