implements the Content Store More...
#include <cs.hpp>


Classes | |
| struct | EntryFromEntryImpl |
Public Types | |
| using | AfterEraseCallback = std::function< void(size_t nErased)> |
| using | HitCallback = std::function< void(const Interest &, const Data &)> |
| using | MissCallback = std::function< void(const Interest &)> |
| typedef boost::transform_iterator< EntryFromEntryImpl, iterator, const Entry & > | const_iterator |
| ContentStore iterator (public API) More... | |
Public Member Functions | |
| Cs (size_t nMaxPackets=10) | |
| void | insert (const Data &data, bool isUnsolicited=false) |
| inserts a Data packet More... | |
| void | erase (const Name &prefix, size_t limit, const AfterEraseCallback &cb) |
asynchronously erases entries under prefix More... | |
| void | find (const Interest &interest, const HitCallback &hitCallback, const MissCallback &missCallback) 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::AfterEraseCallback = std::function<void(size_t nErased)> |
| using nfd::cs::Cs::HitCallback = std::function<void(const Interest&, const Data&)> |
| using nfd::cs::Cs::MissCallback = std::function<void(const Interest&)> |
| typedef boost::transform_iterator<EntryFromEntryImpl, iterator, const Entry&> nfd::cs::Cs::const_iterator |
|
explicit |
Definition at line 46 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 55 of file cs.cpp.
References ndn::SimpleTag< T, TypeId >::get(), ndn::Data::getName(), ndn::TagHost::getTag(), nfd::cs::Entry::isUnsolicited(), NFD_LOG_DEBUG, nfd::cs::EntryImpl::unsetUnsolicited(), and nfd::cs::Entry::updateStaleTime().
| void nfd::cs::Cs::erase | ( | const Name & | prefix, |
| size_t | limit, | ||
| const AfterEraseCallback & | cb | ||
| ) |
asynchronously erases entries under prefix
| prefix | name prefix of entries |
| limit | max number of entries to erase |
| cb | callback to receive the actual number of erased entries; it may be empty; it may be invoked either before or after erase() returns |
Definition at line 92 of file cs.cpp.
References ndn::Name::getSuccessor(), and ndn::Name::size().
| void nfd::cs::Cs::find | ( | const Interest & | interest, |
| const HitCallback & | hitCallback, | ||
| const MissCallback & | missCallback | ||
| ) | const |
finds the best matching Data packet
| interest | the Interest for lookup |
| hitCallback | a callback if a match is found; must not be empty |
| missCallback | a callback if there's no match; must not be empty |
Definition at line 115 of file cs.cpp.
References ndn::Interest::getChildSelector(), ndn::Interest::getName(), ndn::Name::getSuccessor(), NFD_LOG_DEBUG, and ndn::Name::size().
|
inline |
|
inline |
|
inline |
change capacity (in number of packets)
Definition at line 105 of file cs.hpp.
Referenced by nfd::TablesConfigSection::ensureConfigured().
|
inline |
| void nfd::cs::Cs::setPolicy | ( | unique_ptr< Policy > | policy | ) |
|
inline |
| void nfd::cs::Cs::enableAdmit | ( | bool | shouldAdmit | ) |
set CS_ENABLE_ADMIT flag
Definition at line 231 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 241 of file cs.cpp.
References NFD_LOG_INFO, and shouldServe().
|
inline |
|
inline |