table: Make LRU the default CS replacement policy
Change-Id: I01fe000544da9df860437ffc8869bc6b20e844c0
refs: #4728
diff --git a/daemon/mgmt/tables-config-section.hpp b/daemon/mgmt/tables-config-section.hpp
index d1ac1d4..932df2c 100644
--- a/daemon/mgmt/tables-config-section.hpp
+++ b/daemon/mgmt/tables-config-section.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,7 +38,7 @@
* tables
* {
* cs_max_packets 65536
- * cs_policy priority_fifo
+ * cs_policy lru
* cs_unsolicited_policy drop-all
*
* strategy_choice
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index 1663d8f..85ef388 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -37,11 +37,10 @@
NFD_LOG_INIT(ContentStore);
-unique_ptr<Policy>
+static unique_ptr<Policy>
makeDefaultPolicy()
{
- const std::string DEFAULT_POLICY = "priority_fifo";
- return Policy::create(DEFAULT_POLICY);
+ return Policy::create("lru");
}
Cs::Cs(size_t nMaxPackets)
diff --git a/nfd.conf.sample.in b/nfd.conf.sample.in
index 8efc2ab..c015eb0 100644
--- a/nfd.conf.sample.in
+++ b/nfd.conf.sample.in
@@ -51,7 +51,7 @@
; Set the CS replacement policy.
; Available policies are: priority_fifo, lru
- cs_policy priority_fifo
+ cs_policy lru
; Set a policy to decide whether to cache or drop unsolicited Data.
; Available policies are: drop-all, admit-local, admit-network, admit-all
diff --git a/tests/daemon/mgmt/tables-config-section.t.cpp b/tests/daemon/mgmt/tables-config-section.t.cpp
index 32aab40..a52b688 100644
--- a/tests/daemon/mgmt/tables-config-section.t.cpp
+++ b/tests/daemon/mgmt/tables-config-section.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -162,9 +162,9 @@
}
)CONFIG";
- BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
+ runConfig(CONFIG, false);
cs::Policy* currentPolicy = cs.getPolicy();
- NFD_CHECK_TYPEID_EQUAL(*currentPolicy, cs::PriorityFifoPolicy);
+ NFD_CHECK_TYPEID_EQUAL(*currentPolicy, cs::LruPolicy);
}
BOOST_AUTO_TEST_CASE(Known)
@@ -172,17 +172,17 @@
const std::string CONFIG = R"CONFIG(
tables
{
- cs_policy lru
+ cs_policy priority_fifo
}
)CONFIG";
- BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, true));
+ runConfig(CONFIG, true);
cs::Policy* currentPolicy = cs.getPolicy();
- NFD_CHECK_TYPEID_EQUAL(*currentPolicy, cs::PriorityFifoPolicy);
-
- BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
- currentPolicy = cs.getPolicy();
NFD_CHECK_TYPEID_EQUAL(*currentPolicy, cs::LruPolicy);
+
+ runConfig(CONFIG, false);
+ currentPolicy = cs.getPolicy();
+ NFD_CHECK_TYPEID_EQUAL(*currentPolicy, cs::PriorityFifoPolicy);
}
BOOST_AUTO_TEST_CASE(Unknown)