Browse Source

[2225_statistics] make Counter class hidden(rename Counter to _Counter), add Counter class, and move empty methods in it.

Naoki Kambe 12 years ago
parent
commit
57e46e4378
1 changed files with 11 additions and 10 deletions
  1. 11 10
      src/lib/python/isc/statistics/counter.py

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

@@ -84,7 +84,7 @@ def init(spec_file_name):
     module_spec = isc.config.module_spec_from_file(spec_file_name)
     class_name = '%sCounter' % module_spec.get_module_name()
     global _COUNTER
-    if issubclass(_COUNTER.__class__, Counter):
+    if issubclass(_COUNTER.__class__, _Counter):
         # already loaded
         return _COUNTER
     # create an instance once
@@ -93,15 +93,6 @@ def init(spec_file_name):
     globals().update(_COUNTER._to_global)
     return _COUNTER
 
-# These method are dummies for notify_out in case XfroutCounter is not
-# loaded.
-def inc_notifyoutv4(self, arg):
-    """An empty method to be disclosed"""
-    pass
-def inc_notifyoutv6(self, arg):
-    """An empty method to be disclosed"""
-    pass
-
 # static internal functions
 def _add_counter(element, spec, identifier):
     """Returns value of the identifier if the identifier is in the
@@ -169,6 +160,16 @@ def _stop_timer(start_time, element, spec, identifier):
     _set_counter(element, spec, identifier, sec)
 
 class Counter():
+    # These method are dummies for notify_out in case XfroutCounter is not
+    # loaded.
+    def inc_notifyoutv4(arg):
+        """An empty method to be disclosed"""
+        pass
+    def inc_notifyoutv6(arg):
+        """An empty method to be disclosed"""
+        pass
+
+class _Counter():
     """A basic counter class for concrete classes"""
 
     # '_SERVER_' is a special zone name representing an entire