[Zodb-checkins] CVS: Zope2/lib/python/ZODB - BaseStorage.py:1.14
barry@digicool.com
barry@digicool.com
Fri, 13 Apr 2001 15:13:51 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/ZODB
In directory korak:/tmp/cvs-serv15608
Modified Files:
BaseStorage.py
Log Message:
Added tpc_vote() infrastructure along the lines of tpc_begin() and
tpc_finish(); i.e. it acquires the lock, checks the argument, and then
calls self._vote(). Note that the transaction passed to tpc_vote()
isn't passed to self._vote(), since I don't what would be useful.
BaseStorage._vote(): current no-op.
--- Updated File BaseStorage.py in package Zope2/lib/python/ZODB --
--- BaseStorage.py 2001/04/12 19:50:16 1.13
+++ BaseStorage.py 2001/04/13 19:13:51 1.14
@@ -167,7 +167,7 @@
finally: self._lock_release()
def _abort(self):
- """Subclasses should rededine this to supply abort actions"""
+ """Subclasses should redefine this to supply abort actions"""
pass
def tpc_begin(self, transaction, tid=None, status=' '):
@@ -203,11 +203,22 @@
finally: self._lock_release()
def _begin(self, tid, u, d, e):
- """Subclasses should rededine this to supply
- transaction start actions"""
+ """Subclasses should redefine this to supply transaction start actions.
+ """
pass
- def tpc_vote(self, transaction): pass
+ def tpc_vote(self, transaction):
+ self._lock_acquire()
+ try:
+ if transaction is not self._transaction: return
+ self._vote()
+ finally:
+ self._lock_release()
+
+ def _vote(self):
+ """Subclasses should redefine this to supply transaction vote actions.
+ """
+ pass
def tpc_finish(self, transaction, f=None):
self._lock_acquire()
@@ -227,7 +238,8 @@
self._lock_release()
def _finish(self, tid, u, d, e):
- """Subclasses should rededine this to supply commit actions"""
+ """Subclasses should redefine this to supply transaction finish actions
+ """
pass
def undo(self, transaction_id):