a common index structure for FIB, PIT, StrategyChoice, and Measurements More...
#include <daemon/table/name-tree.hpp>
Public Types | |
using | const_iterator = Iterator |
Public Member Functions | |
NameTree (size_t nBuckets=1024) | |
const_iterator | begin () const |
const_iterator | end () const |
size_t | eraseIfEmpty (Entry *entry, bool canEraseAncestors=true) |
delete the entry if it is empty More... | |
Range | findAllMatches (const Name &name, const EntrySelector &entrySelector=AnyEntry()) const |
all-prefixes match lookup More... | |
Entry * | findExactMatch (const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const |
exact match lookup More... | |
Entry * | findLongestPrefixMatch (const Name &name, const EntrySelector &entrySelector=AnyEntry()) const |
longest prefix matching More... | |
Entry * | findLongestPrefixMatch (const Entry &entry, const EntrySelector &entrySelector=AnyEntry()) const |
equivalent to .findLongestPrefixMatch(entry.getName(), entrySelector) More... | |
template<typename EntryT > | |
Entry * | findLongestPrefixMatch (const EntryT &tableEntry, const EntrySelector &entrySelector=AnyEntry()) const |
equivalent to .findLongestPrefixMatch(getEntry(tableEntry)->getName(), entrySelector) More... | |
Entry * | findLongestPrefixMatch (const pit::Entry &pitEntry, const EntrySelector &entrySelector=AnyEntry()) const |
equivalent to .findLongestPrefixMatch(pitEntry.getName(), entrySelector) More... | |
Range | fullEnumerate (const EntrySelector &entrySelector=AnyEntry()) const |
enumerate all entries More... | |
template<typename EntryT > | |
Entry * | getEntry (const EntryT &tableEntry) const |
size_t | getNBuckets () const |
Entry & | lookup (const Name &name, bool enforceMaxDepth=false) |
find or insert an entry with specified name More... | |
Entry & | lookup (const fib::Entry &fibEntry) |
equivalent to .lookup(fibEntry.getPrefix()) More... | |
Entry & | lookup (const pit::Entry &pitEntry) |
equivalent to .lookup(pitEntry.getName()). More... | |
Entry & | lookup (const measurements::Entry &measurementsEntry) |
equivalent to .lookup(measurementsEntry.getName()) More... | |
Entry & | lookup (const strategy_choice::Entry &strategyChoiceEntry) |
equivalent to .lookup(strategyChoiceEntry.getPrefix()) More... | |
Range | partialEnumerate (const Name &prefix, const EntrySubTreeSelector &entrySubTreeSelector=AnyEntrySubTree()) const |
enumerate all entries under a prefix More... | |
size_t | size () const |
Static Public Member Functions | |
static size_t | getMaxDepth () |
Maximum depth of the name tree. More... | |
Friends | |
class | EnumerationImpl |
a common index structure for FIB, PIT, StrategyChoice, and Measurements
Definition at line 36 of file name-tree.hpp.
Definition at line 210 of file name-tree.hpp.
|
explicit |
Definition at line 38 of file name-tree.cpp.
|
inline |
Definition at line 254 of file name-tree.hpp.
|
inline |
size_t nfd::name_tree::NameTree::eraseIfEmpty | ( | Entry * | entry, |
bool | canEraseAncestors = true |
||
) |
delete the entry if it is empty
entry | a valid entry |
canEraseAncestors | whether ancestors should be deleted if they become empty |
Definition at line 122 of file name-tree.cpp.
boost::iterator_range< NameTree::const_iterator > nfd::name_tree::NameTree::findAllMatches | ( | const Name & | name, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
all-prefixes match lookup
name
, and matches entrySelector
.Example:
name
is inserted during the enumeration, it may or may not be visited. If a name tree entry whose name is a prefix of name
is deleted during the enumeration, undefined behavior may occur. Definition at line 204 of file name-tree.cpp.
Entry * nfd::name_tree::NameTree::findExactMatch | ( | const Name & | name, |
size_t | prefixLen = std::numeric_limits<size_t>::max() |
||
) | const |
exact match lookup
name.getPrefix(prefixLen)
, or nullptr if it does not exist Definition at line 149 of file name-tree.cpp.
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const Name & | name, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
longest prefix matching
name
and passes entrySelector
, where no other entry with a longer name satisfies those requirements; or nullptr if no entry satisfying those requirements exists Definition at line 156 of file name-tree.cpp.
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const Entry & | entry, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
equivalent to .findLongestPrefixMatch(entry.getName(), entrySelector)
Definition at line 171 of file name-tree.cpp.
|
inline |
equivalent to .findLongestPrefixMatch(getEntry(tableEntry)->getName(), entrySelector)
EntryT | fib::Entry or measurements::Entry or strategy_choice::Entry |
Definition at line 169 of file name-tree.hpp.
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const pit::Entry & | pitEntry, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
equivalent to .findLongestPrefixMatch(pitEntry.getName(), entrySelector)
Definition at line 184 of file name-tree.cpp.
boost::iterator_range< NameTree::const_iterator > nfd::name_tree::NameTree::fullEnumerate | ( | const EntrySelector & | entrySelector = AnyEntry() | ) | const |
enumerate all entries
entrySelector
Example:
Definition at line 217 of file name-tree.cpp.
|
inline |
Definition at line 80 of file name-tree.hpp.
|
inlinestatic |
Maximum depth of the name tree.
Calling NameTree::lookup with a name with many components would cause the creation of many NameTree entries, which could take very long time. This constant limits the maximum number of name components in the name of a NameTree entry. Thus, it limits the number of NameTree entries created from a long name, bounding the processing complexity.
This constant is currently advisory. It is enforced in NameTree::lookup only if enforceMaxDepth
is set to true. This will become mandatory later.
Definition at line 54 of file name-tree.hpp.
|
inline |
Definition at line 70 of file name-tree.hpp.
Entry & nfd::name_tree::NameTree::lookup | ( | const Name & | name, |
bool | enforceMaxDepth = false |
||
) |
find or insert an entry with specified name
name | a name prefix |
enforceMaxDepth | if true, use name.getPrefix(getMaxDepth()) in place of name |
name
name
and all ancestors are created Definition at line 44 of file name-tree.cpp.
Entry & nfd::name_tree::NameTree::lookup | ( | const fib::Entry & | fibEntry | ) |
equivalent to .lookup(fibEntry.getPrefix())
fibEntry | a FIB entry attached to this name tree, or Fib::s_emptyEntry |
Definition at line 66 of file name-tree.cpp.
Entry & nfd::name_tree::NameTree::lookup | ( | const pit::Entry & | pitEntry | ) |
equivalent to .lookup(pitEntry.getName()).
pitEntry | a PIT entry attached to this name tree |
Definition at line 80 of file name-tree.cpp.
Entry & nfd::name_tree::NameTree::lookup | ( | const measurements::Entry & | measurementsEntry | ) |
equivalent to .lookup(measurementsEntry.getName())
measurementsEntry | a Measurements entry attached to this name tree |
Definition at line 102 of file name-tree.cpp.
Entry & nfd::name_tree::NameTree::lookup | ( | const strategy_choice::Entry & | strategyChoiceEntry | ) |
equivalent to .lookup(strategyChoiceEntry.getPrefix())
strategyChoiceEntry | a StrategyChoice entry attached to this name tree |
Definition at line 112 of file name-tree.cpp.
boost::iterator_range< NameTree::const_iterator > nfd::name_tree::NameTree::partialEnumerate | ( | const Name & | prefix, |
const EntrySubTreeSelector & | entrySubTreeSelector = AnyEntrySubTree() |
||
) | const |
enumerate all entries under a prefix
prefix
, and matches entrySubTreeSelector
.Example:
prefix
is inserted or deleted during the enumeration, it may cause the enumeration to skip entries or visit some entries twice. Definition at line 223 of file name-tree.cpp.
|
inline |
Definition at line 62 of file name-tree.hpp.
|
friend |
Definition at line 271 of file name-tree.hpp.