nfd::cs::priority_fifo::PriorityFifoPolicy Class Reference

Priority Fifo cs replacement policy. More...

#include <cs-policy-priority-fifo.hpp>

Inheritance diagram for nfd::cs::priority_fifo::PriorityFifoPolicy:
Collaboration diagram for nfd::cs::priority_fifo::PriorityFifoPolicy:

Public Member Functions

 PriorityFifoPolicy ()
 
virtual ~PriorityFifoPolicy ()
 
const std::string & getName () const
 
CsgetCs () const
 gets cs More...
 
void setCs (Cs *cs)
 sets cs More...
 
size_t getLimit () const
 gets hard limit (in number of entries) More...
 
void setLimit (size_t nMaxEntries)
 sets hard limit (in number of entries) More...
 
void afterInsert (iterator i)
 invoked by CS after a new entry is inserted More...
 
void afterRefresh (iterator i)
 invoked by CS after an existing entry is refreshed by same Data More...
 
void beforeErase (iterator i)
 invoked by CS before an entry is erased due to management command More...
 
void beforeUse (iterator i)
 invoked by CS before an entry is used to match a lookup More...
 

Static Public Member Functions

template<typename P >
static void registerPolicy (const std::string &policyName=P::POLICY_NAME)
 
static unique_ptr< Policycreate (const std::string &policyName)
 
static std::set< std::string > getPolicyNames ()
 

Public Attributes

signal::Signal< Policy, iteratorbeforeEvict
 emits when an entry is being evicted More...
 

Static Public Attributes

static const std::string POLICY_NAME = "priority_fifo"
 

Detailed Description

Priority Fifo cs replacement policy.

The entries that get removed first are unsolicited Data packets, which are the Data packets that got cached opportunistically without preceding forwarding of the corresponding Interest packet. Next, the Data packets with expired freshness are removed. Last, the Data packets are removed from the Content Store on a pure FIFO basis.

Definition at line 72 of file cs-policy-priority-fifo.hpp.

Constructor & Destructor Documentation

nfd::cs::priority_fifo::PriorityFifoPolicy::PriorityFifoPolicy ( )

Definition at line 36 of file cs-policy-priority-fifo.cpp.

nfd::cs::priority_fifo::PriorityFifoPolicy::~PriorityFifoPolicy ( )
virtual

Definition at line 41 of file cs-policy-priority-fifo.cpp.

Member Function Documentation

void nfd::cs::Policy::afterInsert ( iterator  i)
inherited

invoked by CS after a new entry is inserted

Postcondition
cs.size() <= getLimit()

The policy may evict entries if necessary. During this process, i might be evicted.

Definition at line 75 of file cs-policy.cpp.

void nfd::cs::Policy::afterRefresh ( iterator  i)
inherited

invoked by CS after an existing entry is refreshed by same Data

The policy may witness this refresh to make better eviction decisions in the future.

Definition at line 82 of file cs-policy.cpp.

void nfd::cs::Policy::beforeErase ( iterator  i)
inherited

invoked by CS before an entry is erased due to management command

Warning
CS must not invoke this method if an entry is erased due to eviction.

Definition at line 89 of file cs-policy.cpp.

void nfd::cs::Policy::beforeUse ( iterator  i)
inherited

invoked by CS before an entry is used to match a lookup

The policy may witness this usage to make better eviction decisions in the future.

Definition at line 96 of file cs-policy.cpp.

unique_ptr< Policy > nfd::cs::Policy::create ( const std::string &  policyName)
staticinherited
Returns
a cs::Policy identified by policyName, or nullptr if policyName is unknown

Definition at line 45 of file cs-policy.cpp.

Cs * nfd::cs::Policy::getCs ( ) const
inlineinherited

gets cs

Definition at line 199 of file cs-policy.hpp.

size_t nfd::cs::Policy::getLimit ( ) const
inlineinherited

gets hard limit (in number of entries)

Definition at line 211 of file cs-policy.hpp.

const std::string & nfd::cs::Policy::getName ( ) const
inlineinherited

Definition at line 193 of file cs-policy.hpp.

std::set< std::string > nfd::cs::Policy::getPolicyNames ( )
staticinherited
Returns
a list of available policy names

Definition at line 53 of file cs-policy.cpp.

template<typename P >
static void nfd::cs::Policy::registerPolicy ( const std::string &  policyName = P::POLICY_NAME)
inlinestaticinherited

Definition at line 44 of file cs-policy.hpp.

void nfd::cs::Policy::setCs ( Cs cs)
inlineinherited

sets cs

Definition at line 205 of file cs-policy.hpp.

void nfd::cs::Policy::setLimit ( size_t  nMaxEntries)
inherited

sets hard limit (in number of entries)

Postcondition
getLimit() == nMaxEntries
cs.size() <= getLimit()

The policy may evict entries if necessary.

Definition at line 67 of file cs-policy.cpp.

Member Data Documentation

signal::Signal<Policy, iterator> nfd::cs::Policy::beforeEvict
inherited

emits when an entry is being evicted

A policy implementation should emit this signal to cause CS to erase the entry from its index. CS should connect to this signal and erase the entry upon signal emission.

Definition at line 102 of file cs-policy.hpp.

const std::string nfd::cs::priority_fifo::PriorityFifoPolicy::POLICY_NAME = "priority_fifo"
static

Definition at line 81 of file cs-policy-priority-fifo.hpp.