Commit af5253bd authored by Vincent Pelletier's avatar Vincent Pelletier

Implement getTID and checkCurrentSerialInTransaction.

git-svn-id: 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f6232c8c
......@@ -194,3 +194,9 @@ class Storage(BaseStorage.BaseStorage,
def close(self):
def getTID(self, oid):
def checkCurrentSerialInTransaction(self, oid, serial, transaction):, serial, transaction)
......@@ -24,6 +24,7 @@ import time
import os
from ZODB.POSException import UndoError, StorageTransactionError, ConflictError
from ZODB.POSException import ReadConflictError
from ZODB.ConflictResolution import ResolvedSerial
from persistent.TimeStamp import TimeStamp
......@@ -1260,3 +1261,13 @@ class Application(object):
raise NEOStorageError('Invalid pack time')
def getLastTID(self, oid):
return self._load(oid)[1]
def checkCurrentSerialInTransaction(self, oid, serial, transaction):
if transaction is not self.local_var.txn:
raise StorageTransactionError(self, transaction)
committed_tid = self.getLastTID(oid)
if committed_tid != serial:
raise ReadConflictError(oid=oid, serials=(committed_tid, serial))
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