Represents the Strategy Choice table. More...
#include <strategy-choice.hpp>
Classes | |
class | InsertResult |
Public Types | |
typedef boost::transformed_range< name_tree::GetTableEntry< Entry >, const name_tree::Range > | Range |
typedef boost::range_iterator< Range >::type | const_iterator |
Public Member Functions | |
StrategyChoice (Forwarder &forwarder) | |
size_t | size () const |
void | setDefaultStrategy (const Name &strategyName) |
Set the default strategy. More... | |
InsertResult | insert (const Name &prefix, const Name &strategyName) |
Set strategy of prefix to be strategyName . More... | |
void | erase (const Name &prefix) |
Make prefix to inherit strategy from its parent. More... | |
std::pair< bool, Name > | get (const Name &prefix) const |
Get strategy Name of prefix. More... | |
fw::Strategy & | findEffectiveStrategy (const Name &prefix) const |
Get effective strategy for prefix . More... | |
fw::Strategy & | findEffectiveStrategy (const pit::Entry &pitEntry) const |
Get effective strategy for pitEntry . More... | |
fw::Strategy & | findEffectiveStrategy (const measurements::Entry &measurementsEntry) const |
Get effective strategy for measurementsEntry . More... | |
const_iterator | begin () const |
const_iterator | end () const |
template<typename K > | |
Strategy & | findEffectiveStrategyImpl (const K &key) const |
Represents the Strategy Choice table.
The Strategy Choice table maintains available Strategy types, and associates Name prefixes with Strategy types.
Each strategy is identified by a strategyName. It's recommended to include a version number as the last component of strategyName.
A Name prefix is owned by a strategy if a longest prefix match on the Strategy Choice table returns that strategy.
Definition at line 51 of file strategy-choice.hpp.
typedef boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range> nfd::strategy_choice::StrategyChoice::Range |
Definition at line 155 of file strategy-choice.hpp.
typedef boost::range_iterator<Range>::type nfd::strategy_choice::StrategyChoice::const_iterator |
Definition at line 156 of file strategy-choice.hpp.
|
explicit |
Definition at line 50 of file strategy-choice.cpp.
|
inline |
Definition at line 58 of file strategy-choice.hpp.
References setDefaultStrategy().
void nfd::strategy_choice::StrategyChoice::setDefaultStrategy | ( | const Name & | strategyName | ) |
Set the default strategy.
This must be called by forwarder constructor.
Definition at line 57 of file strategy-choice.cpp.
References nfd::fw::Strategy::create(), nfd::name_tree::NameTree::lookup(), nonstd::optional_lite::std11::move(), ns3::ndn::Name, NFD_LOG_INFO, and nfd::name_tree::Entry::setStrategyChoiceEntry().
Referenced by nfd::Forwarder::Forwarder(), and size().
StrategyChoice::InsertResult nfd::strategy_choice::StrategyChoice::insert | ( | const Name & | prefix, |
const Name & | strategyName | ||
) |
Set strategy of prefix
to be strategyName
.
prefix | the name prefix to change strategy |
strategyName | strategy instance name, may contain version and parameters; strategy must have been registered |
Definition at line 71 of file strategy-choice.cpp.
References nfd::fw::Strategy::create(), findEffectiveStrategy(), nfd::fw::Strategy::getInstanceName(), nfd::name_tree::NameTree::getMaxDepth(), nfd::strategy_choice::Entry::getStrategy(), nfd::name_tree::Entry::getStrategyChoiceEntry(), nfd::strategy_choice::Entry::getStrategyInstanceName(), nfd::name_tree::NameTree::lookup(), nonstd::optional_lite::std11::move(), NFD_LOG_ERROR, NFD_LOG_TRACE, nfd::strategy_choice::Entry::setStrategy(), nfd::name_tree::Entry::setStrategyChoiceEntry(), and ndn::Name::size().
Referenced by nfd::TablesConfigSection::ensureConfigured().
void nfd::strategy_choice::StrategyChoice::erase | ( | const Name & | prefix | ) |
Make prefix to inherit strategy from its parent.
Definition at line 141 of file strategy-choice.cpp.
References nfd::name_tree::NameTree::eraseIfEmpty(), findEffectiveStrategy(), nfd::name_tree::NameTree::findExactMatch(), ndn::Name::getPrefix(), nfd::strategy_choice::Entry::getStrategy(), and ndn::Name::size().
Get strategy Name of prefix.
Definition at line 166 of file strategy-choice.cpp.
References nfd::name_tree::NameTree::findExactMatch(), nfd::name_tree::Entry::getStrategyChoiceEntry(), and nfd::strategy_choice::Entry::getStrategyInstanceName().
Get effective strategy for prefix
.
Definition at line 191 of file strategy-choice.cpp.
Referenced by erase(), nfd::Forwarder::Forwarder(), insert(), nfd::Forwarder::onContentStoreHit(), nfd::Forwarder::onContentStoreMiss(), nfd::Forwarder::onDroppedInterest(), nfd::Forwarder::onIncomingData(), nfd::Forwarder::onIncomingNack(), nfd::Forwarder::onNewNextHop(), and nfd::measurements::MeasurementsAccessor::~MeasurementsAccessor().
Strategy & nfd::strategy_choice::StrategyChoice::findEffectiveStrategy | ( | const pit::Entry & | pitEntry | ) | const |
Get effective strategy for pitEntry
.
This is equivalent to findEffectiveStrategy(pitEntry.getName())
Definition at line 197 of file strategy-choice.cpp.
Strategy & nfd::strategy_choice::StrategyChoice::findEffectiveStrategy | ( | const measurements::Entry & | measurementsEntry | ) | const |
Get effective strategy for measurementsEntry
.
This is equivalent to findEffectiveStrategy(measurementsEntry.getName())
Definition at line 203 of file strategy-choice.cpp.
|
inline |
Definition at line 164 of file strategy-choice.hpp.
|
inline |
Definition at line 173 of file strategy-choice.hpp.
References nfd::strategy_choice::StrategyChoice::InsertResult::operator<<, and nfd::strategy_choice::StrategyChoice.
Strategy& nfd::strategy_choice::StrategyChoice::findEffectiveStrategyImpl | ( | const K & | key | ) | const |