nfd::pit::Entry Class Reference

Represents an entry in the Interest table (PIT). More...

#include <daemon/table/pit-entry.hpp>

+ Inheritance diagram for nfd::pit::Entry:
+ Collaboration diagram for nfd::pit::Entry:

Public Member Functions

 Entry (const Interest &interest)
 
bool canMatch (const Interest &interest, size_t nEqualNameComps=0) const
 
void clearInRecords () noexcept
 Removes all in-records. More...
 
void clearStrategyInfo ()
 Clear all StrategyInfo items. More...
 
void deleteInRecord (InRecordCollection::const_iterator pos)
 Removes the in-record at position pos. More...
 
void deleteOutRecord (const Face &face)
 Delete the out-record for face if it exists. More...
 
template<typename T >
size_t eraseStrategyInfo ()
 Erase a StrategyInfo item. More...
 
InRecordCollection::iterator findInRecord (const Face &face) noexcept
 Get the in-record for face. More...
 
OutRecordCollection::iterator findOutRecord (const Face &face) noexcept
 Get the out-record for face. More...
 
const InRecordCollectiongetInRecords () const noexcept
 Returns the collection of in-records. More...
 
const Interest & getInterest () const
 
const Name & getName () const
 
const OutRecordCollectiongetOutRecords () const noexcept
 Returns the collection of out-records. More...
 
template<typename T >
T * getStrategyInfo () const
 Get a StrategyInfo item. More...
 
bool hasInRecords () const noexcept
 
bool hasOutRecords () const noexcept
 
InRecordCollection::const_iterator in_begin () const noexcept
 
InRecordCollection::iterator in_begin () noexcept
 
InRecordCollection::const_iterator in_end () const noexcept
 
InRecordCollection::iterator in_end () noexcept
 
InRecordCollection::iterator insertOrUpdateInRecord (Face &face, const Interest &interest)
 Insert or update an in-record. More...
 
OutRecordCollection::iterator insertOrUpdateOutRecord (Face &face, const Interest &interest)
 Insert or update an out-record. More...
 
template<typename T , typename ... A>
std::pair< T *, bool > insertStrategyInfo (A &&... args)
 Insert a StrategyInfo item. More...
 
OutRecordCollection::const_iterator out_begin () const noexcept
 
OutRecordCollection::iterator out_begin () noexcept
 
OutRecordCollection::const_iterator out_end () const noexcept
 
OutRecordCollection::iterator out_end () noexcept
 

Public Attributes

time::milliseconds dataFreshnessPeriod = 0_ms
 Data freshness period. More...
 
ndn::scheduler::EventId expiryTimer
 Expiry timer. More...
 
bool isSatisfied = false
 Indicates whether this PIT entry is satisfied. More...
 

Detailed Description

Represents an entry in the Interest table (PIT).

An Interest table entry represents either a pending Interest or a recently satisfied Interest. Each entry contains a collection of in-records, a collection of out-records, and two timers used in forwarding pipelines. In addition, the entry, in-records, and out-records are subclasses of StrategyInfoHost, which allows forwarding strategy to store arbitrary information on them.

See also
Pit

Definition at line 196 of file pit-entry.hpp.

Constructor & Destructor Documentation

◆ Entry()

nfd::pit::Entry::Entry ( const Interest &  interest)
explicit

Definition at line 62 of file pit-entry.cpp.

Member Function Documentation

◆ canMatch()

bool nfd::pit::Entry::canMatch ( const Interest &  interest,
size_t  nEqualNameComps = 0 
) const
Returns
whether interest matches this entry
Parameters
interestthe Interest
nEqualNameCompsnumber of initial name components guaranteed to be equal
Todo:
#3162 match ForwardingHint field

Definition at line 68 of file pit-entry.cpp.

◆ clearInRecords()

void nfd::pit::Entry::clearInRecords ( )
inlinenoexcept

Removes all in-records.

Definition at line 301 of file pit-entry.hpp.

◆ clearStrategyInfo()

void nfd::StrategyInfoHost::clearStrategyInfo ( )
inlineinherited

Clear all StrategyInfo items.

Definition at line 92 of file strategy-info-host.hpp.

◆ deleteInRecord()

void nfd::pit::Entry::deleteInRecord ( InRecordCollection::const_iterator  pos)
inline

Removes the in-record at position pos.

Parameters
positerator to the in-record to remove; must be valid and dereferenceable.

Definition at line 292 of file pit-entry.hpp.

◆ deleteOutRecord()

void nfd::pit::Entry::deleteOutRecord ( const Face face)

Delete the out-record for face if it exists.

Definition at line 125 of file pit-entry.cpp.

◆ eraseStrategyInfo()

template<typename T >
size_t nfd::StrategyInfoHost::eraseStrategyInfo ( )
inlineinherited

Erase a StrategyInfo item.

Template Parameters
Ttype of StrategyInfo, must be a subclass of fw::StrategyInfo
Returns
number of items erased

Definition at line 82 of file strategy-info-host.hpp.

◆ findInRecord()

InRecordCollection::iterator nfd::pit::Entry::findInRecord ( const Face face)
noexcept

Get the in-record for face.

Returns
an iterator to the in-record, or in_end() if it does not exist

Definition at line 81 of file pit-entry.cpp.

◆ findOutRecord()

OutRecordCollection::iterator nfd::pit::Entry::findOutRecord ( const Face face)
noexcept

Get the out-record for face.

Returns
an iterator to the out-record, or out_end() if it does not exist

Definition at line 103 of file pit-entry.cpp.

◆ getInRecords()

const InRecordCollection& nfd::pit::Entry::getInRecords ( ) const
inlinenoexcept

Returns the collection of in-records.

Definition at line 233 of file pit-entry.hpp.

◆ getInterest()

const Interest& nfd::pit::Entry::getInterest ( ) const
inline
Returns
the representative Interest of the PIT entry
Note
Every Interest in in-records and out-records should have same Name and Selectors as the representative Interest.
Todo:
#3162 require Link field to match the representative Interest

Definition at line 208 of file pit-entry.hpp.

◆ getName()

const Name& nfd::pit::Entry::getName ( ) const
inline
Returns
Interest Name

Definition at line 216 of file pit-entry.hpp.

◆ getOutRecords()

const OutRecordCollection& nfd::pit::Entry::getOutRecords ( ) const
inlinenoexcept

Returns the collection of out-records.

Definition at line 311 of file pit-entry.hpp.

◆ getStrategyInfo()

template<typename T >
T* nfd::StrategyInfoHost::getStrategyInfo ( ) const
inlineinherited

Get a StrategyInfo item.

Template Parameters
Ttype of StrategyInfo, must be a subclass of fw::StrategyInfo
Returns
an existing StrategyInfo item of type T, or nullptr if it does not exist

Definition at line 46 of file strategy-info-host.hpp.

◆ hasInRecords()

bool nfd::pit::Entry::hasInRecords ( ) const
inlinenoexcept
Return values
trueThere is at least one in-record. This implies some downstream is waiting for Data or Nack.
falseThere is no in-record. This implies the entry is new or has been satisfied or Nacked.

Definition at line 244 of file pit-entry.hpp.

◆ hasOutRecords()

bool nfd::pit::Entry::hasOutRecords ( ) const
inlinenoexcept
Return values
trueThere is at least one out-record. This implies the Interest has been forwarded to some upstream, and they haven't returned Data, but may have returned Nacks.
falseThere is no out-record. This implies the Interest has not been forwarded.

Definition at line 323 of file pit-entry.hpp.

◆ in_begin() [1/2]

InRecordCollection::const_iterator nfd::pit::Entry::in_begin ( ) const
inlinenoexcept

Definition at line 256 of file pit-entry.hpp.

◆ in_begin() [2/2]

InRecordCollection::iterator nfd::pit::Entry::in_begin ( )
inlinenoexcept

Definition at line 250 of file pit-entry.hpp.

◆ in_end() [1/2]

InRecordCollection::const_iterator nfd::pit::Entry::in_end ( ) const
inlinenoexcept

Definition at line 268 of file pit-entry.hpp.

◆ in_end() [2/2]

InRecordCollection::iterator nfd::pit::Entry::in_end ( )
inlinenoexcept

Definition at line 262 of file pit-entry.hpp.

◆ insertOrUpdateInRecord()

InRecordCollection::iterator nfd::pit::Entry::insertOrUpdateInRecord ( Face face,
const Interest &  interest 
)

Insert or update an in-record.

Returns
an iterator to the new or updated in-record

Definition at line 88 of file pit-entry.cpp.

◆ insertOrUpdateOutRecord()

OutRecordCollection::iterator nfd::pit::Entry::insertOrUpdateOutRecord ( Face face,
const Interest &  interest 
)

Insert or update an out-record.

Returns
an iterator to the new or updated out-record

Definition at line 110 of file pit-entry.cpp.

◆ insertStrategyInfo()

template<typename T , typename ... A>
std::pair<T*, bool> nfd::StrategyInfoHost::insertStrategyInfo ( A &&...  args)
inlineinherited

Insert a StrategyInfo item.

Template Parameters
Ttype of StrategyInfo, must be a subclass of fw::StrategyInfo
Returns
a new or existing StrategyInfo item of type T, and true for new item, false for existing item

Definition at line 64 of file strategy-info-host.hpp.

◆ out_begin() [1/2]

OutRecordCollection::const_iterator nfd::pit::Entry::out_begin ( ) const
inlinenoexcept

Definition at line 335 of file pit-entry.hpp.

◆ out_begin() [2/2]

OutRecordCollection::iterator nfd::pit::Entry::out_begin ( )
inlinenoexcept

Definition at line 329 of file pit-entry.hpp.

◆ out_end() [1/2]

OutRecordCollection::const_iterator nfd::pit::Entry::out_end ( ) const
inlinenoexcept

Definition at line 347 of file pit-entry.hpp.

◆ out_end() [2/2]

OutRecordCollection::iterator nfd::pit::Entry::out_end ( )
inlinenoexcept

Definition at line 341 of file pit-entry.hpp.

Member Data Documentation

◆ dataFreshnessPeriod

time::milliseconds nfd::pit::Entry::dataFreshnessPeriod = 0_ms

Data freshness period.

Note
This field is meaningful only if isSatisfied is true

Definition at line 386 of file pit-entry.hpp.

◆ expiryTimer

ndn::scheduler::EventId nfd::pit::Entry::expiryTimer

Expiry timer.

This timer is used in forwarding pipelines to delete the entry

Definition at line 377 of file pit-entry.hpp.

◆ isSatisfied

bool nfd::pit::Entry::isSatisfied = false

Indicates whether this PIT entry is satisfied.

Definition at line 381 of file pit-entry.hpp.