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/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index 194106d..cfbbc82 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -29,6 +29,36 @@
 
 namespace nfd::pit {
 
+void
+FaceRecord::update(const Interest& interest)
+{
+  m_lastNonce = interest.getNonce();
+  m_lastRenewed = time::steady_clock::now();
+
+  auto lifetime = interest.getInterestLifetime();
+  // impose an upper bound on the lifetime to prevent integer overflow when calculating m_expiry
+  lifetime = std::min<time::milliseconds>(lifetime, 10_days);
+  m_expiry = m_lastRenewed + lifetime;
+}
+
+void
+InRecord::update(const Interest& interest)
+{
+  FaceRecord::update(interest);
+  m_interest = interest.shared_from_this();
+}
+
+bool
+OutRecord::setIncomingNack(const lp::Nack& nack)
+{
+  if (nack.getInterest().getNonce() != this->getLastNonce()) {
+    return false;
+  }
+
+  m_incomingNack = make_unique<lp::NackHeader>(nack.getHeader());
+  return true;
+}
+
 Entry::Entry(const Interest& interest)
   : m_interest(interest.shared_from_this())
 {
@@ -48,7 +78,7 @@
 }
 
 InRecordCollection::iterator
-Entry::getInRecord(const Face& face)
+Entry::findInRecord(const Face& face)
 {
   return std::find_if(m_inRecords.begin(), m_inRecords.end(),
                       [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
@@ -70,21 +100,8 @@
   return it;
 }
 
-void
-Entry::deleteInRecord(InRecordCollection::const_iterator pos)
-{
-  BOOST_ASSERT(pos != m_inRecords.end());
-  m_inRecords.erase(pos);
-}
-
-void
-Entry::clearInRecords()
-{
-  m_inRecords.clear();
-}
-
 OutRecordCollection::iterator
-Entry::getOutRecord(const Face& face)
+Entry::findOutRecord(const Face& face)
 {
   return std::find_if(m_outRecords.begin(), m_outRecords.end(),
                       [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });