26 #ifndef NFD_DAEMON_TABLE_CS_POLICY_HPP 27 #define NFD_DAEMON_TABLE_CS_POLICY_HPP 46 Registry& registry = getRegistry();
47 BOOST_ASSERT(registry.count(policyName) == 0);
48 registry[policyName] = [] {
return make_unique<P>(); };
54 static unique_ptr<Policy>
55 create(
const std::string& policyName);
59 static std::set<std::string>
64 Policy(
const std::string& policyName);
180 typedef std::function<unique_ptr<Policy>()> CreateFunc;
181 typedef std::map<std::string, CreateFunc> Registry;
187 std::string m_policyName;
192 inline const std::string&
222 #define NFD_REGISTER_CS_POLICY(P) \ 223 static class NfdAuto ## P ## CsPolicyRegistrationClass \ 226 NfdAuto ## P ## CsPolicyRegistrationClass() \ 228 ::nfd::cs::Policy::registerPolicy<P>(); \ 230 } g_nfdAuto ## P ## CsPolicyRegistrationVariable 232 #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
static unique_ptr< Policy > create(const std::string &policyName)
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
declares ContentStore internal types
provides a lightweight signal / event system
Table::const_iterator iterator
represents a CS replacement policy
#define DECLARE_SIGNAL_EMIT(signalName)
(implementation detail) declares a 'emit_signalName' method
static std::set< std::string > getPolicyNames()
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.
static void registerPolicy(const std::string &policyName=P::POLICY_NAME)
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
implements the Content Store
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
const std::string & getName() const