table: Content Store performance fix
Change-Id: I7f6752ec279e64e81c90c0b3e8d756da34194965
Refs: #1432
diff --git a/daemon/table/cs-entry.cpp b/daemon/table/cs-entry.cpp
index 0708de4..447c710 100644
--- a/daemon/table/cs-entry.cpp
+++ b/daemon/table/cs-entry.cpp
@@ -32,42 +32,22 @@
NFD_LOG_INIT("CsEntry");
-Entry::Entry(const Data& data, bool isUnsolicited)
- : m_dataPacket(data.shared_from_this())
- , m_isUnsolicited(isUnsolicited)
- , m_wasRefreshedByDuplicate(false)
- , m_nameWithDigest(data.getName())
+void
+Entry::release()
{
- updateStaleTime();
- m_nameWithDigest.append(ndn::name::Component(getDigest()));
-}
+ BOOST_ASSERT(m_layerIterators.empty());
-
-Entry::~Entry()
-{
-}
-
-const Name&
-Entry::getName() const
-{
- return m_nameWithDigest;
-}
-
-const Data&
-Entry::getData() const
-{
- return *m_dataPacket;
+ m_dataPacket.reset();
+ m_digest.reset();
+ m_nameWithDigest.clear();
}
void
-Entry::setData(const Data& data)
+Entry::setData(const Data& data, bool isUnsolicited)
{
- /// \todo This method may not be necessary (if it is real duplicate,
- /// there is no reason to recalculate the same digest
-
+ m_isUnsolicited = isUnsolicited;
m_dataPacket = data.shared_from_this();
m_digest.reset();
- m_wasRefreshedByDuplicate = true;
updateStaleTime();
@@ -76,14 +56,10 @@
}
void
-Entry::setData(const Data& data, const ndn::ConstBufferPtr& digest)
+Entry::setData(const Data& data, bool isUnsolicited, const ndn::ConstBufferPtr& digest)
{
- /// \todo This method may not be necessary (if it is real duplicate,
- /// there is no reason to recalculate the same digest
-
m_dataPacket = data.shared_from_this();
m_digest = digest;
- m_wasRefreshedByDuplicate = true;
updateStaleTime();
@@ -91,30 +67,12 @@
m_nameWithDigest.append(ndn::name::Component(getDigest()));
}
-bool
-Entry::isUnsolicited() const
-{
- return m_isUnsolicited;
-}
-
-const time::steady_clock::TimePoint&
-Entry::getStaleTime() const
-{
- return m_staleAt;
-}
-
void
Entry::updateStaleTime()
{
m_staleAt = time::steady_clock::now() + m_dataPacket->getFreshnessPeriod();
}
-bool
-Entry::wasRefreshedByDuplicate() const
-{
- return m_wasRefreshedByDuplicate;
-}
-
const ndn::ConstBufferPtr&
Entry::getDigest() const
{
@@ -139,12 +97,6 @@
m_layerIterators.erase(layer);
}
-const Entry::LayerIterators&
-Entry::getIterators() const
-{
- return m_layerIterators;
-}
-
void
Entry::printIterators() const
{