Commit f6232c8c authored by Vincent Pelletier's avatar Vincent Pelletier

Drop support for getSerial, it's not present in recent ZODB API.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2492 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8bc2699c
......@@ -91,12 +91,6 @@ class Storage(BaseStorage.BaseStorage,
self.app.store(oid=oid, serial=serial, data='', version=None,
transaction=transaction)
def getSerial(self, oid):
try:
return self.app.getSerial(oid = oid)
except NEOStorageNotFoundError:
raise POSException.POSKeyError(oid)
# mutliple revisions
def loadSerial(self, oid, serial):
try:
......
......@@ -436,28 +436,6 @@ class Application(object):
# return the last OID used, this is innacurate
return int(u64(self.last_oid))
@profiler_decorator
def getSerial(self, oid):
# Try in cache first
self._cache_lock_acquire()
try:
try:
result = self.mq_cache[oid]
except KeyError:
pass
else:
return result[0]
finally:
self._cache_lock_release()
# history return serial, so use it
hist = self.history(oid, size=1, object_only=1)
if len(hist) == 0:
raise NEOStorageNotFoundError()
if hist[0] != oid:
raise NEOStorageError('getSerial failed')
return hist[1][0][0]
@profiler_decorator
def _load(self, oid, serial=None, tid=None, cache=0):
"""
......@@ -1112,7 +1090,7 @@ class Application(object):
def transactionLog(self, first, last):
return self.__undoLog(first, last, with_oids=True)
def history(self, oid, version=None, size=1, filter=None, object_only=0):
def history(self, oid, version=None, size=1, filter=None):
# Get history informations for object first
cell_list = self._getCellListForOID(oid, readable=True)
shuffle(cell_list)
......@@ -1145,10 +1123,6 @@ class Application(object):
# XXX: this may requires an error from the storages
raise KeyError
if object_only:
# Use by getSerial
return self.local_var.history
# Now that we have object informations, get txn informations
history_list = []
for serial, size in self.local_var.history[1]:
......
......@@ -199,32 +199,6 @@ class ClientApplicationTests(NeoUnitTestBase):
self.assertTrue(app.new_oid_list[0] in test_oid_list)
self.assertNotEqual(app.new_oid_list[0], new_oid)
def test_getSerial(self):
app = self.getApp()
mq = app.mq_cache
oid = self.makeOID()
tid = self.makeTID()
# cache cleared
self.assertTrue(oid not in mq)
app.pt = Mock({ 'getCellListForOID': [], })
app.local_var.history = (oid, [(tid, 0)])
# If object len is 0, this object doesn't exist anymore because its
# creation has been undone.
self.assertRaises(KeyError, app.getSerial, oid)
self.assertEquals(len(app.pt.mockGetNamedCalls('getCellListForOID')), 1)
# Otherwise, result from ZODB
app.pt = Mock({ 'getCellListForOID': [], })
app.local_var.history = (oid, [(tid, 1)])
self.assertEquals(app.getSerial(oid), tid)
self.assertEquals(len(app.pt.mockGetNamedCalls('getCellListForOID')), 1)
# fill the cache -> hit
mq.store(oid, (tid, ' '))
self.assertTrue(oid in mq)
app.pt = Mock({ 'getCellListForOID': [], })
app.getSerial(oid)
self.assertEquals(app.getSerial(oid), tid)
self.assertEquals(len(app.pt.mockGetNamedCalls('getCellListForOID')), 0)
def test_load(self):
app = self.getApp()
app.local_var.barrier_done = True
......
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