Parcourir la source

[1975] TODO for the time we support caches

The search semantics will be slightly different at places. The places
are now marked and explained.
Michal 'vorner' Vaner il y a 13 ans
Parent
commit
4ddcc3bd00
1 fichiers modifiés avec 18 ajouts et 2 suppressions
  1. 18 2
      src/lib/datasrc/container.cc

+ 18 - 2
src/lib/datasrc/container.cc

@@ -34,14 +34,25 @@ Container::SearchResult
 ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
                               bool ) const
 {
-    // Nothing yet.
+    // Nothing found yet.
+    // Pointer is used as the SearchResult can't be assigned.
     auto_ptr<SearchResult> candidate(new SearchResult());
+
     BOOST_FOREACH(const DataSourceInfo& info, data_sources_) {
+        // TODO: Once we have support for the caches, consider them too here
+        // somehow. This would probably get replaced by a function, that
+        // checks if there's a cache available, if it is, checks the loaded
+        // zones and zones expected to be in the real data source. If it is
+        // the cached one, provide the cached one. If it is in the external
+        // data source, use the datasource and don't provide the finder yet.
         DataSourceClient::FindResult result(info.data_src_->findZone(name));
         switch (result.code) {
             case result::SUCCESS: {
                 // If we found an exact match, we have no hope to getting
                 // a better one. Stop right here.
+
+                // TODO: In case we have only the datasource and not the finder
+                // and the need_updater parameter is true, get the zone there.
                 return (SearchResult(info.data_src_, result.zone_finder,
                                      name.getLabelCount(), true));
             }
@@ -66,7 +77,12 @@ ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
             }
         }
     }
-    // Return the partial match we have.
+
+    // TODO: In case we have only the datasource and not the finder
+    // and the need_updater parameter is true, get the zone there.
+
+    // Return the partial match we have. In case we didn't want a partial
+    // match, this surely contains the original empty result.
     return (*candidate);
 }