|
@@ -34,14 +34,25 @@ Container::SearchResult
|
|
ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
|
|
ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
|
|
bool ) const
|
|
bool ) const
|
|
{
|
|
{
|
|
- // Nothing yet.
|
|
|
|
|
|
+ // Nothing found yet.
|
|
|
|
+ // Pointer is used as the SearchResult can't be assigned.
|
|
auto_ptr<SearchResult> candidate(new SearchResult());
|
|
auto_ptr<SearchResult> candidate(new SearchResult());
|
|
|
|
+
|
|
BOOST_FOREACH(const DataSourceInfo& info, data_sources_) {
|
|
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));
|
|
DataSourceClient::FindResult result(info.data_src_->findZone(name));
|
|
switch (result.code) {
|
|
switch (result.code) {
|
|
case result::SUCCESS: {
|
|
case result::SUCCESS: {
|
|
// If we found an exact match, we have no hope to getting
|
|
// If we found an exact match, we have no hope to getting
|
|
// a better one. Stop right here.
|
|
// 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,
|
|
return (SearchResult(info.data_src_, result.zone_finder,
|
|
name.getLabelCount(), true));
|
|
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);
|
|
return (*candidate);
|
|
}
|
|
}
|
|
|
|
|