Commit c91b10a4 authored by Jim Fulton's avatar Jim Fulton

Added optional extra argument to tpc_begin. This allows

a transaction id to be spacified, rather than being defined
by the storage. This should *only* be used when copying data
from one type of storage to another.
parent 522ed337
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Handy standard storage machinery """Handy standard storage machinery
""" """
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
import time, bpthread, UndoLogCompatible import time, bpthread, UndoLogCompatible
from POSException import UndoError from POSException import UndoError
...@@ -158,7 +158,7 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -158,7 +158,7 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
self._commit_lock_release() self._commit_lock_release()
finally: self._lock_release() finally: self._lock_release()
def tpc_begin(self, transaction): def tpc_begin(self, transaction, tid=None):
self._lock_acquire() self._lock_acquire()
try: try:
if self._transaction is transaction: return if self._transaction is transaction: return
...@@ -175,10 +175,14 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -175,10 +175,14 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
else: ext="" else: ext=""
self._ude=user, desc, ext self._ude=user, desc, ext
t=time.time() if tid is None:
t=apply(TimeStamp,(time.gmtime(t)[:5]+(t%60,))) t=time.time()
self._ts=t=t.laterThan(self._ts) t=apply(TimeStamp,(time.gmtime(t)[:5]+(t%60,)))
self._serial=`t` self._ts=t=t.laterThan(self._ts)
self._serial=`t`
else:
self._ts=TimeStamp(tid)
self._serial=tid
self._begin(self._serial, user, desc, ext) self._begin(self._serial, user, desc, ext)
......
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