26 #ifndef NFD_DAEMON_TABLE_CS_POLICY_HPP 27 #define NFD_DAEMON_TABLE_CS_POLICY_HPP 45 Registry& registry = getRegistry();
46 BOOST_ASSERT(registry.count(policyName) == 0);
47 registry[policyName] = [] {
return make_unique<P>(); };
53 static unique_ptr<Policy>
54 create(
const std::string& policyName);
58 static std::set<std::string>
63 Policy(
const std::string& policyName);
196 using CreateFunc = std::function<unique_ptr<Policy>()>;
197 using Registry = std::map<std::string, CreateFunc>;
203 std::string m_policyName;
214 #define NFD_REGISTER_CS_POLICY(P) \ 215 static class NfdAuto ## P ## CsPolicyRegistrationClass \ 218 NfdAuto ## P ## CsPolicyRegistrationClass() \ 220 ::nfd::cs::Policy::registerPolicy<P>(); \ 222 } g_nfdAuto ## P ## CsPolicyRegistrationVariable 224 #endif // NFD_DAEMON_TABLE_CS_POLICY_HPP void setCs(Cs *cs)
sets cs
virtual void evictEntries()=0
evicts zero or more entries
Cs * getCs() const
gets cs
void afterRefresh(EntryRef i)
invoked by CS after an existing entry is refreshed by same Data
virtual void doAfterInsert(EntryRef i)=0
invoked after a new entry is created in CS
void setLimit(size_t nMaxEntries)
sets hard limit (in number of entries)
static unique_ptr< Policy > create(const std::string &policyName)
provides a lightweight signal / event system
void beforeErase(EntryRef i)
invoked by CS before an entry is erased due to management command
represents a CS replacement policy
void afterInsert(EntryRef i)
invoked by CS after a new entry is inserted
#define DECLARE_SIGNAL_EMIT(signalName)
(implementation detail) declares a 'emit_signalName' method
static std::set< std::string > getPolicyNames()
virtual void doAfterRefresh(EntryRef i)=0
invoked after an existing entry is refreshed by same Data
Copyright (c) 2011-2015 Regents of the University of California.
static void registerPolicy(const std::string &policyName=P::POLICY_NAME)
void beforeUse(EntryRef i)
invoked by CS before an entry is used to match a lookup
Table::const_iterator EntryRef
a reference to an CS entry
virtual void doBeforeUse(EntryRef i)=0
invoked before an entry is used to match a lookup
implements the Content Store
virtual ~Policy()=default
const std::string & getName() const
signal::Signal< Policy, EntryRef > beforeEvict
emits when an entry is being evicted
Policy(const std::string &policyName)
virtual void doBeforeErase(EntryRef i)=0
invoked before an entry is erased due to management command
size_t getLimit() const
gets hard limit (in number of entries)