Revert "pit: add EndpointId field in in-record and out-record"
This reverts commit d3ae85dbad518da84d0ef5ba61b81108e40f84f3.
refs: #4973
Change-Id: I0aedfca8ae75137c8c9073a51642bfacf9d8f212
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;