Browse Source

[2225_statistics] add step as kwarg into inc() and use it in dec() with step=-1

Due to the review comment.
Naoki Kambe 12 years ago
parent
commit
48974a8f83
1 changed files with 3 additions and 10 deletions
  1. 3 10
      src/lib/python/isc/statistics/counter.py

+ 3 - 10
src/lib/python/isc/statistics/counter.py

@@ -290,33 +290,26 @@ class Counters():
         with self._rlock:
             self._disabled = False
 
-    def inc(self, *args):
+    def inc(self, *args, step=1):
         """A incrementer for per-zone counter. Locks the thread
         because it is considered to be invoked by a multi-threading
         caller. isc.cc.data.DataNotFoundError is raised when
         incrementing the counter of the item undefined in the spec
         file."""
         identifier = _concat(*args)
-        step = 1
         with self._rlock:
             if self._disabled: return
             _inc_counter(self._statistics._data,
                          self._statistics._spec,
                          identifier, step)
 
-    def dec(self, *args):
+    def dec(self, *args, step=-1):
         """A decrementer for axfr or ixfr running. Locks the thread
         because it is considered to be invoked by a multi-threading
         caller. isc.cc.data.DataNotFoundError is raised when
         decrementing the counter of the item undefined in the spec
         file."""
-        identifier = _concat(*args)
-        step = -1
-        with self._rlock:
-            if self._disabled: return
-            _inc_counter(self._statistics._data,
-                         self._statistics._spec,
-                         identifier, step)
+        self.inc(*args, step=step)
 
     def get(self, *args):
         """A getter method for counters. It returns the current number