From: JINMEI Tatuya Date: Wed, 23 Jan 2013 22:47:51 +0000 (-0800) Subject: [2310] implemented basic part of in-memory findAtOrigin. X-Git-Tag: bind10-1.0.0-rc-release~25^2~10^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40bbfbc8f6fcfa08154b0c76ddbb41c2725f24f7;p=thirdparty%2Fkea.git [2310] implemented basic part of in-memory findAtOrigin. --- diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes index 6ac9db095e..6bf74e130e 100644 --- a/src/lib/datasrc/datasrc_messages.mes +++ b/src/lib/datasrc/datasrc_messages.mes @@ -486,6 +486,10 @@ Some resource types are singletons -- only one is allowed in a domain % DATASRC_MEM_SUCCESS query for '%1/%2' successful Debug information. The requested record was found. +% DATASRC_MEM_FIND_TYPE_AT_ORIGIN origin query for type %1 in in-memory zone %2/%3 successful +Debug information. A specific type RRset is requested at a zone origin +of an in-memory zone and it is found. + % DATASRC_MEM_SUPER_STOP stopped as '%1' is superdomain of a zone node, meaning it's empty Debug information. The search stopped because the requested domain was detected to be a superdomain of some existing node of zone (while there diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc index bc218699c9..fe4e3e1ace 100644 --- a/src/lib/datasrc/memory/zone_finder.cc +++ b/src/lib/datasrc/memory/zone_finder.cc @@ -721,8 +721,8 @@ InMemoryZoneFinder::Context::findAdditional( boost::shared_ptr InMemoryZoneFinder::find(const isc::dns::Name& name, - const isc::dns::RRType& type, - const FindOptions options) + const isc::dns::RRType& type, + const FindOptions options) { return (ZoneFinderContextPtr(new Context(*this, options, rrclass_, findInternal(name, type, @@ -731,8 +731,8 @@ InMemoryZoneFinder::find(const isc::dns::Name& name, boost::shared_ptr InMemoryZoneFinder::findAll(const isc::dns::Name& name, - std::vector& target, - const FindOptions options) + std::vector& target, + const FindOptions options) { return (ZoneFinderContextPtr(new Context(*this, options, rrclass_, findInternal(name, @@ -741,6 +741,32 @@ InMemoryZoneFinder::findAll(const isc::dns::Name& name, options)))); } +boost::shared_ptr +InMemoryZoneFinder::findAtOrigin(const isc::dns::RRType& type, + bool /*use_minttl*/, // not yet supported + const FindOptions options) +{ + const ZoneNode* const node = zone_data_.getOriginNode(); + const RdataSet* const found = RdataSet::find(node->getData(), type); + + if (found != NULL) { + LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_FIND_TYPE_AT_ORIGIN). + arg(type).arg(getOrigin()).arg(rrclass_); + return (ZoneFinderContextPtr( + new Context(*this, options, rrclass_, + createFindResult(rrclass_, zone_data_, SUCCESS, + node, found, options)))); + } + return (ZoneFinderContextPtr( + new Context(*this, options, rrclass_, + createFindResult(rrclass_, zone_data_, NXRRSET, + node, + getNSECForNXRRSET(zone_data_, + options, + node), + options)))); +} + ZoneFinderResultContext InMemoryZoneFinder::findInternal(const isc::dns::Name& name, const isc::dns::RRType& type, diff --git a/src/lib/datasrc/memory/zone_finder.h b/src/lib/datasrc/memory/zone_finder.h index 254f5d2e4f..b36d7c0703 100644 --- a/src/lib/datasrc/memory/zone_finder.h +++ b/src/lib/datasrc/memory/zone_finder.h @@ -60,6 +60,12 @@ public: const isc::dns::RRType& type, const FindOptions options = FIND_DEFAULT); + /// \brief Search for an RRset of given RR type at the zone origin + /// specialized for in-memory data source. + virtual boost::shared_ptr findAtOrigin( + const isc::dns::RRType& type, bool use_minttl, + FindOptions options); + /// \brief Version of find that returns all types at once /// /// It acts the same as find, just that when the correct node is found, @@ -108,3 +114,7 @@ private: } // namespace isc #endif // DATASRC_MEMORY_ZONE_FINDER_H + +// Local Variables: +// mode: c++ +// End: