29 #include <boost/range/adaptor/map.hpp> 30 #include <boost/range/algorithm/copy.hpp> 40 static Registry registry;
47 Registry& registry = getRegistry();
48 auto i = registry.find(policyName);
49 return i == registry.end() ?
nullptr : i->second();
55 std::set<std::string> policyNames;
56 boost::copy(getRegistry() | boost::adaptors::map_keys,
57 std::inserter(policyNames, policyNames.end()));
62 : m_policyName(policyName)
70 m_limit = nMaxEntries;
77 BOOST_ASSERT(m_cs !=
nullptr);
84 BOOST_ASSERT(m_cs !=
nullptr);
91 BOOST_ASSERT(m_cs !=
nullptr);
98 BOOST_ASSERT(m_cs !=
nullptr);
implements the ContentStore
void beforeUse(iterator i)
invoked by CS before an entry is used to match a lookup
void beforeErase(iterator i)
invoked by CS before an entry is erased due to management command
void afterRefresh(iterator i)
invoked by CS after an existing entry is refreshed by same Data
static unique_ptr< Policy > create(const std::string &policyName)
void afterInsert(iterator i)
invoked by CS after a new entry is inserted
virtual void doBeforeErase(iterator i)=0
invoked before an entry is erased due to management command
virtual void doAfterRefresh(iterator i)=0
invoked after an existing entry is refreshed by same Data
Table::const_iterator iterator
#define NFD_LOG_INFO(expression)
virtual void evictEntries()=0
evicts zero or more entries
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
static std::set< std::string > getPolicyNames()
virtual void doAfterInsert(iterator i)=0
invoked after a new entry is created in CS
#define NFD_LOG_INIT(name)
virtual void doBeforeUse(iterator i)=0
invoked before an entry is used to match a lookup
void setLimit(size_t nMaxEntries)
sets hard limit (in number of entries)
Policy(const std::string &policyName)