[Zodb-checkins] CVS: Packages/ZEO - StorageServer.py:1.21.4.8
jeremy@digicool.com
jeremy@digicool.com
Wed, 25 Apr 2001 18:33:51 -0400 (EDT)
Update of /cvs-repository/Packages/ZEO
In directory korak:/tmp/cvs-serv4553
Modified Files:
Tag: ZEO-ZRPC-Dev
StorageServer.py
Log Message:
Reorganize handling of transaction metadata
Create a Transaction object immediately when tpc_begin() is called and
populate it with the tpc_begin() arguments. Note that the extension
should be stored as _extension, not ext!
Place the Transaction object in the store's __waiting queue and use it
when the transaction is finally started.
Don't do anything with the arguments to tpc_finish(). They should
match tpc_begin().
Move _restart_delayed_transaction() to a better location.
--- Updated File StorageServer.py in package Packages/ZEO --
--- StorageServer.py 2001/04/25 20:43:52 1.21.4.7
+++ StorageServer.py 2001/04/25 22:33:50 1.21.4.8
@@ -213,16 +213,6 @@
return 0
return 1
- def _restart_delayed_transaction(self, delay, tinfo):
- self._transaction = t = Transaction()
- t.id = tinfo[0]
- t.user = tinfo[1]
- t.description = tinfo[2]
- self.__storage.tpc_begin(t)
- self.__invalidated = []
- assert self._transaction.id == self.__storage._transaction.id
- delay.reply(None)
-
def register(self, storage_id):
"""Select the storage that this client will use
@@ -396,15 +386,19 @@
else:
raise StorageTransactionError("Multiple simultaneous tpc_begin"
" requests from one client.")
- if self.__storage._transaction is not None:
- d = zrpc2.Delay()
- self.__storage.__waiting.append((d, self, (id, user, description)))
- return d
- self._transaction = t = Transaction()
+ t = Transaction()
t.id = id
t.user = user
t.description = description
+ t._extension = ext
+
+ if self.__storage._transaction is not None:
+ d = zrpc2.Delay()
+ self.__storage.__waiting.append((d, self, t))
+ return d
+
+ self._transaction = t
self.__storage.tpc_begin(t)
self.__invalidated = []
@@ -412,12 +406,6 @@
if not self._check_tid(id):
return
- # XXX Why do we do this for the begin and the end?
- t = self._transaction
- t.user = user
- t.description = description
- t.ext = ext
-
r = self.__storage.tpc_finish(self._transaction)
assert self.__storage._transaction is None
@@ -426,7 +414,7 @@
self.__invalidated,
self.get_size_info())
- if not self.handle_waiting():
+ if not self._handle_waiting():
self._transaction = None
self.__invalidated = []
assert self._transaction is None
@@ -437,15 +425,22 @@
r = self.__storage.tpc_abort(self._transaction)
assert self.__storage._transaction is None
- if not self.handle_waiting():
+ if not self._handle_waiting():
self._transaction = None
self.__invalidated = []
assert self._transaction is None
+
+ def _restart_delayed_transaction(self, delay, trans):
+ self._transaction = trans
+ self.__storage.tpc_begin(trans)
+ self.__invalidated = []
+ assert self._transaction.id == self.__storage._transaction.id
+ delay.reply(None)
- def handle_waiting(self):
+ def _handle_waiting(self):
if self.__storage.__waiting:
- d, proxy, tinfo = self.__storage.__waiting.pop(0)
- proxy._restart_delayed_transaction(d, tinfo)
+ delay, proxy, trans = self.__storage.__waiting.pop(0)
+ proxy._restart_delayed_transaction(delay, trans)
if self is proxy:
return 1