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
--- /dev/null
+// 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
// 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;
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
}
}
}
+
+#endif
#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.
///
/// \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
/// 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_;