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()) {
121 bind(&PriorityFifoPolicy::moveToStaleQueue,
this, i));
124 Queue& queue = m_queues[entryInfo->queueType];
125 entryInfo->queueIt = queue.insert(queue.end(), i);
126 m_entryInfoMap[i] = entryInfo;
130 PriorityFifoPolicy::detachQueue(
iterator i)
132 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
134 EntryInfo* entryInfo = m_entryInfoMap[i];
139 m_queues[entryInfo->queueType].erase(entryInfo->queueIt);
140 m_entryInfoMap.erase(i);
145 PriorityFifoPolicy::moveToStaleQueue(
iterator i)
147 BOOST_ASSERT(m_entryInfoMap.find(i) != m_entryInfoMap.end());
149 EntryInfo* entryInfo = m_entryInfoMap[i];
150 BOOST_ASSERT(entryInfo->queueType ==
QUEUE_FIFO);
152 m_queues[
QUEUE_FIFO].erase(entryInfo->queueIt);
156 entryInfo->queueIt = queue.insert(queue.end(), i);
157 m_entryInfoMap[i] = entryInfo;
void cancel(const EventId &eventId)
cancel a scheduled event
implements the ContentStore
signal::Signal< Policy, iterator > beforeEvict
emits when an entry is being evicted
virtual ~PriorityFifoPolicy()
NFD_REGISTER_CS_POLICY(PriorityFifoPolicy)
#define emitSignal(...)
(implementation detail)
Table::const_iterator iterator
represents a CS replacement policy
std::list< iterator > Queue
Copyright (c) 2011-2015 Regents of the University of California.
static const std::string POLICY_NAME
size_t getLimit() const
gets hard limit (in number of entries)
Cs * getCs() const
gets cs
EventId schedule(time::nanoseconds after, const EventCallback &event)
schedule an event
Priority Fifo cs replacement policy.