implements the Content Store More...
#include <cs.hpp>
Public Types | |
using | const_iterator = Table::const_iterator |
Public Member Functions | |
Cs (size_t nMaxPackets=10) | |
void | insert (const Data &data, bool isUnsolicited=false) |
inserts a Data packet More... | |
template<typename AfterEraseCallback > | |
void | erase (const Name &prefix, size_t limit, AfterEraseCallback &&cb) |
asynchronously erases entries under prefix More... | |
template<typename HitCallback , typename MissCallback > | |
void | find (const Interest &interest, HitCallback &&hit, MissCallback &&miss) const |
finds the best matching Data packet More... | |
size_t | size () const |
get number of stored packets More... | |
size_t | getLimit () const |
get capacity (in number of packets) More... | |
void | setLimit (size_t nMaxPackets) |
change capacity (in number of packets) More... | |
Policy * | getPolicy () const |
get replacement policy More... | |
void | setPolicy (unique_ptr< Policy > policy) |
change replacement policy More... | |
bool | shouldAdmit () const |
get CS_ENABLE_ADMIT flag More... | |
void | enableAdmit (bool shouldAdmit) |
set CS_ENABLE_ADMIT flag More... | |
bool | shouldServe () const |
get CS_ENABLE_SERVE flag More... | |
void | enableServe (bool shouldServe) |
set CS_ENABLE_SERVE flag More... | |
const_iterator | begin () const |
const_iterator | end () const |
implements the Content Store
This Content Store implementation consists of a Table and a replacement policy.
The Table is a container ( std::set
) sorted by full Names of stored Data packets. Data packets are wrapped in Entry objects. Each Entry contains the Data packet itself, and a few additional attributes such as when the Data becomes non-fresh.
The replacement policy is implemented in a subclass of Policy
.
using nfd::cs::Cs::const_iterator = Table::const_iterator |
|
explicit |
Definition at line 44 of file cs.cpp.
References nfd::cs::makeDefaultPolicy().
void nfd::cs::Cs::insert | ( | const Data & | data, |
bool | isUnsolicited = false |
||
) |
inserts a Data packet
Definition at line 51 of file cs.cpp.
References nfd::cs::Entry::clearUnsolicited(), ndn::SimpleTag< T, TypeId >::get(), ndn::Data::getName(), ndn::TagHost::getTag(), nfd::cs::Entry::isUnsolicited(), NFD_LOG_DEBUG, and nfd::cs::Entry::updateFreshUntil().
|
inline |
asynchronously erases entries under prefix
AfterEraseCallback | void f(size_t nErased) |
prefix | name prefix of entries |
limit | max number of entries to erase |
cb | callback to receive the actual number of erased entries; must not be empty; it may be invoked either before or after erase() returns |
|
inline |
finds the best matching Data packet
HitCallback | void f(const Interest&, const Data&) |
MissCallback | void f(const Interest&) |
interest | the Interest for lookup |
hit | a callback if a match is found; must not be empty |
miss | a callback if there's no match; must not be empty |
|
inline |
|
inline |
|
inline |
change capacity (in number of packets)
Definition at line 111 of file cs.hpp.
Referenced by nfd::TablesConfigSection::ensureConfigured().
|
inline |
void nfd::cs::Cs::setPolicy | ( | unique_ptr< Policy > | policy | ) |
change replacement policy
Definition at line 144 of file cs.cpp.
References nonstd::optional_lite::std11::move().
|
inline |
void nfd::cs::Cs::enableAdmit | ( | bool | shouldAdmit | ) |
set CS_ENABLE_ADMIT flag
Definition at line 165 of file cs.cpp.
References NFD_LOG_INFO, and shouldAdmit().
|
inline |
void nfd::cs::Cs::enableServe | ( | bool | shouldServe | ) |
set CS_ENABLE_SERVE flag
Definition at line 175 of file cs.cpp.
References NFD_LOG_INFO, and shouldServe().
|
inline |
|
inline |