30 #ifndef NFD_DAEMON_TABLE_CS_HPP
31 #define NFD_DAEMON_TABLE_CS_HPP
36 #include <boost/multi_index/member.hpp>
37 #include <boost/multi_index_container.hpp>
38 #include <boost/multi_index/ordered_index.hpp>
39 #include <boost/multi_index/sequenced_index.hpp>
40 #include <boost/multi_index/identity.hpp>
83 typedef boost::multi_index_container<
85 boost::multi_index::indexed_by<
88 boost::multi_index::sequenced<
89 boost::multi_index::tag<byArrival>
93 boost::multi_index::ordered_non_unique<
94 boost::multi_index::tag<byStaleness>,
95 boost::multi_index::identity<cs::skip_list::Entry*>,
100 boost::multi_index::ordered_non_unique<
101 boost::multi_index::tag<unsolicited>,
102 boost::multi_index::identity<cs::skip_list::Entry*>,
111 class Cs : noncopyable
115 Cs(
size_t nMaxPackets = 10);
128 insert(
const Data& data,
bool isUnsolicited =
false);
134 find(
const Interest& interest)
const;
174 class const_iterator :
public std::iterator<std::forward_iterator_tag, const cs::Entry>
202 SkipListLayer::const_iterator m_skipListIterator;
225 pickRandomLayer()
const;
231 std::pair<cs::skip_list::Entry*, bool>
232 insertToSkipList(
const Data& data,
bool isUnsolicited =
false);
243 printSkipList()
const;
258 selectChild(
const Interest& interest, SkipListLayer::iterator startingPoint)
const;
265 doesComplyWithSelectors(
const Interest& interest,
267 bool doesInterestContainDigest)
const;
279 size_t m_nMaxPackets;
281 std::queue<cs::skip_list::Entry*> m_freeCsEntries;
298 : m_skipListIterator(it)
310 ++m_skipListIterator;
322 inline Cs::const_iterator::reference
325 return *(this->operator->());
328 inline Cs::const_iterator::pointer
331 return *m_skipListIterator;
337 return m_skipListIterator == other.m_skipListIterator;
343 return !(*
this == other);
348 #endif // NFD_DAEMON_TABLE_CS_HPP
void erase(const Name &exactName)
deletes CS entry by the exact name
reference operator*() const
bool evictItem()
removes one Data packet from Content Store based on replacement policy
const_iterator begin() const
returns an iterator pointing to the first CS entry
pointer operator->() const
std::list< cs::skip_list::Entry * > SkipListLayer
const_iterator end() const
returns an iterator referring to the past-the-end CS entry
const Data * find(const Interest &interest) const
finds the best match Data for an Interest
std::list< SkipListLayer * > SkipList
size_t getLimit() const
returns maximum allowed size of Content Store (in packets)
bool insert(const Data &data, bool isUnsolicited=false)
inserts a Data packet This method does not consider the payload of the Data packet.
size_t size() const
returns current size of Content Store measured in packets
bool operator!=(const const_iterator &other) const
const_iterator & operator++()
bool isUnsolicited() const
Data packet is unsolicited if this particular NDN node did not receive an Interest packet for it...
bool operator()(bool isUnsolicited, const cs::skip_list::Entry *entry) const
const time::steady_clock::TimePoint & getStaleTime() const
returns the absolute time when Data becomes expired
bool operator()(const cs::skip_list::Entry *entry1, const cs::skip_list::Entry *entry2) const
boost::multi_index_container< cs::skip_list::Entry *, boost::multi_index::indexed_by< boost::multi_index::sequenced< boost::multi_index::tag< byArrival > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< byStaleness >, boost::multi_index::identity< cs::skip_list::Entry * >, StalenessComparator >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< unsolicited >, boost::multi_index::identity< cs::skip_list::Entry * >, UnsolicitedComparator > >> CleanupIndex
bool operator()(const cs::skip_list::Entry *entry1, const cs::skip_list::Entry *entry2) const
represents an entry in a CS with skip list implementation
void setLimit(size_t nMaxPackets)
sets maximum allowed size of Content Store (in packets)
Cs(size_t nMaxPackets=10)
bool operator==(const const_iterator &other) const