Commit ce3b938b authored by Jim Fulton's avatar Jim Fulton

Addes _abort hook and added doc strings for hooks _begin, _finish, and

_abort.
parent ef219a03
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Handy standard storage machinery """Handy standard storage machinery
""" """
__version__='$Revision: 1.9 $'[11:-2] __version__='$Revision: 1.10 $'[11:-2]
import time, bpthread, UndoLogCompatible import time, bpthread, UndoLogCompatible
from POSException import UndoError from POSException import UndoError
...@@ -154,11 +154,16 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -154,11 +154,16 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
self._lock_acquire() self._lock_acquire()
try: try:
if transaction is not self._transaction: return if transaction is not self._transaction: return
self._abort()
self._clear_temp() self._clear_temp()
self._transaction=None self._transaction=None
self._commit_lock_release() self._commit_lock_release()
finally: self._lock_release() finally: self._lock_release()
def _abort(self):
"""Subclasses should rededine this to supply abort actions"""
pass
def tpc_begin(self, transaction, tid=None, status=' '): def tpc_begin(self, transaction, tid=None, status=' '):
self._lock_acquire() self._lock_acquire()
try: try:
...@@ -192,6 +197,8 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -192,6 +197,8 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
finally: self._lock_release() finally: self._lock_release()
def _begin(self, tid, u, d, e): def _begin(self, tid, u, d, e):
"""Subclasses should rededine this to supply
transaction start actions"""
pass pass
def tpc_vote(self, transaction): pass def tpc_vote(self, transaction): pass
...@@ -212,6 +219,7 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -212,6 +219,7 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
self._lock_release() self._lock_release()
def _finish(self, tid, u, d, e): def _finish(self, tid, u, d, e):
"""Subclasses should rededine this to supply commit actions"""
pass pass
def undo(self, transaction_id): def undo(self, transaction_id):
......
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