]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2432] Use RRCollator during RRsetCollection construction (zone-loading)
authorMukund Sivaraman <muks@isc.org>
Thu, 3 Jan 2013 11:48:45 +0000 (17:18 +0530)
committerMukund Sivaraman <muks@isc.org>
Thu, 3 Jan 2013 11:48:45 +0000 (17:18 +0530)
src/lib/dns/rrset_collection.cc
src/lib/dns/rrset_collection.h

index a16e529cec932c65046f7ae52a649f8f0ca6d772..0c804a746bf409db688b84687ff6af38d518cd0f 100644 (file)
@@ -15,6 +15,7 @@
 #include <dns/rrset_collection.h>
 #include <dns/master_loader_callbacks.h>
 #include <dns/master_loader.h>
+#include <dns/rrcollator.h>
 
 #include <exceptions/exceptions.h>
 
@@ -31,16 +32,6 @@ RRsetCollection::loaderCallback(const std::string&, size_t, const std::string&)
      // We just ignore callbacks for errors and warnings.
 }
 
-void
-RRsetCollection::addRRset(const Name& name, const RRClass& rrclass,
-                          const RRType& rrtype, const RRTTL& rrttl,
-                          const rdata::RdataPtr& data)
-{
-    RRsetPtr rrset(new BasicRRset(name, rrclass, rrtype, rrttl));
-    rrset->addRdata(data);
-    addRRset(rrset);
-}
-
 void
 RRsetCollection::addRRset(RRsetPtr rrset) {
     const CollectionKey key(rrset->getClass(), rrset->getType(),
@@ -60,14 +51,15 @@ void
 RRsetCollection::constructHelper(T source, const isc::dns::Name& origin,
                                  const isc::dns::RRClass& rrclass)
 {
+    RRCollator collator(boost::bind(&RRsetCollection::addRRset, this, _1));
     MasterLoaderCallbacks callbacks
         (boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3),
          boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3));
     MasterLoader loader(source, origin, rrclass, callbacks,
-                        boost::bind(&RRsetCollection::addRRset,
-                                    this, _1, _2, _3, _4, _5),
+                        collator.getCallback(),
                         MasterLoader::DEFAULT);
     loader.load();
+    collator.flush();
 }
 
 RRsetCollection::RRsetCollection(const char* filename, const Name& origin,
index 1456f9f0d6538e7753ba9bd2fe868ff4bf9aa378..bc1d185495b1cb9dda2c3e5040b59b0275e7c4ff 100644 (file)
@@ -121,9 +121,6 @@ private:
     template<typename T>
     void constructHelper(T source, const isc::dns::Name& origin,
                          const isc::dns::RRClass& rrclass);
-    void addRRset(const isc::dns::Name& name, const isc::dns::RRClass& rrclass,
-                  const isc::dns::RRType& rrtype, const isc::dns::RRTTL& rrttl,
-                  const isc::dns::rdata::RdataPtr& data);
     void loaderCallback(const std::string&, size_t, const std::string&);
 
     typedef boost::tuple<isc::dns::RRClass, isc::dns::RRType, isc::dns::Name>