BIND 10 trac1060, updated. 8f5f77f8e2819a66de774a4b7f5216ebc631434c [trac1060] Make Query use abstract DataSourceClient

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jul 27 11:03:17 UTC 2011


The branch, trac1060 has been updated
       via  8f5f77f8e2819a66de774a4b7f5216ebc631434c (commit)
      from  34cfc02f00196f9f5124172b10de5cc8fea1081f (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 8f5f77f8e2819a66de774a4b7f5216ebc631434c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Jul 27 13:02:16 2011 +0200

    [trac1060] Make Query use abstract DataSourceClient
    
    It turns out to be simple search & replace, it didn't use any in-memory
    specific features. The rest of Auth still uses hardcoded in-memory, as
    it needs to load it, etc.

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

Summary of changes:
 src/bin/auth/query.cc                |    6 +++---
 src/bin/auth/query.h                 |   18 ++++++++----------
 src/bin/auth/tests/query_unittest.cc |    6 +++++-
 3 files changed, 16 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/auth/query.cc b/src/bin/auth/query.cc
index 8be006f..05bcd89 100644
--- a/src/bin/auth/query.cc
+++ b/src/bin/auth/query.cc
@@ -19,7 +19,7 @@
 #include <dns/rcode.h>
 #include <dns/rdataclass.h>
 
-#include <datasrc/memory_datasrc.h>
+#include <datasrc/client.h>
 
 #include <auth/query.h>
 
@@ -126,8 +126,8 @@ Query::process() const {
     const bool qtype_is_any = (qtype_ == RRType::ANY());
 
     response_.setHeaderFlag(Message::HEADERFLAG_AA, false);
-    const InMemoryClient::FindResult result =
-        memory_client_.findZone(qname_);
+    const DataSourceClient::FindResult result =
+        datasrc_client_.findZone(qname_);
 
     // If we have no matching authoritative zone for the query name, return
     // REFUSED.  In short, this is to be compatible with BIND 9, but the
diff --git a/src/bin/auth/query.h b/src/bin/auth/query.h
index d5b7e4e..61baa77 100644
--- a/src/bin/auth/query.h
+++ b/src/bin/auth/query.h
@@ -26,7 +26,7 @@ class RRset;
 }
 
 namespace datasrc {
-class InMemoryClient;
+class DataSourceClient;
 }
 
 namespace auth {
@@ -36,10 +36,8 @@ namespace auth {
 ///
 /// Many of the design details for this class are still in flux.
 /// We'll revisit and update them as we add more functionality, for example:
-/// - memory_client parameter of the constructor.  It is a data source that
-///   uses in memory dedicated backend.
 /// - as a related point, we may have to pass the RR class of the query.
-///   in the initial implementation the RR class is an attribute of memory
+///   in the initial implementation the RR class is an attribute of
 ///   datasource and omitted.  It's not clear if this assumption holds with
 ///   generic data sources.  On the other hand, it will help keep
 ///   implementation simpler, and we might rather want to modify the design
@@ -51,7 +49,7 @@ namespace auth {
 ///   separate attribute setter.
 /// - likewise, we'll eventually need to do per zone access control, for which
 ///   we need querier's information such as its IP address.
-/// - memory_client and response may better be parameters to process() instead
+/// - datasrc_client and response may better be parameters to process() instead
 ///   of the constructor.
 ///
 /// <b>Note:</b> The class name is intentionally the same as the one used in
@@ -135,15 +133,15 @@ public:
     ///
     /// This constructor never throws an exception.
     ///
-    /// \param memory_client The memory datasource wherein the answer to the query is
+    /// \param datasrc_client The datasource wherein the answer to the query is
     /// to be found.
     /// \param qname The query name
     /// \param qtype The RR type of the query
     /// \param response The response message to store the answer to the query.
-    Query(const isc::datasrc::InMemoryClient& memory_client,
+    Query(const isc::datasrc::DataSourceClient& datasrc_client,
           const isc::dns::Name& qname, const isc::dns::RRType& qtype,
           isc::dns::Message& response) :
-        memory_client_(memory_client), qname_(qname), qtype_(qtype),
+        datasrc_client_(datasrc_client), qname_(qname), qtype_(qtype),
         response_(response)
     {}
 
@@ -157,7 +155,7 @@ public:
     /// successful search would result in adding a corresponding RRset to
     /// the answer section of the response.
     ///
-    /// If no matching zone is found in the memory datasource, the RCODE of
+    /// If no matching zone is found in the datasource, the RCODE of
     /// SERVFAIL will be set in the response.
     /// <b>Note:</b> this is different from the error code that BIND 9 returns
     /// by default when it's configured as an authoritative-only server (and
@@ -208,7 +206,7 @@ public:
     };
 
 private:
-    const isc::datasrc::InMemoryClient& memory_client_;
+    const isc::datasrc::DataSourceClient& datasrc_client_;
     const isc::dns::Name& qname_;
     const isc::dns::RRType& qtype_;
     isc::dns::Message& response_;
diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc
index 49ce0d6..577b3ec 100644
--- a/src/bin/auth/tests/query_unittest.cc
+++ b/src/bin/auth/tests/query_unittest.cc
@@ -93,7 +93,7 @@ const char* const other_zone_rrs =
     "mx.delegation.example.com. 3600 IN A 192.0.2.100\n";
 
 // This is a mock Zone class for testing.
-// It is a derived class of Zone for the convenient of tests.
+// It is a derived class of ZoneFinder for the convenient of tests.
 // Its find() method emulates the common behavior of protocol compliant
 // zone classes, but simplifies some minor cases and also supports broken
 // behavior.
@@ -237,6 +237,10 @@ protected:
         memory_client.addZone(ZoneFinderPtr(mock_finder));
     }
     MockZoneFinder* mock_finder;
+    // We use InMemoryClient here. We could have some kind of mock client
+    // here, but historically, the Query supported only InMemoryClient
+    // (originally named MemoryDataSrc) and was tested with it, so we keep
+    // it like this for now.
     InMemoryClient memory_client;
     const Name qname;
     const RRClass qclass;




More information about the bind10-changes mailing list