[Zodb-checkins] CVS: Packages/ZEO - ClientStorage.py:1.26.4.4
jeremy@digicool.com
jeremy@digicool.com
Thu, 29 Mar 2001 23:47:00 -0500 (EST)
Update of /cvs-repository/Packages/ZEO
In directory korak:/tmp/cvs-serv22381
Modified Files:
Tag: ZEO-ZRPC-Dev
ClientStorage.py
Log Message:
In ClientStorage constructor, make an explicit attempt_connect() call
on the ConnectionManager. Otherwise, a script starting a fresh
ClientStorage will usually get a Disconnected exception before the
connection is established.
Add methods defined on ClientProxy() that were removed in haste by the
previous checkin.
Remove unneeded imports (ThreadedAsync, Invalidator).
--- Updated File ClientStorage.py in package Packages/ZEO --
--- ClientStorage.py 2001/03/29 21:36:23 1.26.4.3
+++ ClientStorage.py 2001/03/30 04:46:59 1.26.4.4
@@ -87,8 +87,7 @@
__version__='$Revision$'[11:-2]
import struct, time, os, socket, string, Sync, ClientCache
-import tempfile, Invalidator, ExtensionClass, thread
-import ThreadedAsync
+import tempfile, ExtensionClass, thread
import zrpc2
import ServerStub
@@ -151,7 +150,8 @@
tmin=min_disconnect_poll,
tmax=max_disconnect_poll)
# XXX make this method call the default CnMgr behavior
- self._rpc_mgr.connect(callback=self.notifyConnected)
+ if not self._rpc_mgr.attempt_connect(callback=self.notifyConnected):
+ self._rpc_mgr.connect(callback=self.notifyConnected)
def registerDB(self, db, limit):
"""Register that the storage is controlled by the given DB.
@@ -515,26 +515,38 @@
finally:
self._lock_release()
+ # below are methods invoked by the StorageServer
+
+ def unlock(self):
+ self.commit_lock_release()
+
+ def serialno(self, arg):
+ self._serials.append(arg)
+
+ def info(self, dict):
+ self._info.update(dict)
+
def begin(self):
- self._tfile=tempfile.TemporaryFile()
- pickler=cPickle.Pickler(self._tfile, 1)
- pickler.fast=1 # Don't use the memo
- self._d=pickler.dump
+ self._tfile = tempfile.TemporaryFile()
+ self._pickler = cPickle.Pickler(self._tfile, 1)
+ self._pickler.fast = 1 # Don't use the memo
def invalidate(self, args):
- if self._d is None: return
- self._d(args)
+ if self._pickler is None:
+ return
+ self._pickler.dump(args)
def end(self):
- if self._d is None: return
- self._d((0,0))
- self._d=None
+ if self._pickler is None:
+ return
+ self._pickler.dump((0,0))
+ self._pickler.dump=None
self._tfile.seek(0)
load=cPickle.Unpickler(self._tfile).load
self._tfile=None
cinvalidate=self._cache.invalidate
- dinvalidate=self._db.invalidate
+ dinvalidate=self._pickler.dumpb.invalidate
while 1:
oid, version = load()
@@ -544,7 +556,7 @@
def Invalidate(self, args):
cinvalidate=self._cache.invalidate
- dinvalidate=self._db.invalidate
+ dinvalidate=self._pickler.dumpb.invalidate
for oid, version in args:
cinvalidate(oid, version=version)
dinvalidate(oid, version=version)