BIND 10 trac2854, updated. 361853d37c33abd413b48f9bc1c80578840aa901 [2854] changed the return type of get_reset_param() from string to dict.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 26 00:08:15 UTC 2013
The branch, trac2854 has been updated
via 361853d37c33abd413b48f9bc1c80578840aa901 (commit)
from befc536e55419f950791c6b32398ed6416d1abdd (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 361853d37c33abd413b48f9bc1c80578840aa901
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Jun 25 11:08:45 2013 -0700
[2854] changed the return type of get_reset_param() from string to dict.
as it will probably be more convenient.
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/memmgr/datasrc_info.py | 16 +++++++++-------
.../python/isc/memmgr/tests/datasrc_info_tests.py | 5 ++---
2 files changed, 11 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/memmgr/datasrc_info.py b/src/lib/python/isc/memmgr/datasrc_info.py
index 00e03d8..86f2d6a 100644
--- a/src/lib/python/isc/memmgr/datasrc_info.py
+++ b/src/lib/python/isc/memmgr/datasrc_info.py
@@ -14,7 +14,6 @@
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import os
-import json
class SegmentInfoError(Exception):
"""An exception raised for general errors in the SegmentInfo class."""
@@ -80,11 +79,14 @@ class SegmentInfo:
def get_reset_param(self, user_type):
"""Return parameters to reset the zone table memory segment.
- It returns a json expression in string that contains parameters for
- the specified type of user to reset a zone table segment with
- isc.datasrc.ConfigurableClientList.reset_memory_segment().
- It can also be passed to the user module as part of command
- parameters.
+ It returns a dict object that consists of parameter mappings
+ (string to parameter value) for the specified type of user to
+ reset a zone table segment with
+ isc.datasrc.ConfigurableClientList.reset_memory_segment(). It
+ can also be passed to the user module as part of command
+ parameters. Note that reset_memory_segment() takes a json
+ expression encoded as a string, so the return value of this method
+ will have to be converted with json.dumps().
Each subclass must implement this method.
@@ -142,7 +144,7 @@ class MappedSegmentInfo(SegmentInfo):
if ver is None:
return None
mapped_file = self.__mapped_file_base + '.' + str(ver)
- return json.dumps({'mapped-file': mapped_file})
+ return {'mapped-file': mapped_file}
def switch_versions(self):
# Swith the versions as noted in the constructor.
diff --git a/src/lib/python/isc/memmgr/tests/datasrc_info_tests.py b/src/lib/python/isc/memmgr/tests/datasrc_info_tests.py
index cc44863..cc6307f 100644
--- a/src/lib/python/isc/memmgr/tests/datasrc_info_tests.py
+++ b/src/lib/python/isc/memmgr/tests/datasrc_info_tests.py
@@ -13,7 +13,6 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-import json
import os
import unittest
@@ -52,7 +51,7 @@ class TestSegmentInfo(unittest.TestCase):
if expected_ver is None:
self.assertIsNone(self.__sgmt_info.get_reset_param(user_type))
return
- param = json.loads(self.__sgmt_info.get_reset_param(user_type))
+ param = self.__sgmt_info.get_reset_param(user_type)
self.assertEqual(self.__mapped_file_dir +
'/zone-IN-0-sqlite3-mapped.' + str(expected_ver),
param['mapped-file'])
@@ -124,7 +123,7 @@ class TestDataSrcInfo(unittest.TestCase):
# Check if the initial state of (mapped) segment info object has
# expected values.
self.assertIsNone(sgmt_info.get_reset_param(SegmentInfo.READER))
- param = json.loads(sgmt_info.get_reset_param(SegmentInfo.WRITER))
+ param = sgmt_info.get_reset_param(SegmentInfo.WRITER)
self.assertEqual(writer_file, param['mapped-file'])
def test_init(self):
More information about the bind10-changes
mailing list