SVN: ZODB/trunk/src/ZEO/ Added the client side of server_status.

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100504152436.22A307083BC__8303.46499938077$1272986683$gmane$org@cvs.zope.org>
Log message for revision 111928:
  Added the client side of server_status.
  

Changed:
  U   ZODB/trunk/src/ZEO/ClientStorage.py
  U   ZODB/trunk/src/ZEO/ServerStub.py
  U   ZODB/trunk/src/ZEO/tests/testZEO.py

-=-
Modified: ZODB/trunk/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/trunk/src/ZEO/ClientStorage.py	2010-05-04 15:24:33 UTC (rev 111927)
+++ ZODB/trunk/src/ZEO/ClientStorage.py	2010-05-04 15:24:35 UTC (rev 111928)
@@ -1504,7 +1504,10 @@
                 return self._iterator_gc(True)
             self._iterator_ids -= iids
 
+    def server_status(self):
+        return self._server.server_status()
 
+
 class TransactionIterator(object):
 
     def __init__(self, storage, iid, *args):

Modified: ZODB/trunk/src/ZEO/ServerStub.py
===================================================================
--- ZODB/trunk/src/ZEO/ServerStub.py	2010-05-04 15:24:33 UTC (rev 111927)
+++ ZODB/trunk/src/ZEO/ServerStub.py	2010-05-04 15:24:35 UTC (rev 111928)
@@ -296,6 +296,9 @@
     def iterator_gc(self, iids):
         return self.rpc.callAsync('iterator_gc', iids)
 
+    def server_status(self):
+        return self.rpc.call("server_status")
+
 class StorageServer308(StorageServer):
 
     def __init__(self, rpc):

Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py	2010-05-04 15:24:33 UTC (rev 111927)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py	2010-05-04 15:24:35 UTC (rev 111928)
@@ -25,10 +25,13 @@
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import zodb_unpickle
 
+from zope.testing import renormalizing
+
 import doctest
 import logging
 import os
 import persistent
+import re
 import shutil
 import signal
 import stat
@@ -1267,7 +1270,31 @@
     >>> client.close()
     """
 
+def test_server_status():
+    """
+    You can get server status using the server_status method.
 
+    >>> addr, _ = start_server()
+    >>> db = ZEO.DB(addr)
+    >>> import pprint
+    >>> pprint.pprint(db.storage.server_status(), width=1)
+    {'aborts': 0,
+     'active_txns': 0,
+     'commits': 1,
+     'conflicts': 0,
+     'conflicts_resolved': 0,
+     'connections': 1,
+     'loads': 1,
+     'lock_time': None,
+     'start': 'Tue May  4 10:55:20 2010',
+     'stores': 1,
+     'verifying_clients': 0,
+     'waiting': 0}
+
+    >>> db.close()
+    """
+
+
 if sys.version_info >= (2, 6):
     import multiprocessing
 
@@ -1383,7 +1410,11 @@
     zeo = unittest.TestSuite()
     zeo.addTest(unittest.makeSuite(ZODB.tests.util.AAAA_Test_Runner_Hack))
     zeo.addTest(doctest.DocTestSuite(
-        setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown))
+        setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown,
+        checker=renormalizing.RENormalizing([
+            (re.compile(r"'start': '[^\n]+'"), 'start'),
+            ]),
+        ))
     zeo.addTest(doctest.DocTestSuite(ZEO.tests.IterationTests,
         setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown))
     zeo.addTest(doctest.DocFileSuite('registerDB.test'))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.