Revert "pit: add EndpointId field in in-record and out-record"
This reverts commit d3ae85dbad518da84d0ef5ba61b81108e40f84f3.
refs: #4973
Change-Id: I0aedfca8ae75137c8c9073a51642bfacf9d8f212
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 6ae2767..51f7c8d 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -172,7 +172,7 @@
return;
}
- auto inRecord = pitEntry->getInRecord(*inFace, inEndpointId);
+ auto inRecord = pitEntry->getInRecord(*inFace);
// in-record is erased only if Interest is satisfied, and RTO timer should have been cancelled
// note: if this strategy is extended to send Nacks, that would also erase the in-record,
// and the RTO timer should be cancelled in that case as well
@@ -219,7 +219,7 @@
return;
}
- auto outRecord = pitEntry->getOutRecord(ingress.face, 0);
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) { // no out-record
NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << ingress << " no-out-record");
return;
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index 6ea610f..1ed699b 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -140,7 +140,7 @@
if (!isNextHopEligible(inFace, interest, *it, pitEntry))
continue;
- auto outRecord = pitEntry->getOutRecord(it->getFace(), 0);
+ auto outRecord = pitEntry->getOutRecord(it->getFace());
BOOST_ASSERT(outRecord != pitEntry->out_end());
if (outRecord->getLastRenewed() < earliestRenewed) {
found = it;
@@ -166,7 +166,7 @@
if (wantUnused) {
// nexthop must not have unexpired out-record
- auto outRecord = pitEntry->getOutRecord(outFace, 0);
+ auto outRecord = pitEntry->getOutRecord(outFace);
if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
return false;
}
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 62336eb..90b4ebe 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -181,7 +181,7 @@
return;
}
- auto outRecord = pitEntry->getOutRecord(ingress.face, 0);
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DEBUG(pitEntry->getName() << " data from=" << ingress << " no-out-record");
}
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 4c60129..4c91fb7 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -167,13 +167,8 @@
NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName());
++m_counters.nCsMisses;
- // FIXME Strategies are not prepared to handle non-zero EndpointIds, so always insert
- // the in-record and dispatch to strategy with EndpointId=0 for now. Eventually,
- // this pipeline will need to be refactored so that strategies can control the
- // in-record insertion.
-
// insert in-record
- pitEntry->insertOrUpdateInRecord(ingress.face, 0, interest);
+ pitEntry->insertOrUpdateInRecord(ingress.face, interest);
// set PIT expiry timer to the time that the last PIT in-record expires
auto lastExpiring = std::max_element(pitEntry->in_begin(), pitEntry->in_end(),
@@ -233,7 +228,7 @@
NFD_LOG_DEBUG("onOutgoingInterest out=" << egress << " interest=" << pitEntry->getName());
// insert out-record
- pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest);
+ pitEntry->insertOrUpdateOutRecord(egress.face, interest);
// send Interest
egress.face.sendInterest(interest, egress.endpoint);
@@ -311,7 +306,7 @@
this->insertDeadNonceList(*pitEntry, &ingress.face);
// delete PIT entry's out-record
- pitEntry->deleteOutRecord(ingress.face, ingress.endpoint);
+ pitEntry->deleteOutRecord(ingress.face);
}
// when more than one PIT entry is matched, trigger strategy: before satisfy Interest,
// and send Data to all matched out faces
@@ -325,7 +320,7 @@
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
- pendingDownstreams.emplace(&inRecord.getFace(), inRecord.getEndpointId());
+ pendingDownstreams.emplace(&inRecord.getFace(), 0);
}
}
@@ -345,7 +340,7 @@
// clear PIT entry's in and out records
pitEntry->clearInRecords();
- pitEntry->deleteOutRecord(ingress.face, ingress.endpoint);
+ pitEntry->deleteOutRecord(ingress.face);
}
// foreach pending downstream
@@ -424,7 +419,7 @@
}
// has out-record?
- auto outRecord = pitEntry->getOutRecord(ingress.face, ingress.endpoint);
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
// if no out-record found, drop
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
@@ -467,7 +462,7 @@
}
// has in-record?
- auto inRecord = pitEntry->getInRecord(egress.face, egress.endpoint);
+ auto inRecord = pitEntry->getInRecord(egress.face);
// if no in-record found, drop
if (inRecord == pitEntry->in_end()) {
@@ -494,7 +489,7 @@
nackPkt.setHeader(nack);
// erase in-record
- pitEntry->deleteInRecord(egress.face, egress.endpoint);
+ pitEntry->deleteInRecord(egress.face);
// send Nack on face
egress.face.sendNack(nackPkt, egress.endpoint);
@@ -542,7 +537,7 @@
}
else {
// insert outgoing Nonce of a specific face
- auto outRecord = pitEntry.getOutRecord(*upstream, 0);
+ auto outRecord = pitEntry.getOutRecord(*upstream);
if (outRecord != pitEntry.getOutRecords().end()) {
m_deadNonceList.add(pitEntry.getName(), outRecord->getLastNonce());
}
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index d15063e..d861071 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -93,7 +93,7 @@
NFD_LOG_DEBUG(interest << " from=" << ingress << " pitEntry-to=" << outFace.getId());
if (suppressResult == RetxSuppressionResult::FORWARD) {
- m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace, 0));
+ m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace));
}
++nEligibleNextHops;
}
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 4969a14..9909272 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -143,7 +143,7 @@
if (pitEntry == nullptr) {
return;
}
- auto inRecord = pitEntry->getInRecord(*inFace, 0);
+ auto inRecord = pitEntry->getInRecord(*inFace);
if (inRecord == pitEntry->in_end()) {
return;
}
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index 6f3ad08..ed599d9 100644
--- a/daemon/fw/process-nack-traits.cpp
+++ b/daemon/fw/process-nack-traits.cpp
@@ -56,7 +56,7 @@
if (nOutRecordsNotNacked == 1) {
BOOST_ASSERT(lastFaceNotNacked != nullptr);
- pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked, 0);
+ pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
if (inR != pitEntry->in_end()) {
// one out-record not Nacked, which is also a downstream
NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp
index 1275dd9..c634173 100644
--- a/daemon/fw/retx-suppression-exponential.cpp
+++ b/daemon/fw/retx-suppression-exponential.cpp
@@ -95,7 +95,7 @@
RetxSuppressionExponential::decidePerUpstream(pit::Entry& pitEntry, Face& outFace)
{
// NEW if outRecord for the face does not exist
- auto outRecord = pitEntry.getOutRecord(outFace, 0);
+ auto outRecord = pitEntry.getOutRecord(outFace);
if (outRecord == pitEntry.out_end()) {
return RetxSuppressionResult::NEW;
}
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index fd6d16e..a77d3ef 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -73,7 +73,7 @@
const fib::NextHopList& nexthops = fibEntry.getNextHops();
bool isNonDiscovery = interest.getTag<lp::NonDiscoveryTag>() != nullptr;
- auto inRecordInfo = pitEntry->getInRecord(ingress.face, ingress.endpoint)->insertStrategyInfo<InRecordInfo>().first;
+ auto inRecordInfo = pitEntry->getInRecord(ingress.face)->insertStrategyInfo<InRecordInfo>().first;
if (isNonDiscovery) { // "non-discovery" Interest
inRecordInfo->isNonDiscoveryInterest = true;
if (nexthops.empty()) { // return NACK if no matching FIB entry exists
@@ -103,7 +103,7 @@
SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
const FaceEndpoint& ingress, const Data& data)
{
- OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(ingress.face, ingress.endpoint)->getStrategyInfo<OutRecordInfo>();
+ OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(ingress.face)->getStrategyInfo<OutRecordInfo>();
if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
sendDataToAll(pitEntry, ingress, data);
@@ -147,7 +147,7 @@
continue;
}
this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
- pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
+ pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
NFD_LOG_DEBUG("send discovery Interest=" << interest << " from="
<< inFace.getId() << " to=" << outFace.getId());
}
@@ -165,7 +165,7 @@
continue;
}
this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
- pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
+ pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from="
<< inFace.getId() << " to=" << outFace.getId());
}
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 151dac8..b4ccda8 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -199,7 +199,7 @@
// delete the PIT entry's in-record based on egress,
// since Data is sent to face and endpoint from which the Interest was received
- pitEntry->deleteInRecord(egress.face, egress.endpoint);
+ pitEntry->deleteInRecord(egress.face);
m_forwarder.onOutgoingData(data, egress);
}
@@ -208,23 +208,22 @@
Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
const FaceEndpoint& ingress, const Data& data)
{
- std::set<std::pair<Face*, EndpointId>> pendingDownstreams;
+ std::set<Face*> pendingDownstreams;
auto now = time::steady_clock::now();
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
if (inRecord.getFace().getId() == ingress.face.getId() &&
- inRecord.getEndpointId() == ingress.endpoint &&
inRecord.getFace().getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
continue;
}
- pendingDownstreams.emplace(&inRecord.getFace(), inRecord.getEndpointId());
+ pendingDownstreams.emplace(&inRecord.getFace());
}
}
for (const auto& pendingDownstream : pendingDownstreams) {
- this->sendData(pitEntry, data, FaceEndpoint(*pendingDownstream.first, pendingDownstream.second));
+ this->sendData(pitEntry, data, FaceEndpoint(*pendingDownstream, 0));
}
}
@@ -233,20 +232,20 @@
std::initializer_list<FaceEndpoint> exceptFaceEndpoints)
{
// populate downstreams with all downstreams faces
- std::set<std::pair<Face*, EndpointId>> downstreams;
+ std::set<Face*> downstreams;
std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
[] (const pit::InRecord& inR) {
- return std::make_pair(&inR.getFace(), inR.getEndpointId());
+ return &inR.getFace();
});
// delete excluded faces
for (const auto& exceptFaceEndpoint : exceptFaceEndpoints) {
- downstreams.erase({&exceptFaceEndpoint.face, exceptFaceEndpoint.endpoint});
+ downstreams.erase(&exceptFaceEndpoint.face);
}
// send Nacks
for (const auto& downstream : downstreams) {
- this->sendNack(pitEntry, FaceEndpoint(*downstream.first, downstream.second), header);
+ this->sendNack(pitEntry, FaceEndpoint(*downstream, 0), header);
}
// warning: don't loop on pitEntry->getInRecords(), because in-record is deleted when sending Nack
}
diff --git a/daemon/table/cleanup.cpp b/daemon/table/cleanup.cpp
index a62304b..b025de8 100644
--- a/daemon/table/cleanup.cpp
+++ b/daemon/table/cleanup.cpp
@@ -40,7 +40,7 @@
}
for (const auto& pitEntry : nte.getPitEntries()) {
- pit.deleteInOutRecordsByFace(pitEntry.get(), face);
+ pit.deleteInOutRecords(pitEntry.get(), face);
}
if (!nte.hasTableEntries()) {
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index 4de7bcd..e2e194f 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -49,25 +49,21 @@
}
InRecordCollection::iterator
-Entry::getInRecord(const Face& face, EndpointId endpointId)
+Entry::getInRecord(const Face& face)
{
return std::find_if(m_inRecords.begin(), m_inRecords.end(),
- [&face, endpointId] (const InRecord& inRecord) {
- return &inRecord.getFace() == &face && inRecord.getEndpointId() == endpointId;
- });
+ [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
}
InRecordCollection::iterator
-Entry::insertOrUpdateInRecord(Face& face, EndpointId endpointId, const Interest& interest)
+Entry::insertOrUpdateInRecord(Face& face, const Interest& interest)
{
BOOST_ASSERT(this->canMatch(interest));
auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
- [&face, endpointId] (const InRecord& inRecord) {
- return &inRecord.getFace() == &face && inRecord.getEndpointId() == endpointId;
- });
+ [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
if (it == m_inRecords.end()) {
- m_inRecords.emplace_front(face, endpointId);
+ m_inRecords.emplace_front(face);
it = m_inRecords.begin();
}
@@ -76,12 +72,10 @@
}
void
-Entry::deleteInRecord(const Face& face, EndpointId endpointId)
+Entry::deleteInRecord(const Face& face)
{
auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
- [&face, endpointId] (const InRecord& inRecord) {
- return &inRecord.getFace() == &face && inRecord.getEndpointId() == endpointId;
- });
+ [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
if (it != m_inRecords.end()) {
m_inRecords.erase(it);
}
@@ -94,25 +88,21 @@
}
OutRecordCollection::iterator
-Entry::getOutRecord(const Face& face, EndpointId endpointId)
+Entry::getOutRecord(const Face& face)
{
return std::find_if(m_outRecords.begin(), m_outRecords.end(),
- [&face, endpointId] (const OutRecord& outRecord) {
- return &outRecord.getFace() == &face && outRecord.getEndpointId() == endpointId;
- });
+ [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
}
OutRecordCollection::iterator
-Entry::insertOrUpdateOutRecord(Face& face, EndpointId endpointId, const Interest& interest)
+Entry::insertOrUpdateOutRecord(Face& face, const Interest& interest)
{
BOOST_ASSERT(this->canMatch(interest));
auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
- [&face, endpointId] (const OutRecord& outRecord) {
- return &outRecord.getFace() == &face && outRecord.getEndpointId() == endpointId;
- });
+ [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
if (it == m_outRecords.end()) {
- m_outRecords.emplace_front(face, endpointId);
+ m_outRecords.emplace_front(face);
it = m_outRecords.begin();
}
@@ -121,27 +111,14 @@
}
void
-Entry::deleteOutRecord(const Face& face, EndpointId endpointId)
+Entry::deleteOutRecord(const Face& face)
{
auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
- [&face, endpointId] (const OutRecord& outRecord) {
- return &outRecord.getFace() == &face && outRecord.getEndpointId() == endpointId;
- });
+ [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
if (it != m_outRecords.end()) {
m_outRecords.erase(it);
}
}
-void
-Entry::deleteInOutRecordsByFace(const Face& face)
-{
- m_inRecords.remove_if([&face] (const InRecord& inRecord) {
- return &inRecord.getFace() == &face;
- });
- m_outRecords.remove_if([&face] (const OutRecord& outRecord) {
- return &outRecord.getFace() == &face;
- });
-}
-
} // namespace pit
} // namespace nfd
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 8100b8e..9e4a357 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -131,22 +131,22 @@
return m_inRecords.end();
}
- /** \brief get the in-record for \p face and \p endpointId
+ /** \brief get the in-record for \p face
* \return an iterator to the in-record, or in_end() if it does not exist
*/
InRecordCollection::iterator
- getInRecord(const Face& face, EndpointId endpointId);
+ getInRecord(const Face& face);
/** \brief insert or update an in-record
* \return an iterator to the new or updated in-record
*/
InRecordCollection::iterator
- insertOrUpdateInRecord(Face& face, EndpointId endpointId, const Interest& interest);
+ insertOrUpdateInRecord(Face& face, const Interest& interest);
- /** \brief delete the in-record for \p face and \p endpointId if it exists
+ /** \brief delete the in-record for \p face if it exists
*/
void
- deleteInRecord(const Face& face, EndpointId endpointId);
+ deleteInRecord(const Face& face);
/** \brief delete all in-records
*/
@@ -198,28 +198,22 @@
return m_outRecords.end();
}
- /** \brief get the out-record for \p face and \p endpointId
+ /** \brief get the out-record for \p face
* \return an iterator to the out-record, or out_end() if it does not exist
*/
OutRecordCollection::iterator
- getOutRecord(const Face& face, EndpointId endpointId);
+ getOutRecord(const Face& face);
/** \brief insert or update an out-record
* \return an iterator to the new or updated out-record
*/
OutRecordCollection::iterator
- insertOrUpdateOutRecord(Face& face, EndpointId endpointId, const Interest& interest);
+ insertOrUpdateOutRecord(Face& face, const Interest& interest);
- /** \brief delete the out-record for \p face and \p endpointId if it exists
+ /** \brief delete the out-record for \p face if it exists
*/
void
- deleteOutRecord(const Face& face, EndpointId endpointId);
-
-public: // cleanup
- /** \brief delete all in-records and out-records for \p face if it exists
- */
- void
- deleteInOutRecordsByFace(const Face& face);
+ deleteOutRecord(const Face& face);
public:
/** \brief Expiry timer
diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp
index 0c76530..7c36ab6 100644
--- a/daemon/table/pit-face-record.hpp
+++ b/daemon/table/pit-face-record.hpp
@@ -39,9 +39,9 @@
class FaceRecord : public StrategyInfoHost
{
public:
- FaceRecord(Face& face, EndpointId endpointId)
+ explicit
+ FaceRecord(Face& face)
: m_face(face)
- , m_endpointId(endpointId)
{
}
@@ -51,12 +51,6 @@
return m_face;
}
- EndpointId
- getEndpointId() const
- {
- return m_endpointId;
- }
-
uint32_t
getLastNonce() const
{
@@ -85,7 +79,6 @@
private:
Face& m_face;
- EndpointId m_endpointId;
uint32_t m_lastNonce = 0;
time::steady_clock::TimePoint m_lastRenewed = time::steady_clock::TimePoint::min();
time::steady_clock::TimePoint m_expiry = time::steady_clock::TimePoint::min();
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index c626c3a..cc447f2 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -112,11 +112,12 @@
}
void
-Pit::deleteInOutRecordsByFace(Entry* entry, const Face& face)
+Pit::deleteInOutRecords(Entry* entry, const Face& face)
{
BOOST_ASSERT(entry != nullptr);
- entry->deleteInOutRecordsByFace(face);
+ entry->deleteInRecord(face);
+ entry->deleteOutRecord(face);
/// \todo decide whether to delete PIT entry if there's no more in/out-record left
}
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index 5464e00..c998a4d 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -93,10 +93,10 @@
this->erase(entry, true);
}
- /** \brief Deletes all in-records and out-records for \p face
+ /** \brief Deletes in-records and out-records for \p face
*/
void
- deleteInOutRecordsByFace(Entry* entry, const Face& face);
+ deleteInOutRecords(Entry* entry, const Face& face);
public: // enumeration
typedef Iterator const_iterator;