[Zope-Checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.73.2.3
Jeremy Hylton
jeremy@zope.com
Fri, 4 Oct 2002 15:49:46 -0400
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv4787/ZEO
Modified Files:
Tag: ZODB3-3_1-branch
ClientStorage.py
Log Message:
Backport from trunk: Added subclassing hooks to ClientStorage and StorageServer
=== ZODB3/ZEO/ClientStorage.py 1.73.2.2 => 1.73.2.3 ===
--- ZODB3/ZEO/ClientStorage.py:1.73.2.2 Thu Oct 3 20:09:05 2002
+++ ZODB3/ZEO/ClientStorage.py Fri Oct 4 15:49:46 2002
@@ -100,6 +100,13 @@
tpc_begin().
"""
+ # Classes we instantiate. A subclass might override.
+
+ TransactionBufferClass = TransactionBuffer
+ ClientCacheClass = ClientCache.ClientCache
+ ConnectionManagerClass = ConnectionManager
+ StorageServerStubClass = ServerStub.StorageServer
+
def __init__(self, addr, storage='1', cache_size=20 * MB,
name='', client=None, debug=0, var=None,
min_disconnect_poll=5, max_disconnect_poll=300,
@@ -204,7 +211,7 @@
'supportsUndo':0, 'supportsVersions': 0,
'supportsTransactionalUndo': 0}
- self._tbuf = TransactionBuffer()
+ self._tbuf = self.TransactionBufferClass()
self._db = None
# _serials: stores (oid, serialno) as returned by server
@@ -237,12 +244,12 @@
# Decide whether to use non-temporary files
client = client or os.environ.get('ZEO_CLIENT')
- self._cache = ClientCache.ClientCache(storage, cache_size,
- client=client, var=var)
+ self._cache = self.ClientCacheClass(storage, cache_size,
+ client=client, var=var)
- self._rpc_mgr = ConnectionManager(addr, self,
- tmin=min_disconnect_poll,
- tmax=max_disconnect_poll)
+ self._rpc_mgr = self.ConnectionManagerClass(addr, self,
+ tmin=min_disconnect_poll,
+ tmax=max_disconnect_poll)
if wait:
self._rpc_mgr.connect(sync=1)
@@ -313,7 +320,7 @@
"""
log2(INFO, "Testing connection %r" % conn)
# XXX Check the protocol version here?
- stub = ServerStub.StorageServer(conn)
+ stub = self.StorageServerStubClass(conn)
try:
stub.register(str(self._storage), self._is_read_only)
return 1
@@ -334,7 +341,7 @@
log2(INFO, "Reconnected to storage")
else:
log2(INFO, "Connected to storage")
- stub = ServerStub.StorageServer(conn)
+ stub = self.StorageServerStubClass(conn)
self._oids = []
self._info.update(stub.get_info())
self.verify_cache(stub)