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) :
                           OutputBuffer& buffer) :
         QueryBenchMark(queries, query_message, 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.
         // we use it because we want to be synchronized with the server.
-        server_->getDataSrcClientsMgr().swapDataSrcClientLists(
+        server_->getDataSrcClientsMgr().setDataSrcClientLists(
             configureDataSource(
             configureDataSource(
                 Element::fromJSON("{\"IN\":"
                 Element::fromJSON("{\"IN\":"
                                   "  [{\"type\": \"sqlite3\","
                                   "  [{\"type\": \"sqlite3\","
@@ -148,7 +148,7 @@ public:
                          OutputBuffer& buffer) :
                          OutputBuffer& buffer) :
         QueryBenchMark(queries, query_message, buffer)
         QueryBenchMark(queries, query_message, buffer)
     {
     {
-        server_->getDataSrcClientsMgr().swapDataSrcClientLists(
+        server_->getDataSrcClientsMgr().setDataSrcClientLists(
             configureDataSource(
             configureDataSource(
                 Element::fromJSON("{\"IN\":"
                 Element::fromJSON("{\"IN\":"
                                   "  [{\"type\": \"MasterFiles\","
                                   "  [{\"type\": \"MasterFiles\","

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

@@ -219,14 +219,14 @@ public:
         reconfigureHook();      // for test's customization
         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
     /// This is provided only for some existing tests until we support a
     /// cleaner way to use faked data source clients.  Non test code or
     /// cleaner way to use faked data source clients.  Non test code or
     /// newer tests must not use this.
     /// newer tests must not use this.
-    void swapDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) {
+    void setDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) {
         typename MutexType::Locker locker(map_mutex_);
         typename MutexType::Locker locker(map_mutex_);
-        clients_map_.swap(new_lists);
+        clients_map_ = new_lists;
     }
     }
 
 
 private:
 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
     // For now, we use explicit swap than reconfigure() because the latter
     // involves a separate thread and cannot guarantee the new config is
     // involves a separate thread and cannot guarantee the new config is
     // available for the subsequent test.
     // available for the subsequent test.
-    server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+    server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
 }
 }
 
 
 void
 void
@@ -1447,7 +1447,7 @@ TEST_F(AuthSrvTest,
     }
     }
     DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
     DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
     lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
     lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
-    server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+    server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
 
 
     createDataFromFile("nsec3query_nodnssec_fromWire.wire");
     createDataFromFile("nsec3query_nodnssec_fromWire.wire");
     server.processMessage(*io_message, *parse_message, *response_obuffer,
     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>);
     DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
     lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
     lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
-    mgr.swapDataSrcClientLists(lists);
+    mgr.setDataSrcClientLists(lists);
 }
 }
 
 
 TEST_F(AuthSrvTest,
 TEST_F(AuthSrvTest,

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

@@ -193,7 +193,7 @@ zoneChecks(AuthSrv& server) {
 
 
 void
 void
 installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) {
 installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) {
-    server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+    server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
 }
 }
 
 
 void
 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 {
 class DatasrcConfigTest : public ::testing::Test {
 public:
 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
         lists_.clear();         // first empty it
 
 
@@ -161,7 +161,7 @@ testConfigureDataSource(DatasrcConfigTest& test,
     // possible to easily look that they were called.
     // possible to easily look that they were called.
     shared_ptr<std::map<dns::RRClass, ListPtr> > lists =
     shared_ptr<std::map<dns::RRClass, ListPtr> > lists =
         configureDataSourceGeneric<FakeList>(config);
         configureDataSourceGeneric<FakeList>(config);
-    test.swapDataSrcClientLists(lists);
+    test.setDataSrcClientLists(lists);
 }
 }
 
 
 // Push there a configuration with a single list.
 // Push there a configuration with a single list.