From: Jelte Jansen Date: Thu, 18 Oct 2012 18:11:53 +0000 (+0200) Subject: [2210] move DataSrcClientListsPtr typedef X-Git-Tag: trac2402_base~4^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0002fc16bf300d9a2ccfca9e26fdfd5a73eaf519;p=thirdparty%2Fkea.git [2210] move DataSrcClientListsPtr typedef from AuthSrv:: (in auth_srv.h) to isc:datasrc:: (in client_list.h), the previous location wasn't really relevant now that it is used elsewhere, and this seemed the most logical location --- diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc index 315a7527de..917ef48689 100644 --- a/src/bin/auth/auth_srv.cc +++ b/src/bin/auth/auth_srv.cc @@ -269,7 +269,7 @@ public: const shared_ptr* keyring_; /// The data source client list - AuthSrv::DataSrcClientListsPtr datasrc_client_lists_; + DataSrcClientListsPtr datasrc_client_lists_; shared_ptr getDataSrcClientList( const RRClass& rrclass) @@ -933,7 +933,7 @@ AuthSrv::destroyDDNSForwarder() { } } -AuthSrv::DataSrcClientListsPtr +DataSrcClientListsPtr AuthSrv::swapDataSrcClientLists(DataSrcClientListsPtr new_lists) { // TODO: Debug-build only check if (!impl_->mutex_.locked()) { diff --git a/src/bin/auth/auth_srv.h b/src/bin/auth/auth_srv.h index 0849bdd1d0..a70d51c105 100644 --- a/src/bin/auth/auth_srv.h +++ b/src/bin/auth/auth_srv.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -302,12 +303,6 @@ public: /// If there was no forwarder yet, this method does nothing. void destroyDDNSForwarder(); - /// \brief Shortcut typedef used for swapDataSrcClientLists(). - typedef boost::shared_ptr > > - DataSrcClientListsPtr; - /// \brief Swap the currently used set of data source client lists with /// given one. /// @@ -333,8 +328,8 @@ public: /// \param new_lists Shared pointer to a new set of data source client /// lists. /// \return The previous set of lists. It can be NULL. - DataSrcClientListsPtr swapDataSrcClientLists(DataSrcClientListsPtr - new_lists); + isc::datasrc::DataSrcClientListsPtr + swapDataSrcClientLists(isc::datasrc::DataSrcClientListsPtr new_lists); /// \brief Returns the currently used client list for the class. /// diff --git a/src/bin/auth/datasrc_clients_mgr.h b/src/bin/auth/datasrc_clients_mgr.h index 3e9d76f376..3336f9728a 100644 --- a/src/bin/auth/datasrc_clients_mgr.h +++ b/src/bin/auth/datasrc_clients_mgr.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -171,7 +170,7 @@ private: std::list command_queue_; CondVarType cond_; // condition variable for queue operations MutexType queue_mutex_; // mutex to protect the queue - AuthSrv::DataSrcClientListsPtr clients_map_; + isc::datasrc::DataSrcClientListsPtr clients_map_; MutexType map_mutex_; BuilderType builder_; @@ -208,7 +207,7 @@ public: /// \throw None DataSrcClientsBuilderBase(std::list* command_queue, CondVarType* cond, MutexType* queue_mutex, - AuthSrv::DataSrcClientListsPtr* clients_map, + isc::datasrc::DataSrcClientListsPtr* clients_map, MutexType* map_mutex ) : command_queue_(command_queue), cond_(cond), queue_mutex_(queue_mutex), @@ -236,7 +235,7 @@ private: void doReconfigure(const isc::data::ConstElementPtr& config) { if (config) { try { - AuthSrv::DataSrcClientListsPtr new_clients_map = + isc::datasrc::DataSrcClientListsPtr new_clients_map = configureDataSource(config); typename MutexType::Locker locker(*map_mutex_); std::swap(new_clients_map, *clients_map_); @@ -258,7 +257,7 @@ private: std::list* command_queue_; CondVarType* cond_; MutexType* queue_mutex_; - AuthSrv::DataSrcClientListsPtr* clients_map_; + isc::datasrc::DataSrcClientListsPtr* clients_map_; MutexType* map_mutex_; }; diff --git a/src/bin/auth/datasrc_config.cc b/src/bin/auth/datasrc_config.cc index 62c3c7a6ba..6452f95768 100644 --- a/src/bin/auth/datasrc_config.cc +++ b/src/bin/auth/datasrc_config.cc @@ -13,12 +13,11 @@ // PERFORMANCE OF THIS SOFTWARE. #include -#include "auth_srv.h" #include "datasrc_config.h" // This is a trivial specialization for the commonly used version. // Defined in .cc to avoid accidental creation of multiple copies. -AuthSrv::DataSrcClientListsPtr +isc::datasrc::DataSrcClientListsPtr 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 5707c6c8a0..dbecdfabc6 100644 --- a/src/bin/auth/datasrc_config.h +++ b/src/bin/auth/datasrc_config.h @@ -24,6 +24,7 @@ #include #include +#include /// \brief Configure data source client lists /// @@ -73,7 +74,7 @@ configureDataSourceGeneric(const isc::data::ConstElementPtr& config) { /// \brief Concrete version of configureDataSource() for the /// use with authoritative server implementation. -AuthSrv::DataSrcClientListsPtr +isc::datasrc::DataSrcClientListsPtr 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 c16c018b5c..47131b1bd3 100644 --- a/src/bin/auth/main.cc +++ b/src/bin/auth/main.cc @@ -96,7 +96,7 @@ datasrcConfigHandler(AuthSrv* server, bool* first_time, { assert(server != NULL); if (config->contains("classes")) { - AuthSrv::DataSrcClientListsPtr lists; + isc::datasrc::DataSrcClientListsPtr lists; if (*first_time) { // HACK: The default is not passed to the handler in the first diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc index 396b247491..11a545025c 100644 --- a/src/bin/auth/tests/auth_srv_unittest.cc +++ b/src/bin/auth/tests/auth_srv_unittest.cc @@ -727,7 +727,7 @@ TEST_F(AuthSrvTest, notifyWithSessionMessageError) { void installDataSrcClientLists(AuthSrv& server, - AuthSrv::DataSrcClientListsPtr lists) + DataSrcClientListsPtr lists) { thread::Mutex::Locker locker(server.getDataSrcClientListMutex()); server.swapDataSrcClientLists(lists); @@ -1444,7 +1444,7 @@ TEST_F(AuthSrvTest, boost::shared_ptr list(new FakeList(server.getDataSrcClientList(RRClass::IN()), THROW_NEVER, false)); - AuthSrv::DataSrcClientListsPtr lists(new std::map); + DataSrcClientListsPtr lists(new std::map); lists->insert(pair(RRClass::IN(), list)); server.swapDataSrcClientLists(lists); } @@ -1475,7 +1475,7 @@ setupThrow(AuthSrv& server, ThrowWhen throw_when, bool isc_exception, boost::shared_ptr list(new FakeList(server.getDataSrcClientList(RRClass::IN()), throw_when, isc_exception, rrset)); - AuthSrv::DataSrcClientListsPtr lists(new std::map); + DataSrcClientListsPtr lists(new std::map); lists->insert(pair(RRClass::IN(), list)); server.swapDataSrcClientLists(lists); } @@ -1792,7 +1792,7 @@ TEST_F(AuthSrvTest, clientList) { isc::util::thread::Mutex::Locker locker( server.getDataSrcClientListMutex()); - AuthSrv::DataSrcClientListsPtr lists; // initially empty + DataSrcClientListsPtr lists; // initially empty // The lists don't exist. Therefore, the list of RRClasses is empty. EXPECT_TRUE(server.swapDataSrcClientLists(lists)->empty()); diff --git a/src/bin/auth/tests/command_unittest.cc b/src/bin/auth/tests/command_unittest.cc index a245c3b53b..a5c4d9dfeb 100644 --- a/src/bin/auth/tests/command_unittest.cc +++ b/src/bin/auth/tests/command_unittest.cc @@ -18,7 +18,6 @@ #include -#include #include #include #include @@ -193,8 +192,7 @@ zoneChecks(AuthSrv& server) { } void -installDataSrcClientLists(AuthSrv& server, - AuthSrv::DataSrcClientListsPtr lists) +installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) { isc::util::thread::Mutex::Locker locker( server.getDataSrcClientListMutex()); diff --git a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc index 13c5bd4fe4..bc085f9140 100644 --- a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc +++ b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc @@ -22,6 +22,7 @@ #include using isc::data::ConstElementPtr; +using namespace isc::datasrc; using namespace isc::auth::datasrc_clientmgr_internal; namespace { @@ -37,7 +38,7 @@ protected: TestDataSrcClientsBuilder builder; std::list command_queue; // test command queue std::list delayed_command_queue; // commands available after wait - AuthSrv::DataSrcClientListsPtr clients_map; // 'configured' clients + DataSrcClientListsPtr clients_map; // configured clients TestCondVar cond; TestMutex queue_mutex; TestMutex map_mutex; @@ -103,7 +104,7 @@ TEST_F(DataSrcClientsBuilderTest, reconfigure) { Command reconfig_cmd(RECONFIGURE, ConstElementPtr()); // Initially, no clients should be there - EXPECT_EQ(AuthSrv::DataSrcClientListsPtr(), clients_map); + EXPECT_EQ(DataSrcClientListsPtr(), clients_map); // A config that doesn't do much except be accepted ConstElementPtr good_config = isc::data::Element::fromJSON( @@ -121,7 +122,7 @@ TEST_F(DataSrcClientsBuilderTest, reconfigure) { EXPECT_EQ(1, clients_map->size()); // Store the nonempty clients map we now have - AuthSrv::DataSrcClientListsPtr working_config_clients(clients_map); + DataSrcClientListsPtr working_config_clients(clients_map); // If a 'bad' command argument got here, the config validation should // have failed already, but still, the handler should return true, diff --git a/src/bin/auth/tests/test_datasrc_clients_mgr.cc b/src/bin/auth/tests/test_datasrc_clients_mgr.cc index 1794b731ef..a06c596616 100644 --- a/src/bin/auth/tests/test_datasrc_clients_mgr.cc +++ b/src/bin/auth/tests/test_datasrc_clients_mgr.cc @@ -28,7 +28,8 @@ std::list FakeDataSrcClientsBuilder::command_queue_copy; TestCondVar* FakeDataSrcClientsBuilder::cond = NULL; TestCondVar FakeDataSrcClientsBuilder::cond_copy; TestMutex* FakeDataSrcClientsBuilder::queue_mutex = NULL; -AuthSrv::DataSrcClientListsPtr* FakeDataSrcClientsBuilder::clients_map = NULL; +isc::datasrc::DataSrcClientListsPtr* + FakeDataSrcClientsBuilder::clients_map = NULL; TestMutex* FakeDataSrcClientsBuilder::map_mutex = NULL; TestMutex FakeDataSrcClientsBuilder::queue_mutex_copy; bool FakeDataSrcClientsBuilder::thread_waited = false; diff --git a/src/bin/auth/tests/test_datasrc_clients_mgr.h b/src/bin/auth/tests/test_datasrc_clients_mgr.h index 31d66c7ff9..a5e015e1d9 100644 --- a/src/bin/auth/tests/test_datasrc_clients_mgr.h +++ b/src/bin/auth/tests/test_datasrc_clients_mgr.h @@ -131,7 +131,7 @@ public: static std::list* command_queue; static TestCondVar* cond; static TestMutex* queue_mutex; - static AuthSrv::DataSrcClientListsPtr* clients_map; + static isc::datasrc::DataSrcClientListsPtr* clients_map; static TestMutex* map_mutex; static std::list command_queue_copy; static TestCondVar cond_copy; @@ -149,7 +149,7 @@ public: std::list* command_queue, TestCondVar* cond, TestMutex* queue_mutex, - AuthSrv::DataSrcClientListsPtr* clients_map, + isc::datasrc::DataSrcClientListsPtr* clients_map, TestMutex* map_mutex) { FakeDataSrcClientsBuilder::started = false; diff --git a/src/lib/datasrc/client_list.h b/src/lib/datasrc/client_list.h index 61544efb4a..97d7483f76 100644 --- a/src/lib/datasrc/client_list.h +++ b/src/lib/datasrc/client_list.h @@ -37,7 +37,6 @@ typedef boost::shared_ptr DataSourceClientPtr; class DataSourceClientContainer; typedef boost::shared_ptr DataSourceClientContainerPtr; - // XXX: it's better to even hide the existence of the "memory" namespace. // We should probably consider pimpl for details of ConfigurableClientList // and hide real definitions except for itself and tests. @@ -391,6 +390,11 @@ protected: DataSources data_sources_; }; +/// \brief Shortcut typedef for maps of client_lists. +typedef boost::shared_ptr > > + DataSrcClientListsPtr; + } // namespace datasrc } // namespace isc