This is pure cleanup. This function already doesn't use the server.
QueryBenchMark(queries, query_message, buffer)
{
configureDataSource(
- *server_,
Element::fromJSON("{\"IN\":"
" [{\"type\": \"sqlite3\","
" \"params\": {"
QueryBenchMark(queries, query_message, buffer)
{
configureDataSource(
- *server_,
Element::fromJSON("{\"IN\":"
" [{\"type\": \"MasterFiles\","
" \"cache-enable\": true, "
// 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));
}
#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;
/// \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
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
" \"type\": \"sqlite3\","
" \"params\": " + string(params) +
"}]}"));
- installDataSrcClientLists(server, configureDataSource(server, config));
+ installDataSrcClientLists(server, configureDataSource(config));
}
void
" \"type\": \"static\","
" \"params\": \"" + string(STATIC_DSRC_FILE) + "\""
"}]}"));
- installDataSrcClientLists(server, configureDataSource(server, config));
+ installDataSrcClientLists(server, configureDataSource(config));
}
void
" \"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
" \"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.
" \"cache-enable\": true"
"}]}"));
- installDataSrcClientLists(server, configureDataSource(server, config));
+ installDataSrcClientLists(server, configureDataSource(config));
zoneChecks(server);
}
" \"cache-enable\": true,"
" \"cache-zones\": [\"example.org\"]"
"}]}"));
- installDataSrcClientLists(server_, configureDataSource(server_, config));
+ installDataSrcClientLists(server_, configureDataSource(config));
{
isc::util::thread::Mutex::Locker locker(server_.getClientListMutex());
" \"cache-enable\": true,"
" \"cache-zones\": [\"example.com\"]"
"}]}"));
- EXPECT_THROW(configureDataSource(server_, config2),
+ EXPECT_THROW(configureDataSource(config2),
ConfigurableClientList::ConfigurationError);
result_ = execAuthServerCommand(server_, "loadzone",
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);
}