31 namespace priority_fifo {
43 for (
auto entryInfoMapPair : m_entryInfoMap) {
44 delete entryInfoMapPair.second;
49 PriorityFifoPolicy::doAfterInsert(
iterator i)
56 PriorityFifoPolicy::doAfterRefresh(
iterator i)
63 PriorityFifoPolicy::doBeforeErase(
iterator i)
69 PriorityFifoPolicy::doBeforeUse(
iterator i)
71 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
75 PriorityFifoPolicy::evictEntries()
77 BOOST_ASSERT(this->
getCs() !=
nullptr);
85 PriorityFifoPolicy::evictOne()
102 this->detachQueue(i);
107 PriorityFifoPolicy::attachQueue(
iterator i)
109 BOOST_ASSERT(m_entryInfoMap.find(i) == m_entryInfoMap.end());
112 if (i->isUnsolicited()) {
115 else if (i->isStale()) {
123 bind(&PriorityFifoPolicy::moveToStaleQueue,
this, i));
127 Queue& queue = m_queues[entryInfo->queueType];
128 entryInfo->queueIt = queue.insert(queue.end(), i);
129 m_entryInfoMap[i] = entryInfo;
133 PriorityFifoPolicy::detachQueue(
iterator i)
135 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
137 EntryInfo* entryInfo = m_entryInfoMap[i];
142 m_queues[entryInfo->queueType].erase(entryInfo->queueIt);
143 m_entryInfoMap.erase(i);
148 PriorityFifoPolicy::moveToStaleQueue(
iterator i)
150 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
152 EntryInfo* entryInfo = m_entryInfoMap[i];
153 BOOST_ASSERT(entryInfo->queueType ==
QUEUE_FIFO);
155 m_queues[
QUEUE_FIFO].erase(entryInfo->queueIt);
159 entryInfo->queueIt = queue.insert(queue.end(), i);
160 m_entryInfoMap[i] = entryInfo;
void cancel(const EventId &eventId)
cancel a scheduled event
Cs * getCs() const
gets cs
Copyright (c) 2014-2016, Regents of the University of California, Arizona Board of Regents...
signal::Signal< Policy, iterator > beforeEvict
emits when an entry is being evicted
virtual ~PriorityFifoPolicy()
NFD_REGISTER_CS_POLICY(PriorityFifoPolicy)
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.
static const std::string POLICY_NAME
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
size_t getLimit() const
gets hard limit (in number of entries)
Priority Fifo cs replacement policy.