39 BOOST_ASSERT(!m_timeoutEvent);
40 m_lastInterestName = interestName;
41 m_timeoutEvent =
getScheduler().schedule(m_rttEstimator.getEstimatedRto(), std::move(cb));
42 return m_rttEstimator.getEstimatedRto();
48 if (m_lastInterestName.isPrefixOf(prefix)) {
49 m_timeoutEvent.cancel();
59 auto it = m_fiMap.find(faceId);
60 return it != m_fiMap.end() ? &it->second :
nullptr;
66 auto ret = m_fiMap.emplace(std::piecewise_construct,
67 std::forward_as_tuple(faceId),
68 std::forward_as_tuple(m_rttEstimatorOpts));
69 auto& faceInfo = ret.first->second;
71 extendFaceInfoLifetime(faceInfo, faceId);
80 [=] { m_fiMap.erase(faceId); });
89 : m_measurements(measurements)
90 , m_rttEstimatorOpts(make_shared<
ndn::util::RttEstimator::Options>())
119 BOOST_ASSERT(info !=
nullptr);
130 for (
size_t prefixLen = fibEntry.
getPrefix().size() + 1;
131 me ==
nullptr && prefixLen <= interest.
getName().size(); ++prefixLen) {
132 me = m_measurements.
get(interest.getName().getPrefix(prefixLen));
136 BOOST_ASSERT(me !=
nullptr);
142 BOOST_ASSERT(info !=
nullptr);
void cancelTimeout(const Name &prefix)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Interest &interest, FaceId faceId)
Copyright (c) 2014-2017, Regents of the University of California, Arizona Board of Regents...
static const time::nanoseconds RTT_NO_MEASUREMENT
static const time::nanoseconds RTT_TIMEOUT
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
void extendFaceInfoLifetime(FaceInfo &info, FaceId faceId)
std::pair< T *, bool > insertStrategyInfo(A &&... args)
Insert a StrategyInfo item.
Represents a Measurements entry.
NamespaceInfo * getNamespaceInfo(const Name &prefix)
FaceInfo & getOrCreateFaceInfo(const fib::Entry &fibEntry, const Interest &interest, FaceId faceId)
Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
perform a longest prefix match for name
static constexpr time::microseconds MEASUREMENTS_LIFETIME
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
time::nanoseconds scheduleTimeout(const Name &interestName, scheduler::EventCallback cb)
const Name & getPrefix() const
NamespaceInfo & getOrCreateNamespaceInfo(const fib::Entry &fibEntry, const Interest &interest)
allows Strategy to access portion of Measurements table under its namespace
FaceInfo & getOrCreateFaceInfo(FaceId faceId)
Stores strategy information about each face in this namespace.
AsfMeasurements(MeasurementsAccessor &measurements)
const Name & getName() const
uint64_t FaceId
Identifies a face.
Strategy information for each face in a namespace.
Entry * get(const Name &name)
find or insert a Measurements entry for name
FaceInfo * getFaceInfo(FaceId faceId)