[Zodb-checkins] CVS: ZODB3/ZODB - FileStorage.py:1.113

Jeremy Hylton jeremy@zope.com
Tue, 5 Nov 2002 16:37:58 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv11901

Modified Files:
	FileStorage.py 
Log Message:
Remove support for undo (of the non-transactional variety).


=== ZODB3/ZODB/FileStorage.py 1.112 => 1.113 ===
--- ZODB3/ZODB/FileStorage.py:1.112	Tue Nov  5 16:19:32 2002
+++ ZODB3/ZODB/FileStorage.py	Tue Nov  5 16:37:57 2002
@@ -862,9 +862,6 @@
         finally:
             self._lock_release()
 
-    def supportsUndo(self):
-        return 1
-
     def supportsVersions(self):
         return 1
 
@@ -957,56 +954,6 @@
         if self._nextpos:
             self._file.truncate(self._pos)
             self._nextpos=0
-
-    def undo(self, transaction_id):
-        if self._is_read_only:
-            raise POSException.ReadOnlyError()
-        self._lock_acquire()
-        try:
-            self._clear_index()
-            transaction_id=base64.decodestring(transaction_id + '\n')
-            tid, tpos = transaction_id[:8], U64(transaction_id[8:])
-            packt=self._packt
-            if packt is None or packt > tid:
-                raise UndoError, (
-                    'Undo is currently disabled for database maintenance.<p>')
-
-            file=self._file
-            seek=file.seek
-            read=file.read
-            index_get=self._index_get
-            unpack=struct.unpack
-            seek(tpos)
-            h=read(TRANS_HDR_LEN)
-            if len(h) != TRANS_HDR_LEN or h[:8] != tid:
-                raise UndoError('Invalid undo transaction id')
-            if h[16] == 'u': return
-            if h[16] != ' ': raise UndoError
-            tl=U64(h[8:16])
-            ul,dl,el=unpack(">HHH", h[17:TRANS_HDR_LEN])
-            tend=tpos+tl
-            pos=tpos+(TRANS_HDR_LEN+ul+dl+el)
-            t={}
-            while pos < tend:
-                # Read the data records for this transaction
-                seek(pos)
-                h=read(DATA_HDR_LEN)
-                oid,serial,sprev,stloc,vlen,splen = unpack(DATA_HDR, h)
-                plen=U64(splen)
-                prev=U64(sprev)
-                dlen=DATA_HDR_LEN+(plen or 8)
-                if vlen: dlen=dlen+(16+vlen)
-                if index_get(oid, 0) != pos: raise UndoError
-                pos=pos+dlen
-                if pos > tend: raise UndoError
-                t[oid]=prev
-
-            seek(tpos+16)
-            file.write('u')
-            file.flush()
-            self._index.update(t)
-            return t.keys()
-        finally: self._lock_release()
 
     def supportsTransactionalUndo(self):
         return 1