BIND 10 trac2835, updated. 0be5bed016c3b12abf5e7049ab7b63d2d474efc0 [2835] The ClientList::getStatus method
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 15 11:43:22 UTC 2013
The branch, trac2835 has been updated
via 0be5bed016c3b12abf5e7049ab7b63d2d474efc0 (commit)
from 2e6d5f8d602a632d8a770c13d7ccbc09a25825ad (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 0be5bed016c3b12abf5e7049ab7b63d2d474efc0
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Mar 15 12:39:30 2013 +0100
[2835] The ClientList::getStatus method
So one can extract status of all the data source clients from the list
and allow using it from future management of the memory segments.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/client_list.cc | 11 +++++++++
src/lib/datasrc/client_list.h | 6 +++++
src/lib/datasrc/tests/client_list_unittest.cc | 31 ++++++++++++++++++++++---
3 files changed, 45 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index 3c01555..51d1af3 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -475,5 +475,16 @@ ConfigurableClientList::getDataSourceClient(const string& type,
return (DataSourcePair(&container->getInstance(), container));
}
+vector<DataSourceStatus>
+ConfigurableClientList::getStatus() const {
+ vector<DataSourceStatus> result;
+ BOOST_FOREACH(const DataSourceInfo& info, data_sources_) {
+ // TODO: Once we support mapped cache, provide the correct MSS_ value
+ result.push_back(DataSourceStatus(info.name_, info.cache_ ? MSS_LOCAL :
+ MSS_UNUSED));
+ }
+ return (result);
+}
+
}
}
diff --git a/src/lib/datasrc/client_list.h b/src/lib/datasrc/client_list.h
index 28c0e20..a3d8e53 100644
--- a/src/lib/datasrc/client_list.h
+++ b/src/lib/datasrc/client_list.h
@@ -430,6 +430,12 @@ public:
virtual DataSourcePair getDataSourceClient(const std::string& type,
const data::ConstElementPtr&
configuration);
+
+ /// \brief Get status information of all internal data sources.
+ ///
+ /// Get a DataSourceStatus for current state of each data source client
+ /// in this list.
+ std::vector<DataSourceStatus> getStatus() const;
public:
/// \brief Access to the data source clients.
///
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index 445bc22..99117a5 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -512,12 +512,12 @@ TEST_F(ListTest, configureMulti) {
const ConstElementPtr elem(Element::fromJSON("["
"{"
" \"type\": \"type1\","
- " \"cache\": \"off\","
+ " \"cache-enable\": false,"
" \"params\": {}"
"},"
"{"
" \"type\": \"type2\","
- " \"cache\": \"off\","
+ " \"cache-enable\": false,"
" \"params\": {}"
"}]"
));
@@ -546,7 +546,7 @@ TEST_F(ListTest, configureParams) {
ConstElementPtr elem(Element::fromJSON(string("["
"{"
" \"type\": \"t\","
- " \"cache\": \"off\","
+ " \"cache-enable\": false,"
" \"params\": ") + *param +
"}]"));
list_->configure(elem, true);
@@ -555,6 +555,31 @@ TEST_F(ListTest, configureParams) {
}
}
+TEST_F(ListTest, status) {
+ EXPECT_TRUE(list_->getStatus().empty());
+ const ConstElementPtr elem(Element::fromJSON("["
+ "{"
+ " \"type\": \"type1\","
+ " \"cache-enable\": false,"
+ " \"params\": {}"
+ "},"
+ "{"
+ " \"type\": \"type2\","
+ " \"cache-enable\": true,"
+ " \"cache-zones\": [],"
+ " \"name\": \"Test name\","
+ " \"params\": {}"
+ "}]"
+ ));
+ list_->configure(elem, true);
+ const vector<DataSourceStatus> statuses(list_->getStatus());
+ ASSERT_EQ(2, statuses.size());
+ EXPECT_EQ("type1", statuses[0].getName());
+ EXPECT_EQ(MSS_UNUSED, statuses[0].getSegmentState());
+ EXPECT_EQ("Test name", statuses[1].getName());
+ EXPECT_EQ(MSS_LOCAL, statuses[1].getSegmentState());
+}
+
TEST_F(ListTest, wrongConfig) {
const char* configs[] = {
// A lot of stuff missing from there
More information about the bind10-changes
mailing list