BIND 10 trac2858, updated. 911bc00db21e59aa98870381c3c0a8d190923f1c [2858] Initiate sending of updates
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Aug 21 10:27:39 UTC 2013
The branch, trac2858 has been updated
via 911bc00db21e59aa98870381c3c0a8d190923f1c (commit)
from fe0477b2919e96eb742dbcd0c211189010273d22 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 911bc00db21e59aa98870381c3c0a8d190923f1c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Aug 21 12:23:56 2013 +0200
[2858] Initiate sending of updates
Call sending of updates to readers from the relevant places. The method
is empty for now.
-----------------------------------------------------------------------
Summary of changes:
src/bin/memmgr/memmgr.py.in | 12 ++++++++++--
src/bin/memmgr/tests/memmgr_test.py | 11 +++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/memmgr/memmgr.py.in b/src/bin/memmgr/memmgr.py.in
index 7a4cc85..6e0c30c 100755
--- a/src/bin/memmgr/memmgr.py.in
+++ b/src/bin/memmgr/memmgr.py.in
@@ -132,6 +132,14 @@ class Memmgr(BIND10Server):
self._builder_command_queue.append(cmd)
self._builder_cv.notify_all()
+ def _send_update_to_readers(self, sgmt_info):
+ """
+ Send update command to all the readers in the segment info.
+
+ The sending might get skipped if there's no info to send with it yet.
+ """
+ pass
+
def _notify_from_builder(self):
"""
Read the notifications from the builder thread.
@@ -156,8 +164,7 @@ class Memmgr(BIND10Server):
if cmd is not None:
self._cmd_to_builder(cmd)
else:
- pass
- # TODO: Send to the readers, #2858
+ self._send_update_to_readers(sgmt_info)
else:
raise ValueError('Unknown notification name: ' + notif_name)
@@ -202,6 +209,7 @@ class Memmgr(BIND10Server):
for dsrc_info in self._datasrc_info_list:
for sgmt_info in dsrc_info.segment_info_map.values():
sgmt_info.add_reader(reader)
+ self._send_update_to_readers(sgmt_info)
def _unsubscribe_reader(self, reader):
for dsrc_info in self._datasrc_info_list:
diff --git a/src/bin/memmgr/tests/memmgr_test.py b/src/bin/memmgr/tests/memmgr_test.py
index f8bceda..2c07309 100755
--- a/src/bin/memmgr/tests/memmgr_test.py
+++ b/src/bin/memmgr/tests/memmgr_test.py
@@ -342,6 +342,7 @@ class TestMemmgr(unittest.TestCase):
"""
Check the updating of reader sets work sane.
"""
+ obj = self
class SgmtInfo:
def __init__(self):
self.actions = []
@@ -356,6 +357,10 @@ class TestMemmgr(unittest.TestCase):
{(isc.dns.RRClass.IN, "name"): sgmt_info}
dsrc_info = DataSrcInfo()
self.__mgr._datasrc_info_list.append(dsrc_info)
+ sent_updates = []
+ def send_update(info):
+ sent_updates.append(info)
+ self.__mgr._send_update_to_readers = send_update
self.__mgr._subscribe_reader('reader1')
self.__mgr._unsubscribe_reader('reader2')
self.assertEqual(sgmt_info.actions, [('add', 'reader1'),
@@ -384,6 +389,10 @@ class TestMemmgr(unittest.TestCase):
def mock_cmd_to_builder(cmd):
commands.append(cmd)
self.__mgr._cmd_to_builder = mock_cmd_to_builder
+ updates = []
+ def send_update(info):
+ updates.append(info)
+ self.__mgr._send_update_to_readers = send_update
self.__mgr._builder_lock = threading.Lock()
# Extract the reference for the queue. We get a copy of the reference
@@ -395,6 +404,7 @@ class TestMemmgr(unittest.TestCase):
self.__mgr._notify_from_builder()
# All notifications are now eaten
self.assertEqual([], notif_ref)
+ self.assertEqual([], updates)
self.assertEqual(['command'], commands)
del commands[:]
# The new command is sent
@@ -409,6 +419,7 @@ class TestMemmgr(unittest.TestCase):
notif_ref.append(('unhandled',))
self.assertRaises(ValueError, self.__mgr._notify_from_builder)
self.assertEqual([], notif_ref)
+ self.assertEqual([sgmt_info], updates)
def test_send_to_builder(self):
"""
More information about the bind10-changes
mailing list