Commit 7ceb5bd6 authored by Jim Fulton's avatar Jim Fulton

Changed to work with base storages that don't support versions.

Removed unneeded loadEx.

Added missing close method.
parent 1f21bc9c
......@@ -117,7 +117,13 @@ class DemoStorage(BaseStorage):
self._quota = quota
self._ltid = None
self._clear_temp()
if base is not None and base.versions():
try:
versions = base.versions
except AttributeError:
pass
else:
if base.versions():
raise POSException.StorageError(
"Demo base storage has version data")
......@@ -212,37 +218,32 @@ class DemoStorage(BaseStorage):
finally:
self._lock_release()
def loadEx(self, oid, version):
def load(self, oid, version):
self._lock_acquire()
try:
try:
oid, pre, vdata, p, tid = self._index[oid]
except KeyError:
if self._base:
return self._base.loadEx(oid, version)
return self._base.load(oid, version)
raise KeyError(oid)
ver = ""
if vdata:
oversion, nv = vdata
if oversion != version:
if nv:
# Return the current txn's tid with the non-version
# data.
oid, pre, vdata, p, skiptid = nv
p = nv[3]
else:
raise KeyError(oid)
ver = oversion
if p is None:
raise KeyError(oid)
return p, tid, ver
return p, tid
finally: self._lock_release()
def load(self, oid, version):
return self.loadEx(oid, version)[:2]
def modifiedInVersion(self, oid):
self._lock_acquire()
try:
......@@ -564,3 +565,7 @@ class DemoStorage(BaseStorage):
def cleanup(self):
if self._base is not None:
self._base.cleanup()
def close(self):
if self._base is not None:
self._base.close()
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