]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2281] Use the new in-memory data source for the static data source
authorMukund Sivaraman <muks@isc.org>
Thu, 7 Feb 2013 06:42:22 +0000 (12:12 +0530)
committerMukund Sivaraman <muks@isc.org>
Thu, 7 Feb 2013 06:42:22 +0000 (12:12 +0530)
src/lib/datasrc/Makefile.am
src/lib/datasrc/static_datasrc_link.cc
src/lib/datasrc/tests/testdata/static.zone

index 1a5776f99114b8ecb6a08917c2807fdf5982d6c9..a63ece06633fca1142e60d3351918a472c6e7705 100644 (file)
@@ -63,6 +63,7 @@ memory_ds_la_LIBADD += libb10-datasrc.la
 static_ds_la_SOURCES = static_datasrc_link.cc
 static_ds_la_LDFLAGS = -module -avoid-version
 static_ds_la_LIBADD = $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
+static_ds_la_LIBADD += $(top_builddir)/src/lib/datasrc/memory/libdatasrc_memory.la
 static_ds_la_LIBADD += libb10-datasrc.la
 
 libb10_datasrc_la_LIBADD = $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
index 789580d057437fcc66980a908bcad1e8468c645f..9334dc80488afee96938ea6024ea5aeba9aecceb 100644 (file)
@@ -14,6 +14,8 @@
 
 #include "client.h"
 #include "memory_datasrc.h"
+#include <datasrc/memory/memory_client.h>
+#include <datasrc/memory/zone_table_segment.h>
 
 #include <cc/data.h>
 #include <dns/rrclass.h>
@@ -32,16 +34,16 @@ namespace datasrc {
 DataSourceClient*
 createInstance(ConstElementPtr config, string& error) {
     try {
+        shared_ptr<memory::ZoneTableSegment> ztable_segment(
+            memory::ZoneTableSegment::create(*config, RRClass::CH()));
         // Create the data source
-        auto_ptr<InMemoryClient> client(new InMemoryClient());
-        // Hardcode the origin and class
-        shared_ptr<InMemoryZoneFinder>
-            finder(new InMemoryZoneFinder(RRClass::CH(), Name("BIND")));
+        auto_ptr<memory::InMemoryClient> client
+            (new memory::InMemoryClient(ztable_segment, RRClass::CH()));
+
         // Fill it with data
         const string path(config->stringValue());
-        finder->load(path);
-        // And put the zone inside
-        client->addZone(finder);
+        client->load(Name("BIND"), path);
+
         return (client.release());
     }
     catch (const std::exception& e) {
index 5e9e8a65bdc69e322b5b967a6296c07b657d305d..51525dbdc53fd951fb985253c91edc769563b889 100644 (file)
@@ -1,2 +1,3 @@
-BIND.           3600    CH  SOA BIND. BIND. 1 3600 300 36000 3600
+BIND.           3600    CH  SOA BIND. BIND. 3 3600 300 36000 3600
+BIND.           3600    CH  NS  BIND.
 VERSION.BIND.   3600    CH  TXT "10"