26 #ifndef NFD_DAEMON_TABLE_CS_POLICY_HPP 27 #define NFD_DAEMON_TABLE_CS_POLICY_HPP 46 const std::string& key = P::POLICY_NAME;
47 Registry& registry = getRegistry();
48 BOOST_ASSERT(registry.count(key) == 0);
49 registry[key] = [] {
return make_unique<P>(); };
54 static unique_ptr<Policy>
55 create(
const std::string& key);
59 Policy(
const std::string& policyName);
175 typedef std::function<unique_ptr<Policy>()> CreateFunc;
176 typedef std::map<std::string, CreateFunc> Registry;
182 std::string m_policyName;
187 inline const std::string&
217 #define NFD_REGISTER_CS_POLICY(P) \ 218 static class NfdAuto ## P ## CsPolicyRegistrationClass \ 221 NfdAuto ## P ## CsPolicyRegistrationClass() \ 223 ::nfd::cs::Policy::registerPolicy<P>(); \ 225 } g_nfdAuto ## P ## CsPolicyRegistrationVariable 227 #endif // NFD_DAEMON_TABLE_CS_POLICY_HPP void setCs(Cs *cs)
sets cs
virtual void evictEntries()=0
evicts zero or more entries
void setLimit(size_t nMaxEntries)
sets hard limit (in number of entries)
Cs * getCs() const
gets cs
signal::Signal< Policy, iterator > beforeEvict
emits when an entry is being evicted
virtual void doAfterRefresh(iterator i)=0
invoked after an existing entry is refreshed by same Data
virtual void doBeforeUse(iterator i)=0
invoked before an entry is used to match a lookup
Copyright (c) 2014-2016, Regents of the University of California, Arizona Board of Regents...
provides a lightweight signal / event system
Table::const_iterator iterator
represents a CS replacement policy
void beforeErase(iterator i)
invoked by CS before an entry is erased due to management command
Copyright (c) 2011-2015 Regents of the University of California.
void beforeUse(iterator i)
invoked by CS before an entry is used to match a lookup
virtual void doBeforeErase(iterator i)=0
invoked before an entry is erased due to management command
static unique_ptr< Policy > create(const std::string &key)
#define DECLARE_SIGNAL_EMIT(signalName)
(implementation detail) declares a 'emit_signalName' method
represents the ContentStore
void afterInsert(iterator i)
invoked by CS after a new entry is inserted
virtual ~Policy()=default
virtual void doAfterInsert(iterator i)=0
invoked after a new entry is created in CS
Policy(const std::string &policyName)
size_t getLimit() const
gets hard limit (in number of entries)
void afterRefresh(iterator i)
invoked by CS after an existing entry is refreshed by same Data
static void registerPolicy()
const std::string & getName() const