table: reorganize PIT implementation
Merge pit-{face,in,out}-record.{cpp,hpp} into pit-entry.{cpp,hpp}
and merge pit-iterator.{cpp,hpp} into pit.{cpp,hpp}.
Rename get{In,Out}Record() to find{In,Out}Record(), following the
typical C++ pattern of using the verb "find" for functions that
return iterators.
No functional changes.
Change-Id: I6740dd6cfe92ca477938ab8dc2f6271fd8b6cc26
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index ab00f2b..78bc4b0 100644
--- a/tests/daemon/fw/algorithm.t.cpp
+++ b/tests/daemon/fw/algorithm.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -166,7 +166,7 @@
// Interest-Nack
entry.insertOrUpdateOutRecord(*face2, *interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true);
- pit::OutRecordCollection::iterator outR = entry.getOutRecord(*face2);
+ auto outR = entry.findOutRecord(*face2);
BOOST_REQUIRE(outR != entry.out_end());
lp::Nack nack = makeNack(*interest, lp::NackReason::DUPLICATE);
bool isNackAccepted = outR->setIncomingNack(nack); // Nack arrival
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 0fde3a5..dce7118 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -279,7 +279,7 @@
consumer->getClientFace().expressInterest(*interest, nullptr, nullptr, nullptr);
this->advanceClocks(time::milliseconds(100));
- auto outRecord = pitEntry->getOutRecord(linkBC->getFace(nodeB));
+ auto outRecord = pitEntry->findOutRecord(linkBC->getFace(nodeB));
BOOST_CHECK(outRecord != pitEntry->out_end());
this->advanceClocks(time::milliseconds(100));
@@ -450,7 +450,7 @@
// Get pitEntry of node A
auto pitEntry = topo.getForwarder(nodeA).getPit().find(*interest);
// Get outRecord associated with face towards B
- auto outRecord = pitEntry->getOutRecord(linkAB->getFace(nodeA));
+ auto outRecord = pitEntry->findOutRecord(linkAB->getFace(nodeA));
BOOST_REQUIRE(outRecord != pitEntry->out_end());
// Check that Nonce of interest is not equal to Nonce of Probe
@@ -470,12 +470,12 @@
pitEntry = topo.getForwarder(nodeB).getPit().find(*interest);
// Get outRecord associated with face towards D.
- outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB));
+ outRecord = pitEntry->findOutRecord(linkBD->getFace(nodeB));
BOOST_CHECK(outRecord != pitEntry->out_end());
// RTT between B and D
this->advanceClocks(5_ms, 160_ms);
- outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB));
+ outRecord = pitEntry->findOutRecord(linkBD->getFace(nodeB));
BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nInData, i);
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 0d27c4b..59b6f0d 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -565,7 +565,7 @@
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
// record Nack on PIT out-record
- auto outRecord1 = pit1->getOutRecord(*face1);
+ auto outRecord1 = pit1->findOutRecord(*face1);
BOOST_REQUIRE(outRecord1 != pit1->out_end());
BOOST_REQUIRE(outRecord1->getIncomingNack() != nullptr);
BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION);
@@ -657,7 +657,7 @@
BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
// in-record is erased
- auto inRecord2a = pit2->getInRecord(*face1);
+ auto inRecord2a = pit2->findInRecord(*face1);
BOOST_CHECK(inRecord2a == pit2->in_end());
// send Nack with correct Nonce
@@ -669,7 +669,7 @@
BOOST_CHECK_EQUAL(counters.nOutNacks, 2);
// in-record is erased
- auto inRecord2b = pit2->getInRecord(*face2);
+ auto inRecord2b = pit2->findInRecord(*face2);
BOOST_CHECK(inRecord2b == pit2->in_end());
// don't send Nack to multi-access face
diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp
index d662251..98ee12c 100644
--- a/tests/daemon/fw/retx-suppression.t.cpp
+++ b/tests/daemon/fw/retx-suppression.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -191,7 +191,7 @@
pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::FORWARD);
// Assume interest is sent and increment interval
- rs.incrementIntervalForOutRecord(*pitEntry->getOutRecord(*face2));
+ rs.incrementIntervalForOutRecord(*pitEntry->findOutRecord(*face2));
pitEntry->insertOrUpdateInRecord(*face2, *interest);
BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::SUPPRESS);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 725fd70..9641b51 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -107,7 +107,7 @@
pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1);
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
+ pitEntry->findOutRecord(*this->face3)->setIncomingNack(nack3);
auto f = [&] {
this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3), pitEntry);
@@ -145,13 +145,13 @@
pitEntry->insertOrUpdateOutRecord(*this->face4, *interest1);
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
+ pitEntry->findOutRecord(*this->face3)->setIncomingNack(nack3);
this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
lp::Nack nack4 = makeNack(*interest1, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
+ pitEntry->findOutRecord(*this->face4)->setIncomingNack(nack4);
auto f = [&] {
this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4), pitEntry);
@@ -187,7 +187,7 @@
this->advanceClocks(200_ms); // face3 has timed out
lp::Nack nack4 = makeNack(*interest2, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
+ pitEntry->findOutRecord(*this->face4)->setIncomingNack(nack4);
this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
@@ -320,13 +320,13 @@
pitEntry->insertOrUpdateOutRecord(*face4, *interest1);
lp::Nack nack3 = makeNack(*interest1, Combination::firstReason);
- pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+ pitEntry->findOutRecord(*face3)->setIncomingNack(nack3);
strategy.afterReceiveNack(nack3, FaceEndpoint(*face3), pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
lp::Nack nack4 = makeNack(*interest1, Combination::secondReason);
- pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+ pitEntry->findOutRecord(*face4)->setIncomingNack(nack4);
strategy.afterReceiveNack(nack4, FaceEndpoint(*face4), pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 99f5d36..d264322 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -119,7 +119,7 @@
sendNack(const lp::NackHeader& header, Face& egress, const shared_ptr<pit::Entry>& pitEntry) override
{
sendNackHistory.push_back({pitEntry->getInterest(), egress.getId(), header});
- auto it = pitEntry->getInRecord(egress);
+ auto it = pitEntry->findInRecord(egress);
if (it != pitEntry->in_end()) {
pitEntry->deleteInRecord(it);
}
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index 52b6f8b..7768faa 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -98,7 +98,7 @@
BOOST_CHECK_LE(in1->getLastRenewed(), after1);
BOOST_CHECK_LE(in1->getExpiry() - in1->getLastRenewed() - interest1->getInterestLifetime(),
after1 - before1);
- BOOST_CHECK(in1 == entry.getInRecord(*face1));
+ BOOST_CHECK(in1 == entry.findInRecord(*face1));
// insert out-record
auto before2 = time::steady_clock::now();
@@ -113,7 +113,7 @@
BOOST_CHECK_LE(out1->getLastRenewed(), after2);
BOOST_CHECK_LE(out1->getExpiry() - out1->getLastRenewed() - interest1->getInterestLifetime(),
after2 - before2);
- BOOST_CHECK(out1 == entry.getOutRecord(*face1));
+ BOOST_CHECK(out1 == entry.findOutRecord(*face1));
// update in-record
auto before3 = time::steady_clock::now();
@@ -134,20 +134,20 @@
BOOST_CHECK_EQUAL(&in3->getFace(), face2.get());
// get in-record
- InRecordCollection::iterator in4 = entry.getInRecord(*face1);
+ InRecordCollection::iterator in4 = entry.findInRecord(*face1);
BOOST_REQUIRE(in4 != entry.in_end());
BOOST_CHECK_EQUAL(&in4->getFace(), face1.get());
// delete in-record
entry.deleteInRecord(in4);
BOOST_CHECK_EQUAL(entry.getInRecords().size(), 1);
- BOOST_CHECK(entry.getInRecord(*face1) == entry.in_end());
+ BOOST_CHECK(entry.findInRecord(*face1) == entry.in_end());
// clear in-records
entry.clearInRecords();
BOOST_CHECK_EQUAL(entry.getInRecords().size(), 0);
- BOOST_CHECK(entry.getInRecord(*face1) == entry.in_end());
- BOOST_CHECK(entry.getInRecord(*face2) == entry.in_end());
+ BOOST_CHECK(entry.findInRecord(*face1) == entry.in_end());
+ BOOST_CHECK(entry.findInRecord(*face2) == entry.in_end());
// insert another out-record
OutRecordCollection::iterator out2 = entry.insertOrUpdateOutRecord(*face2, *interest4);
@@ -156,7 +156,7 @@
BOOST_CHECK_EQUAL(&out2->getFace(), face2.get());
// get out-record
- OutRecordCollection::iterator out3 = entry.getOutRecord(*face1);
+ OutRecordCollection::iterator out3 = entry.findOutRecord(*face1);
BOOST_REQUIRE(out3 != entry.out_end());
BOOST_CHECK_EQUAL(&out3->getFace(), face1.get());
@@ -165,7 +165,7 @@
const OutRecordCollection& outRecords4 = entry.getOutRecords();
BOOST_REQUIRE_EQUAL(outRecords4.size(), 1);
BOOST_CHECK_EQUAL(&outRecords4.begin()->getFace(), face1.get());
- BOOST_CHECK(entry.getOutRecord(*face2) == entry.out_end());
+ BOOST_CHECK(entry.findOutRecord(*face2) == entry.out_end());
}
const time::milliseconds lifetimes[] = {