Browse Source

[1331] Add journaling parameter to getUpdater

As the application can't call the constructor directly, it will be
passed from here.

Defaults to false as a backward compatibility (might be temporary)
Michal 'vorner' Vaner 13 years ago
parent
commit
d287d9c92e

+ 6 - 1
src/lib/datasrc/client.h

@@ -278,11 +278,16 @@ public:
     ///
     /// \param name The zone name to be updated
     /// \param replace Whether to delete existing RRs before making updates
+    /// \param journaling The zone updater should store a journal of the
+    ///     changes (such journal can be used, for example, by IXFR-out).
+    ///     This is a hint only (the updater might be unable to store or
+    ///     not store the journal).
     ///
     /// \return A pointer to the updater; it will be NULL if the specified
     /// zone isn't found.
     virtual ZoneUpdaterPtr getUpdater(const isc::dns::Name& name,
-                                      bool replace) const = 0;
+                                      bool replace, bool journaling = false)
+        const = 0;
 };
 }
 }

+ 4 - 1
src/lib/datasrc/database.cc

@@ -975,7 +975,10 @@ DatabaseUpdater::commit() {
 
 // The updater factory
 ZoneUpdaterPtr
-DatabaseClient::getUpdater(const isc::dns::Name& name, bool replace) const {
+DatabaseClient::getUpdater(const isc::dns::Name& name, bool replace,
+                           bool) const
+{
+    // TODO: Handle journaling (pass it to the updater)
     shared_ptr<DatabaseAccessor> update_accessor(accessor_->clone());
     const std::pair<bool, int> zone(update_accessor->startUpdateZone(
                                         name.toText(), replace));

+ 2 - 1
src/lib/datasrc/database.h

@@ -872,7 +872,8 @@ public:
     /// accessor.  The returned updater will be able to work separately from
     /// the original client.
     virtual ZoneUpdaterPtr getUpdater(const isc::dns::Name& name,
-                                      bool replace) const;
+                                      bool replace,
+                                      bool journaling = false) const;
 
 private:
     /// \brief The RR class that this client handles.

+ 1 - 1
src/lib/datasrc/memory_datasrc.cc

@@ -811,7 +811,7 @@ InMemoryClient::getIterator(const Name& name) const {
 }
 
 ZoneUpdaterPtr
-InMemoryClient::getUpdater(const isc::dns::Name&, bool) const {
+InMemoryClient::getUpdater(const isc::dns::Name&, bool, bool) const {
     isc_throw(isc::NotImplemented, "Update attempt on in memory data source");
 }
 

+ 2 - 1
src/lib/datasrc/memory_datasrc.h

@@ -283,7 +283,8 @@ public:
     /// to update via its updater (this may or may not be a good idea and
     /// is subject to further discussions).
     virtual ZoneUpdaterPtr getUpdater(const isc::dns::Name& name,
-                                      bool replace) const;
+                                      bool replace, bool journaling = false)
+        const;
 
 private:
     // TODO: Do we still need the PImpl if nobody should manipulate this class

+ 3 - 1
src/lib/datasrc/tests/client_unittest.cc

@@ -32,7 +32,9 @@ public:
     virtual FindResult findZone(const isc::dns::Name&) const {
         return (FindResult(result::NOTFOUND, ZoneFinderPtr()));
     }
-    virtual ZoneUpdaterPtr getUpdater(const isc::dns::Name&, bool) const {
+    virtual ZoneUpdaterPtr getUpdater(const isc::dns::Name&, bool, bool)
+        const
+    {
         return (ZoneUpdaterPtr());
     }
 };