Browse Source

[2211] s/swapDataSrcClientLists/setDataSrcClientLists/ and changed the behavior

the users of this method only need the set behavior, and the previous code
actually didn't swap them as expected anyway.
JINMEI Tatuya 12 years ago
parent
commit
113201b72b

+ 3 - 3
src/bin/auth/benchmarks/query_bench.cc

@@ -127,9 +127,9 @@ public:
                           OutputBuffer& buffer) :
         QueryBenchMark(queries, query_message, buffer)
     {
-        // Note: swapDataSrcClientLists() may be deprecated, but until then
+        // Note: setDataSrcClientLists() may be deprecated, but until then
         // we use it because we want to be synchronized with the server.
-        server_->getDataSrcClientsMgr().swapDataSrcClientLists(
+        server_->getDataSrcClientsMgr().setDataSrcClientLists(
             configureDataSource(
                 Element::fromJSON("{\"IN\":"
                                   "  [{\"type\": \"sqlite3\","
@@ -148,7 +148,7 @@ public:
                          OutputBuffer& buffer) :
         QueryBenchMark(queries, query_message, buffer)
     {
-        server_->getDataSrcClientsMgr().swapDataSrcClientLists(
+        server_->getDataSrcClientsMgr().setDataSrcClientLists(
             configureDataSource(
                 Element::fromJSON("{\"IN\":"
                                   "  [{\"type\": \"MasterFiles\","

+ 3 - 3
src/bin/auth/datasrc_clients_mgr.h

@@ -219,14 +219,14 @@ public:
         reconfigureHook();      // for test's customization
     }
 
-    /// \brief Swap the underlying data source client lists.
+    /// \brief Set the underlying data source client lists to new lists.
     ///
     /// This is provided only for some existing tests until we support a
     /// cleaner way to use faked data source clients.  Non test code or
     /// newer tests must not use this.
-    void swapDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) {
+    void setDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) {
         typename MutexType::Locker locker(map_mutex_);
-        clients_map_.swap(new_lists);
+        clients_map_ = new_lists;
     }
 
 private:

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

@@ -730,7 +730,7 @@ installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) {
     // For now, we use explicit swap than reconfigure() because the latter
     // involves a separate thread and cannot guarantee the new config is
     // available for the subsequent test.
-    server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+    server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
 }
 
 void
@@ -1447,7 +1447,7 @@ TEST_F(AuthSrvTest,
     }
     DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
     lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
-    server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+    server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
 
     createDataFromFile("nsec3query_nodnssec_fromWire.wire");
     server.processMessage(*io_message, *parse_message, *response_obuffer,
@@ -1479,7 +1479,7 @@ setupThrow(AuthSrv& server, ThrowWhen throw_when, bool isc_exception,
     }
     DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
     lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
-    mgr.swapDataSrcClientLists(lists);
+    mgr.setDataSrcClientLists(lists);
 }
 
 TEST_F(AuthSrvTest,

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

@@ -193,7 +193,7 @@ zoneChecks(AuthSrv& server) {
 
 void
 installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) {
-    server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+    server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
 }
 
 void

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

@@ -77,8 +77,8 @@ datasrcConfigHandler(DatasrcConfigTest* fake_server, const std::string&,
 
 class DatasrcConfigTest : public ::testing::Test {
 public:
-    void swapDataSrcClientLists(shared_ptr<std::map<dns::RRClass, ListPtr> >
-                                new_lists)
+    void setDataSrcClientLists(shared_ptr<std::map<dns::RRClass, ListPtr> >
+                               new_lists)
     {
         lists_.clear();         // first empty it
 
@@ -161,7 +161,7 @@ testConfigureDataSource(DatasrcConfigTest& test,
     // possible to easily look that they were called.
     shared_ptr<std::map<dns::RRClass, ListPtr> > lists =
         configureDataSourceGeneric<FakeList>(config);
-    test.swapDataSrcClientLists(lists);
+    test.setDataSrcClientLists(lists);
 }
 
 // Push there a configuration with a single list.