Browse Source

[2376] Function declaration to create the callbacks

Including documentation, the implementation is not there yet.
Michal 'vorner' Vaner 12 years ago
parent
commit
04e4c63889

+ 1 - 0
src/lib/datasrc/Makefile.am

@@ -35,6 +35,7 @@ libb10_datasrc_la_SOURCES += database.h database.cc
 libb10_datasrc_la_SOURCES += factory.h factory.cc
 libb10_datasrc_la_SOURCES += client_list.h client_list.cc
 libb10_datasrc_la_SOURCES += memory_datasrc.h memory_datasrc.cc
+libb10_datasrc_la_SOURCES += loader_callbacks.h loader_callbacks.cc
 nodist_libb10_datasrc_la_SOURCES = datasrc_messages.h datasrc_messages.cc
 libb10_datasrc_la_LDFLAGS = -no-undefined -version-info 1:0:1
 

+ 22 - 0
src/lib/datasrc/loader_callbacks.cc

@@ -0,0 +1,22 @@
+// 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.
+
+#include <datasrc/loader_callbacks.h>
+
+namespace isc {
+namespace datasrc {
+
+
+}
+}

+ 50 - 0
src/lib/datasrc/loader_callbacks.h

@@ -0,0 +1,50 @@
+// 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 DATASRC_LOADER_CALLBACKS_H
+#define DATASRC_LOADER_CALLBACKS_H
+
+#include <dns/loader_callbacks.h>
+
+namespace isc {
+namespace datasrc {
+
+class ZoneUpdater;
+
+/// \brief Create callbacks to fill loaded zone into updater.
+///
+/// This will create set of callbacks for the MasterLoader that
+/// will fill the loaded rrsets into a zone updater. If any issues
+/// are found, it logs them. If any of the issues are errors and
+/// the ok parameter is non-NULL, it is set to false.
+///
+/// \param updater The zone updater used as the destination for the
+///     RRsets. It should be opened in the replace mode and should
+///     be clean (no changes done to it). It is not commited
+///     automatically and it is up to the caller to commit (or not)
+///     when the loading is done.
+/// \param name Name of the zone. Used in logging.
+/// \param rrclass The class of the zone. Used in logging.
+/// \param ok If this is non-NULL and there are any errors during
+///     the loading, it is set to false. Otherwise, it is untouched.
+/// \return Set of callbacks to be passed to the master loader.
+/// \throw std::bad_alloc when allocation fails.
+dns::LoaderCallbacks
+createCallbacks(ZoneUpdater& updater, const dns::Name& name,
+                const dns::RRClass& rrclass, bool* ok);
+
+}
+}
+
+#endif