]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2204] removed server function/template param from configureDataSourceGeneric.
authorJINMEI Tatuya <jinmei@isc.org>
Fri, 5 Oct 2012 23:48:03 +0000 (16:48 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Fri, 5 Oct 2012 23:48:03 +0000 (16:48 -0700)
This is pure cleanup.  This function already doesn't use the server.

src/bin/auth/benchmarks/query_bench.cc
src/bin/auth/datasrc_config.cc
src/bin/auth/datasrc_config.h
src/bin/auth/main.cc
src/bin/auth/tests/auth_srv_unittest.cc
src/bin/auth/tests/command_unittest.cc
src/bin/auth/tests/datasrc_config_unittest.cc

index 73f702baff11f135ae2876714f5daac66baf463e..d732f945be90cefad44bff094d4db99e1c43d88e 100644 (file)
@@ -126,7 +126,6 @@ public:
         QueryBenchMark(queries, query_message, buffer)
     {
         configureDataSource(
-            *server_,
             Element::fromJSON("{\"IN\":"
                               "  [{\"type\": \"sqlite3\","
                               "    \"params\": {"
@@ -145,7 +144,6 @@ public:
         QueryBenchMark(queries, query_message, buffer)
     {
         configureDataSource(
-            *server_,
             Element::fromJSON("{\"IN\":"
                               "  [{\"type\": \"MasterFiles\","
                               "    \"cache-enable\": true, "
index bef6e57de71c2de184ef6307f5de9d6e0093643d..62c3c7a6ba4dea306d95e0a97073f6670c6c6ad6 100644 (file)
@@ -19,8 +19,7 @@
 // This is a trivial specialization for the commonly used version.
 // Defined in .cc to avoid accidental creation of multiple copies.
 AuthSrv::DataSrcClientListsPtr
-configureDataSource(AuthSrv& server, const isc::data::ConstElementPtr& config)
-{
-    return (configureDataSourceGeneric<AuthSrv,
-            isc::datasrc::ConfigurableClientList>(server, config));
+configureDataSource(const isc::data::ConstElementPtr& config) {
+    return (configureDataSourceGeneric<
+            isc::datasrc::ConfigurableClientList>(config));
 }
index 9a6f7ac64a9608eef89ad1277a86d2a3b29be300..842d2ca9275e5f1d1989ac31252e8231ca1bd726 100644 (file)
 #include <utility>
 #include <set>
 
-/// \brief Configure the authoritative server's data source lists
+/// \brief Configure data source client lists
 ///
-/// This will hook into the data_sources module configuration and it will
-/// keep the local copy of data source clients in the list in the authoritative
-/// server.
+/// This will hook into the data_sources module configuration and it return
+/// a new set (in the form of a shared pointer to map) of data source client
+/// lists corresponding to the configuration.
 ///
 /// This function is templated. This is simply because of easier testing.
 /// You don't need to pay attention to it, use the configureDataSource
 /// specialization instead.
 ///
-/// \param server It is the server to configure.
 /// \param config The configuration value to parse. It is in the form
 ///     as an update from the config manager.
-template<class Server, class List>
+/// \return A map from RR classes to configured lists.
+template<class List>
 boost::shared_ptr<std::map<isc::dns::RRClass,
                            boost::shared_ptr<List> > > // = ListMap below
-configureDataSourceGeneric(Server& /*server*/,
-                           const isc::data::ConstElementPtr& config)
-{
+configureDataSourceGeneric(const isc::data::ConstElementPtr& config) {
     typedef boost::shared_ptr<List> ListPtr;
     typedef std::map<std::string, isc::data::ConstElementPtr> Map;
     typedef std::map<isc::dns::RRClass, ListPtr> ListMap;
@@ -68,7 +66,7 @@ configureDataSourceGeneric(Server& /*server*/,
 /// \brief Concrete version of configureDataSource() for the
 ///     use with authoritative server implementation.
 AuthSrv::DataSrcClientListsPtr
-configureDataSource(AuthSrv& server, const isc::data::ConstElementPtr& config);
+configureDataSource(const isc::data::ConstElementPtr& config);
 
 #endif  // DATASRC_CONFIG_H
 
index 2a17112ba4bed795231e12028f55228474177c36..d9b01314a2195a25900d3b1cba8d7c4bdda0689f 100644 (file)
@@ -103,11 +103,10 @@ datasrcConfigHandler(AuthSrv* server, bool* first_time,
             assert(config_session != NULL);
             *first_time = false;
             lists = configureDataSource(
-                *auth_server,
                 config_session->getRemoteConfigValue("data_sources",
                                                      "classes"));
         } else {
-            lists = configureDataSource(*server, config->get("classes"));
+            lists = configureDataSource(config->get("classes"));
         }
 
         // Replace the server's lists.  By ignoring the return value we let the
index f250d70f05a25488be4e6179bfc91e7b6a6d7f72..2668ecc79ac29f0e8e6c2ace281d9a2788678b30 100644 (file)
@@ -740,7 +740,7 @@ updateDatabase(AuthSrv& server, const char* params) {
         "    \"type\": \"sqlite3\","
         "    \"params\": " + string(params) +
         "}]}"));
-    installDataSrcClientLists(server, configureDataSource(server, config));
+    installDataSrcClientLists(server, configureDataSource(config));
 }
 
 void
@@ -757,7 +757,7 @@ updateInMemory(AuthSrv& server, const char* origin, const char* filename) {
         "   \"type\": \"static\","
         "   \"params\": \"" + string(STATIC_DSRC_FILE) + "\""
         "}]}"));
-    installDataSrcClientLists(server, configureDataSource(server, config));
+    installDataSrcClientLists(server, configureDataSource(config));
 }
 
 void
@@ -767,7 +767,7 @@ updateBuiltin(AuthSrv& server) {
         "   \"type\": \"static\","
         "   \"params\": \"" + string(STATIC_DSRC_FILE) + "\""
         "}]}"));
-    installDataSrcClientLists(server, configureDataSource(server, config));
+    installDataSrcClientLists(server, configureDataSource(config));
 }
 
 // Try giving the server a TSIG signed request and see it can anwer signed as
@@ -965,7 +965,7 @@ TEST_F(AuthSrvTest, updateWithInMemoryClient) {
         "   \"params\": {},"
         "   \"cache-enable\": true"
         "}]}"));
-    installDataSrcClientLists(server, configureDataSource(server, config));
+    installDataSrcClientLists(server, configureDataSource(config));
     // after successful configuration, we should have one (with empty zoneset).
 
     // The memory data source is empty, should return REFUSED rcode.
index 36d13906b4d3630af4e9e67f9ccb24cb944774a6..48b00400675ee1fd30ddcadc739e023fd7a76161 100644 (file)
@@ -218,7 +218,7 @@ configureZones(AuthSrv& server) {
         "   \"cache-enable\": true"
         "}]}"));
 
-    installDataSrcClientLists(server, configureDataSource(server, config));
+    installDataSrcClientLists(server, configureDataSource(config));
 
     zoneChecks(server);
 }
@@ -281,7 +281,7 @@ TEST_F(AuthCommandTest,
         "    \"cache-enable\": true,"
         "    \"cache-zones\": [\"example.org\"]"
         "}]}"));
-    installDataSrcClientLists(server_, configureDataSource(server_, config));
+    installDataSrcClientLists(server_, configureDataSource(config));
 
     {
         isc::util::thread::Mutex::Locker locker(server_.getClientListMutex());
@@ -345,7 +345,7 @@ TEST_F(AuthCommandTest,
         "    \"cache-enable\": true,"
         "    \"cache-zones\": [\"example.com\"]"
         "}]}"));
-    EXPECT_THROW(configureDataSource(server_, config2),
+    EXPECT_THROW(configureDataSource(config2),
                  ConfigurableClientList::ConfigurationError);
 
     result_ = execAuthServerCommand(server_, "loadzone",
index 82067d30d8b646b034fa55051eccb69b37f61567..ba554fe859a77bc05d165076f971df37e439052c 100644 (file)
@@ -163,10 +163,10 @@ void
 testConfigureDataSource(DatasrcConfigTest& test,
                         const isc::data::ConstElementPtr& config)
 {
-    // We use the test fixture for the Server type.  This makes it possible
-    // to easily fake all needed methods and look that they were called.
+    // We use customized (faked lists) for the List type.  This makes it
+    // possible to easily look that they were called.
     shared_ptr<std::map<dns::RRClass, ListPtr> > lists =
-        configureDataSourceGeneric<DatasrcConfigTest, FakeList>(test, config);
+        configureDataSourceGeneric<FakeList>(config);
     test.swapDataSrcClientLists(lists);
 }