From: JINMEI Tatuya Date: Fri, 5 Oct 2012 23:48:03 +0000 (-0700) Subject: [2204] removed server function/template param from configureDataSourceGeneric. X-Git-Tag: trac2351_base~1^2~8^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7846ea4a9d811c35641f77384d9825f12488e71;p=thirdparty%2Fkea.git [2204] removed server function/template param from configureDataSourceGeneric. This is pure cleanup. This function already doesn't use the server. --- diff --git a/src/bin/auth/benchmarks/query_bench.cc b/src/bin/auth/benchmarks/query_bench.cc index 73f702baff..d732f945be 100644 --- a/src/bin/auth/benchmarks/query_bench.cc +++ b/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, " diff --git a/src/bin/auth/datasrc_config.cc b/src/bin/auth/datasrc_config.cc index bef6e57de7..62c3c7a6ba 100644 --- a/src/bin/auth/datasrc_config.cc +++ b/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(server, config)); +configureDataSource(const isc::data::ConstElementPtr& config) { + return (configureDataSourceGeneric< + isc::datasrc::ConfigurableClientList>(config)); } diff --git a/src/bin/auth/datasrc_config.h b/src/bin/auth/datasrc_config.h index 9a6f7ac64a..842d2ca927 100644 --- a/src/bin/auth/datasrc_config.h +++ b/src/bin/auth/datasrc_config.h @@ -25,25 +25,23 @@ #include #include -/// \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 +/// \return A map from RR classes to configured lists. +template boost::shared_ptr > > // = ListMap below -configureDataSourceGeneric(Server& /*server*/, - const isc::data::ConstElementPtr& config) -{ +configureDataSourceGeneric(const isc::data::ConstElementPtr& config) { typedef boost::shared_ptr ListPtr; typedef std::map Map; typedef std::map 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 diff --git a/src/bin/auth/main.cc b/src/bin/auth/main.cc index 2a17112ba4..d9b01314a2 100644 --- a/src/bin/auth/main.cc +++ b/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 diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc index f250d70f05..2668ecc79a 100644 --- a/src/bin/auth/tests/auth_srv_unittest.cc +++ b/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. diff --git a/src/bin/auth/tests/command_unittest.cc b/src/bin/auth/tests/command_unittest.cc index 36d13906b4..48b0040067 100644 --- a/src/bin/auth/tests/command_unittest.cc +++ b/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", diff --git a/src/bin/auth/tests/datasrc_config_unittest.cc b/src/bin/auth/tests/datasrc_config_unittest.cc index 82067d30d8..ba554fe859 100644 --- a/src/bin/auth/tests/datasrc_config_unittest.cc +++ b/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 > lists = - configureDataSourceGeneric(test, config); + configureDataSourceGeneric(config); test.swapDataSrcClientLists(lists); }