List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 20 2007 1:25am
Subject:Rev 267: Added callback based handler test to python code. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 267
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Mon 2007-11-19 17:25:10 -0800
message:
  Added callback based handler test to python code.
modified:
  python/testmgm.py              testmgm.py-20071120010244-xrr0eny7i350ornu-1
=== modified file 'python/testmgm.py'
--- a/python/testmgm.py	2007-11-20 01:08:15 +0000
+++ b/python/testmgm.py	2007-11-20 01:25:10 +0000
@@ -9,6 +9,20 @@
 theList.push_back(theItem)
 manager=mgm.createNdbLogEventManager(theList) 
 
+class TransReportListener(mgmapi.NdbLogEventTypeListener):
+
+    def getEventType(self):
+        return mgmapi.NDB_LE_TransReportCounters
+    def handleEvent(self, event):
+        theEvent = mgmapi.TransReportCountersEvent(event)
+        print "Handler Trans count: ",theEvent.transCount
+        print "Handler Read count: ", theEvent.readCount
+        print "Handler Scan count: ", theEvent.scanCount
+        print "Handler Range count: ", theEvent.rangeScanCount
+
+theListener=TransReportListener()
+manager.registerListener(theListener)
+
 while(True): 
     event = manager.getLogEvent(5000)
     if event is not None: 

Thread
Rev 267: Added callback based handler test to python code. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor20 Nov