Parcourir la source

[1259] Add the buffer into diff

Michal 'vorner' Vaner il y a 13 ans
Parent
commit
e2eca96f18

+ 11 - 0
src/lib/python/isc/xfrin/diff.py

@@ -56,6 +56,7 @@ class Diff:
             raise NoSuchZone("Zone " + str(zone) +
                              " does not exist in the data source " +
                              str(datasource))
+        self.__buffer = []
 
     def add_data(self, rr):
         """
@@ -103,3 +104,13 @@ class Diff:
         This might raise isc.datasrc.Error.
         """
         pass
+
+    def get_buffer(self):
+        """
+        Returns the current buffer of changes not yet passed into the data
+        source. It is in a form like [('add', rrset), ('remove', rrset),
+        ('remove', rrset), ...].
+
+        Probably useful only for testing and introspection purposes.
+        """
+        return self.__buffer

+ 1 - 0
src/lib/python/isc/xfrin/tests/diff_tests.py

@@ -55,6 +55,7 @@ class DiffTest(unittest.TestCase):
         """
         diff = Diff(self, Name('example.org.'))
         self.assertTrue(self.__updater_requested)
+        self.assertEqual([], diff.get_buffer())
 
     def test_create_nonexist(self):
         """