28 #include <ndn-cxx/util/signal.hpp> 32 namespace priority_fifo {
42 PriorityFifoPolicy::doAfterInsert(
iterator i)
49 PriorityFifoPolicy::doAfterRefresh(
iterator i)
56 PriorityFifoPolicy::doBeforeErase(
iterator i)
62 PriorityFifoPolicy::doBeforeUse(
iterator i)
64 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
68 PriorityFifoPolicy::evictEntries()
70 BOOST_ASSERT(this->
getCs() !=
nullptr);
78 PriorityFifoPolicy::evictOne()
100 PriorityFifoPolicy::attachQueue(
iterator i)
102 BOOST_ASSERT(m_entryInfoMap.find(i) == m_entryInfoMap.end());
105 if (i->isUnsolicited()) {
108 else if (i->isStale()) {
116 bind(&PriorityFifoPolicy::moveToStaleQueue,
this, i));
120 Queue& queue = m_queues[entryInfo->queueType];
121 entryInfo->queueIt = queue.insert(queue.end(), i);
122 m_entryInfoMap[i] = entryInfo;
126 PriorityFifoPolicy::detachQueue(
iterator i)
128 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
130 EntryInfo* entryInfo = m_entryInfoMap[i];
135 m_queues[entryInfo->queueType].erase(entryInfo->queueIt);
136 m_entryInfoMap.erase(i);
140 PriorityFifoPolicy::moveToStaleQueue(
iterator i)
142 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
144 EntryInfo* entryInfo = m_entryInfoMap[i];
145 BOOST_ASSERT(entryInfo->queueType ==
QUEUE_FIFO);
147 m_queues[
QUEUE_FIFO].erase(entryInfo->queueIt);
151 entryInfo->queueIt = queue.insert(queue.end(), i);
152 m_entryInfoMap[i] = entryInfo;
void cancel(const EventId &eventId)
cancel a scheduled event
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
signal::Signal< Policy, iterator > beforeEvict
emits when an entry is being evicted
Table::const_iterator iterator
represents a CS replacement policy
#define emitSignal(...)
(implementation detail)
std::list< iterator > Queue
Copyright (c) 2011-2015 Regents of the University of California.
EventId schedule(const time::nanoseconds &after, const std::function< void()> &event)
schedule an event
static const std::string POLICY_NAME
size_t getLimit() const
gets hard limit (in number of entries)
Cs * getCs() const
gets cs