Parcourir la source

[1975] Remove matched_labels from the result

They are likely not to be useful anyway and this allows a small
optimisation.
Michal 'vorner' Vaner il y a 13 ans
Parent
commit
b66ca2c6cc
3 fichiers modifiés avec 5 ajouts et 16 suppressions
  1. 2 2
      src/lib/datasrc/list.cc
  2. 3 13
      src/lib/datasrc/list.h
  3. 0 1
      src/lib/datasrc/tests/list_unittest.cc

+ 2 - 2
src/lib/datasrc/list.cc

@@ -81,7 +81,7 @@ ConfigurableClientList::find(const dns::Name& name, bool want_exact_match,
         operator FindResult() const {
             // Conversion to the right result. If we return this, there was
             // a partial match at best.
-            return (FindResult(datasrc_client, finder, matched_labels, false));
+            return (FindResult(datasrc_client, finder, false));
         }
     } candidate;
 
@@ -102,7 +102,7 @@ ConfigurableClientList::find(const dns::Name& name, bool want_exact_match,
                 // TODO: In case we have only the datasource and not the finder
                 // and the need_updater parameter is true, get the zone there.
                 return (FindResult(info.data_src_client_, result.zone_finder,
-                                   name.getLabelCount(), true));
+                                   true));
             }
             case result::PARTIALMATCH: {
                 if (!want_exact_match) {

+ 3 - 13
src/lib/datasrc/list.h

@@ -65,22 +65,19 @@ public:
         ///
         /// It simply fills in the member variables according to the
         /// parameters. See the member descriptions for their meaning.
-        FindResult(DataSourceClient* dsrc_client,
-                   const ZoneFinderPtr& finder,
-                   uint8_t matched_labels, bool exact_match) :
+        FindResult(DataSourceClient* dsrc_client, const ZoneFinderPtr& finder,
+                   bool exact_match) :
             dsrc_client_(dsrc_client),
             finder_(finder),
-            matched_labels_(matched_labels),
             exact_match_(exact_match)
         { }
 
         /// \brief Negative answer constructor.
         ///
         /// This conscructs a result for negative answer. Both pointers are
-        /// NULL, matched_labels_ is 0 and exact_match_ is false.
+        /// NULL, and exact_match_ is false.
         FindResult() :
             dsrc_client_(NULL),
-            matched_labels_(0),
             exact_match_(false)
         { }
 
@@ -91,7 +88,6 @@ public:
         bool operator ==(const FindResult& other) const {
         return (dsrc_client_ == other.dsrc_client_ &&
                 finder_ == other.finder_ &&
-                matched_labels_ == other.matched_labels_ &&
                 exact_match_ == other.exact_match_);
         }
 
@@ -114,12 +110,6 @@ public:
         /// \see find
         const ZoneFinderPtr finder_;
 
-        /// \brief Number of matching labels.
-        ///
-        /// The number of labels the result have in common with the queried
-        /// name of zone.
-        const uint8_t matched_labels_;
-
         /// \brief If the result is an exact match.
         const bool exact_match_;
     };

+ 0 - 1
src/lib/datasrc/tests/list_unittest.cc

@@ -191,7 +191,6 @@ public:
         EXPECT_EQ(dsrc.get(), result.dsrc_client_);
         ASSERT_NE(ZoneFinderPtr(), result.finder_);
         EXPECT_EQ(name, result.finder_->getOrigin());
-        EXPECT_EQ(name.getLabelCount(), result.matched_labels_);
         EXPECT_EQ(exact, result.exact_match_);
     }
     // Configure the list with multiple data sources, according to