BIND 10 trac2044, updated. 6d84b65cd4206e960b441fa47dff7c6b1b3ced6d [2044] Create the cache when requested
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jun 25 18:37:37 UTC 2012
The branch, trac2044 has been updated
via 6d84b65cd4206e960b441fa47dff7c6b1b3ced6d (commit)
from 98d893ecdff8ee42d270a9548f91fe3dffdf6c43 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6d84b65cd4206e960b441fa47dff7c6b1b3ced6d
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Jun 25 20:37:12 2012 +0200
[2044] Create the cache when requested
But it is not yet filled up
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/client_list.cc | 8 +++--
src/lib/datasrc/tests/client_list_unittest.cc | 45 ++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index d1d47f8..dd39c3b 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -38,8 +38,7 @@ ConfigurableClientList::DataSourceInfo::DataSourceInfo(
}
void
-ConfigurableClientList::configure(const Element& config, bool) {
- // TODO: Implement the cache
+ConfigurableClientList::configure(const Element& config, bool allowCache) {
// TODO: Implement recycling from the old configuration.
size_t i(0); // Outside of the try to be able to access it in the catch
try {
@@ -61,9 +60,12 @@ ConfigurableClientList::configure(const Element& config, bool) {
// Ask the factory to create the data source for us
const DataSourcePair ds(this->getDataSourceClient(type,
paramConf));
+ const bool wantCache(allowCache &&
+ dconf->contains("cache-enable") &&
+ dconf->get("cache-enable")->boolValue());
// And put it into the vector
new_data_sources.push_back(DataSourceInfo(ds.first, ds.second,
- false));
+ wantCache));
}
// If everything is OK up until now, we have the new configuration
// ready. So just put it there and let the old one die when we exit
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index 608ccc7..3d55c49 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -166,7 +166,6 @@ public:
config_elem_(Element::fromJSON("["
"{"
" \"type\": \"test_type\","
- " \"cache\": \"off\","
" \"params\": {}"
"}]"))
{
@@ -472,4 +471,48 @@ TEST_F(ListTest, dataSrcError) {
checkDS(0, "test_type", "{}", false);
}
+// Check we can get the cache
+TEST_F(ListTest, configureCacheEmpty) {
+ ConstElementPtr elem(Element::fromJSON("["
+ "{"
+ " \"type\": \"type1\","
+ " \"cache-enable\": true,"
+ " \"cache-zones\": [],"
+ " \"params\": {}"
+ "},"
+ "{"
+ " \"type\": \"type2\","
+ " \"cache-enable\": false,"
+ " \"cache-zones\": [],"
+ " \"params\": {}"
+ "}]"
+ ));
+ list_->configure(*elem, true);
+ EXPECT_EQ(2, list_->getDataSources().size());
+ checkDS(0, "type1", "{}", true);
+ checkDS(1, "type2", "{}", false);
+}
+
+// But no cache if we disallow it globally
+TEST_F(ListTest, configureCacheDisabled) {
+ ConstElementPtr elem(Element::fromJSON("["
+ "{"
+ " \"type\": \"type1\","
+ " \"cache-enable\": true,"
+ " \"cache-zones\": [],"
+ " \"params\": {}"
+ "},"
+ "{"
+ " \"type\": \"type2\","
+ " \"cache-enable\": false,"
+ " \"cache-zones\": [],"
+ " \"params\": {}"
+ "}]"
+ ));
+ list_->configure(*elem, false);
+ EXPECT_EQ(2, list_->getDataSources().size());
+ checkDS(0, "type1", "{}", false);
+ checkDS(1, "type2", "{}", false);
+}
+
}
More information about the bind10-changes
mailing list