[Zope-Checkins] CVS: ZODB3/ZODB/FileStorage - FileStorage.py:1.1.2.9
Jeremy Hylton
cvs-admin at zope.org
Wed Nov 12 15:26:42 EST 2003
Update of /cvs-repository/ZODB3/ZODB/FileStorage
In directory cvs.zope.org:/tmp/cvs-serv31269/ZODB/FileStorage
Modified Files:
Tag: ZODB3-mvcc-2-branch
FileStorage.py
Log Message:
Working implementation of loadNonCurrent() for FileStorage.
Add two new tests of loadNonCurrent().
=== ZODB3/ZODB/FileStorage/FileStorage.py 1.1.2.8 => 1.1.2.9 ===
--- ZODB3/ZODB/FileStorage/FileStorage.py:1.1.2.8 Wed Nov 12 12:26:20 2003
+++ ZODB3/ZODB/FileStorage/FileStorage.py Wed Nov 12 15:26:41 2003
@@ -586,12 +586,37 @@
if h.plen:
return self._file.read(h.plen)
else:
+ # XXX Must be self._loadBack...
return _loadBack(self._file, oid, h.back)[0]
finally:
self._lock_release()
-## def loadNonCurrent(self, oid, tid):
-## pass
+ def loadNonCurrent(self, oid, tid):
+ pos = self._lookup_pos(oid)
+ end_tid = None
+ while True:
+ h = self._read_data_header(pos, oid)
+ if h.serial < tid and not h.version:
+ break
+ pos = h.prev
+ th = self._read_txn_header(h.tloc)
+ end_tid = th.tid
+ if not pos:
+ return None
+ if h.back:
+ # _loadBackTxn() will return the serialno and tid of
+ # the txn pointed to, which is wrong.
+
+ th = self._read_txn_header(h.tloc)
+ data = self._loadBack_impl(oid, h.back)[0]
+ return data, h.serial, th.tid, end_tid
+ else:
+ # If the transaction wrote new data, then it must have been
+ # written by a regular store() and its tid will be the same
+ # as its serialno.
+
+ # XXX Or does restore() complicate this argument?
+ return self._file.read(h.plen), h.serial, h.serial, end_tid
def modifiedInVersion(self, oid):
self._lock_acquire()
More information about the Zope-Checkins
mailing list