]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2225_statistics] add helpful comments to the complicated expression
authorNaoki Kambe <kambe@jprs.co.jp>
Fri, 14 Dec 2012 09:29:02 +0000 (18:29 +0900)
committerNaoki Kambe <kambe@jprs.co.jp>
Tue, 8 Jan 2013 04:36:15 +0000 (13:36 +0900)
Also rsplit() is used instead of split() to be simplified.

It's due to the review comment.

src/lib/python/isc/statistics/counter.py

index 2ba4b364726abbad53c29791bd9d863ff2c87218..a0eb67746b365b5f2491af7a7fa4dbfb8c385e37 100644 (file)
@@ -344,11 +344,19 @@ class Counters():
                 self._statistics._data,
                 self._statistics._spec,
                 identifier)
-            # delete the started timer
-            del isc.cc.data.find(
-                self._start_time,
-                _concat(*identifier.split('/')[0:-1]))\
-                [identifier.split('/')[-1]]
+            # A datetime value of once used timer should be deleted
+            # for a future use.
+            # Here, names of branch and leaf are obtained from a
+            # string of identifier. The branch name is equivalent to
+            # the position of datetime to be deleted and the leaf name
+            # is equivalent to the value of datetime to be deleted.
+            (branch, leaf) = identifier.rsplit('/', 1)
+            # Then map of branch is obtained from self._start_time by
+            # using isc.cc.data.find().
+            branch_map = isc.cc.data.find(self._start_time, branch)
+            # Finally a value of the leaf name is deleted from the
+            # map.
+            del branch_map[leaf]
 
     def dump_statistics(self):
         """Calculates an entire server counts, and returns statistics