cs: avoid Entry construction during query
Using C++14's transparent comparators, CS lookup logic can
compare stored Entry objects with the queried Name without
constructing an Entry object. This in turn eliminates the need
for a special "query entry", so EntryImpl class is deleted.
refs #4914
Change-Id: I5b05a1ab9ad696e79f7ebd6045be8de11cd58ee6
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index a086cac..a73303f 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -69,14 +69,14 @@
iterator it;
bool isNewEntry = false;
std::tie(it, isNewEntry) = m_table.emplace(data.shared_from_this(), isUnsolicited);
- EntryImpl& entry = const_cast<EntryImpl&>(*it);
+ Entry& entry = const_cast<Entry&>(*it);
- entry.updateStaleTime();
+ entry.updateFreshUntil();
if (!isNewEntry) { // existing entry
// XXX This doesn't forbid unsolicited Data from refreshing a solicited entry.
if (entry.isUnsolicited() && !isUnsolicited) {
- entry.unsetUnsolicited();
+ entry.clearUnsolicited();
}
m_policy->afterRefresh(it);
@@ -137,7 +137,7 @@
Cs::dump()
{
NFD_LOG_DEBUG("dump table");
- for (const EntryImpl& entry : m_table) {
+ for (const Entry& entry : m_table) {
NFD_LOG_TRACE(entry.getFullName());
}
}