table: add Cs::erase method
This commit also corrects CS's description in Doxygen.
refs #4318
Change-Id: Ie8854a2e2b59a072b98603c0cc31768bb84ea6d2
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index 81b3fd6..54466ed 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -89,6 +89,29 @@
}
void
+Cs::erase(const Name& prefix, size_t limit, const AfterEraseCallback& cb)
+{
+ BOOST_ASSERT(static_cast<bool>(cb));
+
+ iterator first = m_table.lower_bound(prefix);
+ iterator last = m_table.end();
+ if (prefix.size() > 0) {
+ last = m_table.lower_bound(prefix.getSuccessor());
+ }
+
+ size_t nErased = 0;
+ while (first != last && nErased < limit) {
+ m_policy->beforeErase(first);
+ first = m_table.erase(first);
+ ++nErased;
+ }
+
+ if (cb) {
+ cb(nErased);
+ }
+}
+
+void
Cs::find(const Interest& interest,
const HitCallback& hitCallback,
const MissCallback& missCallback) const