BIND 10 trac2209, updated. f4dd53d74dfa8496e8f846960ac7424493858848 [2209] Store the segment in client list

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 26 18:49:25 UTC 2012


The branch, trac2209 has been updated
       via  f4dd53d74dfa8496e8f846960ac7424493858848 (commit)
      from  84df8fb3d06ad81e04fee73b6a31890ddc03c33e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f4dd53d74dfa8496e8f846960ac7424493858848
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Oct 26 20:47:18 2012 +0200

    [2209] Store the segment in client list
    
    So the memory client doesn't have to provide an interface to return it.
    It was hairy to some extent.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/client_list.cc                     |    8 +++++---
 src/lib/datasrc/client_list.h                      |    5 +++--
 src/lib/datasrc/memory/memory_client.h             |   12 ------------
 .../datasrc/tests/memory/memory_client_unittest.cc |    8 --------
 4 files changed, 8 insertions(+), 25 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index 4e440ef..448277d 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -44,22 +44,24 @@ namespace datasrc {
 ConfigurableClientList::DataSourceInfo::DataSourceInfo(
     DataSourceClient* data_src_client,
     const DataSourceClientContainerPtr& container, bool has_cache,
-    const RRClass& rrclass, shared_ptr<ZoneTableSegment>& segment) :
+    const RRClass& rrclass, const shared_ptr<ZoneTableSegment>& segment) :
     data_src_client_(data_src_client),
     container_(container)
 {
     if (has_cache) {
         cache_.reset(new InMemoryClient(segment, rrclass));
+        segment_ = segment;
     }
 }
 
 ConfigurableClientList::DataSourceInfo::DataSourceInfo(
-    const RRClass& rrclass, shared_ptr<ZoneTableSegment>& segment,
+    const RRClass& rrclass, const shared_ptr<ZoneTableSegment>& segment,
     bool has_cache) :
     data_src_client_(NULL)
 {
     if (has_cache) {
         cache_.reset(new InMemoryClient(segment, rrclass));
+        segment_ = segment;
     }
 }
 
@@ -446,7 +448,7 @@ ConfigurableClientList::getCachedZoneWriter(const Name& name) {
     }
     return (ZoneWriterPair(ZONE_SUCCESS,
                            ZoneWriterPtr(
-                               result.info->cache_->getZoneTableSegment().
+                               result.info->segment_->
                                getZoneWriter(load_action, name, rrclass_))));
 }
 
diff --git a/src/lib/datasrc/client_list.h b/src/lib/datasrc/client_list.h
index a6a030e..9df4950 100644
--- a/src/lib/datasrc/client_list.h
+++ b/src/lib/datasrc/client_list.h
@@ -333,14 +333,14 @@ public:
     struct DataSourceInfo {
         // Plays a role of default constructor too (for vector)
         DataSourceInfo(const dns::RRClass& rrclass,
-                       boost::shared_ptr
+                       const boost::shared_ptr
                            <isc::datasrc::memory::ZoneTableSegment>&
                                ztable_segment,
                        bool has_cache = false);
         DataSourceInfo(DataSourceClient* data_src_client,
                        const DataSourceClientContainerPtr& container,
                        bool has_cache, const dns::RRClass& rrclass,
-                       boost::shared_ptr
+                       const boost::shared_ptr
                            <isc::datasrc::memory::ZoneTableSegment>&
                                ztable_segment);
         DataSourceClient* data_src_client_;
@@ -353,6 +353,7 @@ public:
         // No other applications or tests may use it.
         const DataSourceClient* getCacheClient() const;
         boost::shared_ptr<memory::InMemoryClient> cache_;
+        boost::shared_ptr<memory::ZoneTableSegment> segment_;
     };
 
     /// \brief The collection of data sources.
diff --git a/src/lib/datasrc/memory/memory_client.h b/src/lib/datasrc/memory/memory_client.h
index 08d0ef8..3218c75 100644
--- a/src/lib/datasrc/memory/memory_client.h
+++ b/src/lib/datasrc/memory/memory_client.h
@@ -179,18 +179,6 @@ public:
     getJournalReader(const isc::dns::Name& zone, uint32_t begin_serial,
                      uint32_t end_serial) const;
 
-    /// \brief Get the zone table segment used
-    ///
-    /// This is a low-level function, used to some internal handling when,
-    /// for example, reloading the data inside the in-memory data source.
-    /// It should not be generally used.
-    ///
-    /// \todo Consider making this private and add a friend declaration
-    ///     for the ClientList.
-    ZoneTableSegment& getZoneTableSegment() {
-        return (*ztable_segment_);
-    }
-
 private:
     // Some type aliases
     typedef DomainTree<std::string> FileNameTree;
diff --git a/src/lib/datasrc/tests/memory/memory_client_unittest.cc b/src/lib/datasrc/tests/memory/memory_client_unittest.cc
index bbff14f..c1d2f30 100644
--- a/src/lib/datasrc/tests/memory/memory_client_unittest.cc
+++ b/src/lib/datasrc/tests/memory/memory_client_unittest.cc
@@ -775,12 +775,4 @@ TEST_F(MemoryClientTest, getJournalReaderNotImplemented) {
                  isc::NotImplemented);
 }
 
-TEST_F(MemoryClientTest, getZoneTableSegment) {
-    // It's hard to test this method. It returns a reference, so we can't even
-    // check for non-NULL. Checking it doesn't throw/crash is good enough for
-    // now, the method will be used in other functions, so checked it works
-    // implicitly.
-    EXPECT_NO_THROW(client_->getZoneTableSegment());
-}
-
 }



More information about the bind10-changes mailing list