]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2207] interface of the getZoneReloader
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 15 Oct 2012 09:28:35 +0000 (11:28 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 15 Oct 2012 09:28:35 +0000 (11:28 +0200)
src/lib/datasrc/memory/Makefile.am
src/lib/datasrc/memory/load_action.h [new file with mode: 0644]
src/lib/datasrc/memory/zone_reloader.h
src/lib/datasrc/memory/zone_table_segment.h
src/lib/datasrc/memory/zone_table_segment_local.h

index 192bbce965642cab3b638938eb98790d334367a5..7319602e8b228a95d62c26c3b379d0b2654f46d0 100644 (file)
@@ -23,6 +23,7 @@ libdatasrc_memory_la_SOURCES += zone_finder.h zone_finder.cc
 libdatasrc_memory_la_SOURCES += zone_table_segment.h zone_table_segment.cc
 libdatasrc_memory_la_SOURCES += zone_table_segment_local.h zone_table_segment_local.cc
 libdatasrc_memory_la_SOURCES += zone_reloader.h zone_reloader.cc
+libdatasrc_memory_la_SOURCES += load_action.h
 nodist_libdatasrc_memory_la_SOURCES = memory_messages.h memory_messages.cc
 
 EXTRA_DIST  = rdata_serialization_priv.cc
diff --git a/src/lib/datasrc/memory/load_action.h b/src/lib/datasrc/memory/load_action.h
new file mode 100644 (file)
index 0000000..e5fe004
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef LOAD_ACTION_H
+#define LOAD_ACTION_H
+
+#include <boost/function.hpp>
+
+namespace isc {
+// Forward declarations
+namespace util{
+class MemorySegment;
+}
+namespace datasrc {
+namespace memory {
+class ZoneData;
+
+/// \brief Callback to load data into the memory
+///
+/// This callback should create new ZoneData (allocated from the passed
+/// memory segment) and fill it with relevant loaded data. The caller
+/// of the callback takes ownership of the ZoneData.
+///
+/// It must not return NULL.
+typedef boost::function<ZoneData*(util::MemorySegment&)> LoadAction;
+
+}
+}
+}
+
+#endif
index 70572f71803bae1485df4dcd9aec50ece33ecc34..b1672377cbe4336d841ff905a95fae51f4f9191d 100644 (file)
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
+#ifndef ZONE_RELOADER_H
+#define ZONE_RELOADER_H
+
+#include "load_action.h"
+
 #include <dns/rrclass.h>
 #include <dns/name.h>
 
-#include <boost/function.hpp>
-
 namespace isc {
-// Forward declarations
-namespace util{
-class MemorySegment;
-}
 namespace datasrc {
 namespace memory {
 class ZoneData;
@@ -81,15 +80,6 @@ public:
     virtual void cleanup() = 0;
 };
 
-/// \brief Callback to load data into the memory
-///
-/// This callback should create new ZoneData (allocated from the passed
-/// memory segment) and fill it with relevant loaded data. The caller
-/// of the callback takes ownership of the ZoneData.
-///
-/// It must not return NULL.
-typedef boost::function<ZoneData*(util::MemorySegment&)> LoadAction;
-
 /// \brief Reloader implementation which loads data locally.
 ///
 /// This implementation prepares a clean zone data and lets one callback
@@ -147,3 +137,5 @@ private:
 }
 }
 }
+
+#endif
index 3c927e7944d787512625789adf2fbeee9412743f..d05af5811202619fe513e75ebbbf7e1a6dc7b6c2 100644 (file)
@@ -16,6 +16,7 @@
 #define __ZONE_TABLE_SEGMENT_H__
 
 #include <datasrc/memory/zone_table.h>
+#include "load_action.h"
 #include <cc/data.h>
 #include <util/memory_segment.h>
 
 #include <stdlib.h>
 
 namespace isc {
+// Some forward declarations
+namespace dns {
+class Name;
+class RRClass;
+}
 namespace datasrc {
 namespace memory {
+class ZoneReloader;
 
 /// \brief Memory-management independent entry point that contains a
 /// pointer to a zone table in memory.
@@ -121,6 +128,18 @@ public:
     ///
     /// \param segment The segment to destroy.
     static void destroy(ZoneTableSegment* segment);
+
+    /// \brief Create a reloader corresponding to this segment
+    ///
+    /// This creates a new reloader that can be used to reload zones
+    /// inside this zone table segment.
+    ///
+    /// \param loadAction Callback to provide the actual data.
+    /// \param origin The origin of the zone to reload.
+    /// \param rrclass The class of the zone to reload.
+    virtual ZoneReloader* getZoneReloader(const LoadAction& loadAction,
+                                          const dns::Name& origin,
+                                          const dns::RRClass& rrclass) = 0;
 };
 
 } // namespace memory
index de776a90360e1a224f492555b61473bcad4991b2..b6b76f9fdf655d0d53a09a9562cc1009938f7cee 100644 (file)
@@ -54,6 +54,10 @@ public:
     /// implementation (a MemorySegmentLocal instance).
     virtual isc::util::MemorySegment& getMemorySegment();
 
+    /// \brief Concrete implementation of ZoneTableSegment::getZoneReloader
+    virtual ZoneReloader* getZoneReloader(const LoadAction& loadAction,
+                                          const dns::Name& origin,
+                                          const dns::RRClass& rrclass);
 private:
     ZoneTableHeader header_;
     isc::util::MemorySegmentLocal mem_sgmt_;