Implements the Content Store. More...
#include <daemon/table/cs.hpp>
Public Types | |
using | const_iterator = Table::const_iterator |
Public Member Functions | |
Cs (size_t nMaxPackets=10) | |
const_iterator | begin () const |
void | enableAdmit (bool shouldAdmit) noexcept |
Set CS_ENABLE_ADMIT flag. More... | |
void | enableServe (bool shouldServe) noexcept |
Set CS_ENABLE_SERVE flag. More... | |
const_iterator | end () const |
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 | getLimit () const noexcept |
Get capacity (in number of packets). More... | |
Policy * | getPolicy () const noexcept |
Get replacement policy. More... | |
void | insert (const Data &data, bool isUnsolicited=false) |
Inserts a Data packet. More... | |
void | setLimit (size_t nMaxPackets) |
Change capacity (in number of packets). More... | |
void | setPolicy (unique_ptr< Policy > policy) |
Change replacement policy. More... | |
bool | shouldAdmit () const noexcept |
Get CS_ENABLE_ADMIT flag. More... | |
bool | shouldServe () const noexcept |
Get CS_ENABLE_SERVE flag. More... | |
size_t | size () const |
Get number of stored packets. More... | |
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 |
|
inline |
|
noexcept |
Set CS_ENABLE_ADMIT flag.
|
noexcept |
Set CS_ENABLE_SERVE flag.
|
inline |
|
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 |
|
inlinenoexcept |
|
inlinenoexcept |
void nfd::cs::Cs::insert | ( | const Data & | data, |
bool | isUnsolicited = false |
||
) |
|
inline |
void nfd::cs::Cs::setPolicy | ( | unique_ptr< Policy > | policy | ) |
|
inlinenoexcept |
Get CS_ENABLE_ADMIT flag.
|
inlinenoexcept |
Get CS_ENABLE_SERVE flag.