Browse Source

[2204] removed server function/template param from configureDataSourceGeneric.

This is pure cleanup.  This function already doesn't use the server.
JINMEI Tatuya 12 years ago
parent
commit
ed2aceb01d

+ 0 - 2
src/bin/auth/benchmarks/query_bench.cc

@@ -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, "

+ 3 - 4
src/bin/auth/datasrc_config.cc

@@ -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));
 }

+ 8 - 10
src/bin/auth/datasrc_config.h

@@ -25,25 +25,23 @@
 #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
 

+ 1 - 2
src/bin/auth/main.cc

@@ -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

+ 4 - 4
src/bin/auth/tests/auth_srv_unittest.cc

@@ -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.

+ 3 - 3
src/bin/auth/tests/command_unittest.cc

@@ -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",

+ 3 - 3
src/bin/auth/tests/datasrc_config_unittest.cc

@@ -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);
 }