]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2108] Pass memory segment to InMemoryClient constructor
authorMukund Sivaraman <muks@isc.org>
Mon, 10 Sep 2012 07:41:13 +0000 (13:11 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 10 Sep 2012 07:41:13 +0000 (13:11 +0530)
src/lib/datasrc/memory/memory_client.cc
src/lib/datasrc/memory/memory_client.h
src/lib/datasrc/memory/tests/memory_client_unittest.cc

index 7758e3cae92a7fba25712fb7be33f24c8484b4fd..5617690d29b8901e4925ef025e7258ba76f78cd8 100644 (file)
@@ -87,7 +87,9 @@ private:
     };
 
 public:
-    InMemoryClientImpl(RRClass rrclass) :
+    InMemoryClientImpl(util::MemorySegment& mem_sgmt,
+                       RRClass rrclass) :
+        local_mem_sgmt_(mem_sgmt),
         rrclass_(rrclass),
         zone_count_(0),
         zone_table_(ZoneTable::create(local_mem_sgmt_, rrclass)),
@@ -106,7 +108,7 @@ public:
     // Memory segment to allocate/deallocate memory for the zone table.
     // (This will eventually have to be abstract; for now we hardcode the
     // specific derived segment class).
-    util::MemorySegmentLocal local_mem_sgmt_;
+    util::MemorySegment& local_mem_sgmt_;
     const RRClass rrclass_;
     unsigned int zone_count_;
     ZoneTable* zone_table_;
@@ -671,8 +673,9 @@ generateRRsetFromIterator(ZoneIterator* iterator, LoadCallback callback) {
 }
 }
 
-InMemoryClient::InMemoryClient(RRClass rrclass) :
-    impl_(new InMemoryClientImpl(rrclass))
+InMemoryClient::InMemoryClient(util::MemorySegment& mem_sgmt,
+                               RRClass rrclass) :
+    impl_(new InMemoryClientImpl(mem_sgmt, rrclass))
 {}
 
 InMemoryClient::~InMemoryClient() {
index 0c211c1dd4aa06a2f5ea5afafbfd77e158012975..a28125950f80a4542107fe833a529eac1f873665 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef DATASRC_MEMORY_CLIENT_H
 #define DATASRC_MEMORY_CLIENT_H 1
 
+#include <util/memory_segment.h>
+
 #include <datasrc/iterator.h>
 #include <datasrc/client.h>
 #include <datasrc/memory/zone_table.h>
@@ -62,7 +64,8 @@ public:
     /// This constructor internally involves resource allocation, and if
     /// it fails, a corresponding standard exception will be thrown.
     /// It never throws an exception otherwise.
-    InMemoryClient(isc::dns::RRClass rrclass);
+    InMemoryClient(util::MemorySegment& mem_sgmt,
+                   isc::dns::RRClass rrclass);
 
     /// The destructor.
     ~InMemoryClient();
index b86a3bd05d5ed9754a4313c3c6527c6dbed2d371..0290a28cb4ed113d2875f033b75c65b452bde73e 100644 (file)
@@ -107,7 +107,7 @@ public:
 class MemoryClientTest : public ::testing::Test {
 protected:
     MemoryClientTest() : zclass_(RRClass::IN()),
-                         client_(new InMemoryClient(zclass_))
+                         client_(new InMemoryClient(mem_sgmt_, zclass_))
     {}
     ~MemoryClientTest() {
         if (client_ != NULL) {