Commit 35692cec authored by Jim Fulton's avatar Jim Fulton

Added the client side of server_status.

parent c34be685
...@@ -1504,6 +1504,9 @@ class ClientStorage(object): ...@@ -1504,6 +1504,9 @@ class ClientStorage(object):
return self._iterator_gc(True) return self._iterator_gc(True)
self._iterator_ids -= iids self._iterator_ids -= iids
def server_status(self):
return self._server.server_status()
class TransactionIterator(object): class TransactionIterator(object):
......
...@@ -296,6 +296,9 @@ class StorageServer: ...@@ -296,6 +296,9 @@ class StorageServer:
def iterator_gc(self, iids): def iterator_gc(self, iids):
return self.rpc.callAsync('iterator_gc', iids) return self.rpc.callAsync('iterator_gc', iids)
def server_status(self):
return self.rpc.call("server_status")
class StorageServer308(StorageServer): class StorageServer308(StorageServer):
def __init__(self, rpc): def __init__(self, rpc):
......
...@@ -25,10 +25,13 @@ from ZODB.tests import StorageTestBase, BasicStorage, \ ...@@ -25,10 +25,13 @@ from ZODB.tests import StorageTestBase, BasicStorage, \
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle from ZODB.tests.StorageTestBase import zodb_unpickle
from zope.testing import renormalizing
import doctest import doctest
import logging import logging
import os import os
import persistent import persistent
import re
import shutil import shutil
import signal import signal
import stat import stat
...@@ -1267,6 +1270,30 @@ def convenient_to_pass_port_to_client_and_ZEO_dot_client(): ...@@ -1267,6 +1270,30 @@ def convenient_to_pass_port_to_client_and_ZEO_dot_client():
>>> client.close() >>> 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): if sys.version_info >= (2, 6):
import multiprocessing import multiprocessing
...@@ -1383,7 +1410,11 @@ def test_suite(): ...@@ -1383,7 +1410,11 @@ def test_suite():
zeo = unittest.TestSuite() zeo = unittest.TestSuite()
zeo.addTest(unittest.makeSuite(ZODB.tests.util.AAAA_Test_Runner_Hack)) zeo.addTest(unittest.makeSuite(ZODB.tests.util.AAAA_Test_Runner_Hack))
zeo.addTest(doctest.DocTestSuite( 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, zeo.addTest(doctest.DocTestSuite(ZEO.tests.IterationTests,
setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown)) setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown))
zeo.addTest(doctest.DocFileSuite('registerDB.test')) zeo.addTest(doctest.DocFileSuite('registerDB.test'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment