From: Mukund Sivaraman Date: Thu, 7 Feb 2013 06:42:22 +0000 (+0530) Subject: [2281] Use the new in-memory data source for the static data source X-Git-Tag: bind10-1.1.0beta1-release~102^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60a9f3a768ebd546c8aeff70d84b769dc95836ca;p=thirdparty%2Fkea.git [2281] Use the new in-memory data source for the static data source --- diff --git a/src/lib/datasrc/Makefile.am b/src/lib/datasrc/Makefile.am index 1a5776f991..a63ece0663 100644 --- a/src/lib/datasrc/Makefile.am +++ b/src/lib/datasrc/Makefile.am @@ -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 diff --git a/src/lib/datasrc/static_datasrc_link.cc b/src/lib/datasrc/static_datasrc_link.cc index 789580d057..9334dc8048 100644 --- a/src/lib/datasrc/static_datasrc_link.cc +++ b/src/lib/datasrc/static_datasrc_link.cc @@ -14,6 +14,8 @@ #include "client.h" #include "memory_datasrc.h" +#include +#include #include #include @@ -32,16 +34,16 @@ namespace datasrc { DataSourceClient* createInstance(ConstElementPtr config, string& error) { try { + shared_ptr ztable_segment( + memory::ZoneTableSegment::create(*config, RRClass::CH())); // Create the data source - auto_ptr client(new InMemoryClient()); - // Hardcode the origin and class - shared_ptr - finder(new InMemoryZoneFinder(RRClass::CH(), Name("BIND"))); + auto_ptr 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) { diff --git a/src/lib/datasrc/tests/testdata/static.zone b/src/lib/datasrc/tests/testdata/static.zone index 5e9e8a65bd..51525dbdc5 100644 --- a/src/lib/datasrc/tests/testdata/static.zone +++ b/src/lib/datasrc/tests/testdata/static.zone @@ -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"