Provides in-memory storage employing First-In-First-Out (FIFO) replacement policy. More...
#include <ndn-cxx/ims/in-memory-storage-fifo.hpp>
Public Types | |
using | Cache = boost::multi_index_container< InMemoryStorageEntry *, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< byFullName >, boost::multi_index::const_mem_fun< InMemoryStorageEntry, const Name &, &InMemoryStorageEntry::getFullName >, std::less< Name > > > > |
Public Member Functions | |
InMemoryStorageFifo (boost::asio::io_context &ioCtx, size_t limit=16) | |
InMemoryStorageFifo (size_t limit=16) | |
InMemoryStorage::const_iterator | begin () const |
Returns begin iterator of the in-memory storage ordering by name with digest. More... | |
InMemoryStorage::const_iterator | end () const |
Returns end iterator of the in-memory storage ordering by name with digest. More... | |
void | erase (const Name &prefix, const bool isPrefix=true) |
Deletes in-memory storage entry by prefix by default. More... | |
shared_ptr< const Data > | find (const Interest &interest) |
Finds the best match Data for an Interest. More... | |
shared_ptr< const Data > | find (const Name &name) |
Finds the best match Data for a Name with or without implicit digest. More... | |
size_t | getLimit () const |
void | insert (const Data &data, const time::milliseconds &mustBeFreshProcessingWindow=INFINITE_WINDOW) |
Inserts a Data packet. More... | |
size_t | size () const |
Static Public Attributes | |
static constexpr time::milliseconds | INFINITE_WINDOW = -1_ms |
Protected Member Functions | |
virtual void | afterAccess (InMemoryStorageEntry *entry) |
Update the entry when the entry is returned by the find() function according to derived class implemented replacement policy. More... | |
void | afterInsert (InMemoryStorageEntry *entry) override |
Update the entry after a entry is successfully inserted, add it to the cleanupIndex. More... | |
void | beforeErase (InMemoryStorageEntry *entry) override |
Update the entry or other data structures before a entry is successfully erased, erase it from the cleanupIndex. More... | |
void | eraseImpl (const Name &name) |
Deletes in-memory storage entries by the Name with implicit digest. More... | |
bool | evictItem () override |
Removes one Data packet from in-memory storage based on FIFO. More... | |
size_t | getCapacity () const |
Returns current capacity of in-memory storage (in packets). More... | |
bool | isFull () const |
Returns true if the in-memory storage uses up the current capacity, false otherwise. More... | |
void | printCache (std::ostream &os) const |
Prints contents of the in-memory storage. More... | |
void | setCapacity (size_t nMaxPackets) |
Sets current capacity of in-memory storage (in packets). More... | |
Provides in-memory storage employing First-In-First-Out (FIFO) replacement policy.
Definition at line 36 of file in-memory-storage-fifo.hpp.
|
inherited |
Definition at line 47 of file in-memory-storage.hpp.
|
explicit |
Definition at line 26 of file in-memory-storage-fifo.cpp.
|
explicit |
Definition at line 31 of file in-memory-storage-fifo.cpp.
|
protectedvirtualinherited |
Update the entry when the entry is returned by the find() function according to derived class implemented replacement policy.
Reimplemented in ndn::InMemoryStorageLru, and ndn::InMemoryStorageLfu.
Definition at line 337 of file in-memory-storage.cpp.
|
overrideprotectedvirtual |
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
Reimplemented from ndn::InMemoryStorage.
Definition at line 37 of file in-memory-storage-fifo.cpp.
|
overrideprotectedvirtual |
Update the entry or other data structures before a entry is successfully erased, erase it from the cleanupIndex.
Reimplemented from ndn::InMemoryStorage.
Definition at line 57 of file in-memory-storage-fifo.cpp.
|
inherited |
Returns begin iterator of the in-memory storage ordering by name with digest.
Definition at line 313 of file in-memory-storage.cpp.
|
inherited |
Returns end iterator of the in-memory storage ordering by name with digest.
Definition at line 320 of file in-memory-storage.cpp.
|
inherited |
Deletes in-memory storage entry by prefix by default.
prefix | Exact name of a prefix of the data to remove |
isPrefix | If false, the function will only delete the entry completely matched with the prefix according to canonical ordering. For this case, user should substitute the prefix with full name. |
Definition at line 278 of file in-memory-storage.cpp.
|
protectedinherited |
Deletes in-memory storage entries by the Name with implicit digest.
This is the function one should use to erase entry in the cache in derived class. It won't invoke beforeErase(shared_ptr<Entry>).
Definition at line 303 of file in-memory-storage.cpp.
|
overrideprotectedvirtual |
Removes one Data packet from in-memory storage based on FIFO.
Implements ndn::InMemoryStorage.
Definition at line 44 of file in-memory-storage-fifo.cpp.
Finds the best match Data for an Interest.
Definition at line 174 of file in-memory-storage.cpp.
Finds the best match Data for a Name with or without implicit digest.
If packets with the same name but different digests exist and the Name supplied is the one without implicit digest, a packet will be arbitrarily chosen to return.
Definition at line 155 of file in-memory-storage.cpp.
|
inlineprotectedinherited |
Returns current capacity of in-memory storage (in packets).
Definition at line 261 of file in-memory-storage.hpp.
|
inlineinherited |
Definition at line 193 of file in-memory-storage.hpp.
|
inherited |
Inserts a Data packet.
data | the packet to insert, must be signed and have wire encoding |
mustBeFreshProcessingWindow | Beyond this time period, the inserted data can only be used to answer interest without MustBeFresh. The value of mustBeFreshProcessingWindow is an application decision and it may or may not correspond to FreshnessPeriod. |
mustBeFreshProcessingWindow
value.Definition at line 118 of file in-memory-storage.cpp.
|
inlineprotectedinherited |
Returns true if the in-memory storage uses up the current capacity, false otherwise.
Definition at line 269 of file in-memory-storage.hpp.
|
protectedinherited |
Prints contents of the in-memory storage.
Definition at line 342 of file in-memory-storage.cpp.
|
protectedinherited |
Sets current capacity of in-memory storage (in packets).
Definition at line 88 of file in-memory-storage.cpp.
|
inlineinherited |
Definition at line 201 of file in-memory-storage.hpp.
|
staticconstexprinherited |
Definition at line 328 of file in-memory-storage.hpp.