[Zodb-checkins] CVS: ZODB4/ZODB - fsdump.py:1.9.6.1

Jeremy Hylton jeremy@zope.com
Tue, 10 Dec 2002 18:56:07 -0500


Update of /cvs-repository/ZODB4/ZODB
In directory cvs.zope.org:/tmp/cvs-serv8785/ZODB

Modified Files:
      Tag: ZODB4-Q-branch
	fsdump.py 
Log Message:
Convert fsdump to work with Q fmt codes


=== ZODB4/ZODB/fsdump.py 1.9 => 1.9.6.1 ===
--- ZODB4/ZODB/fsdump.py:1.9	Tue Dec  3 18:37:08 2002
+++ ZODB4/ZODB/fsdump.py	Tue Dec 10 18:56:06 2002
@@ -21,6 +21,9 @@
     # Return a nicely formatted string for a packaged 64-bit value
     return "%016x" % u64(p64)
 
+def dump(path, dest=None):
+    Dumper(path, dest).dump()
+
 class Dumper:
     """A very verbose dumper for debugging FileStorage problems."""
 
@@ -40,13 +43,13 @@
         h = self.file.read(TRANS_HDR_LEN)
         if not h:
             return False
-        tid, stlen, status, ul, dl, el = struct.unpack(TRANS_HDR, h)
-        end = pos + u64(stlen)
+        tid, tlen, status, ul, dl, el = struct.unpack(TRANS_HDR, h)
+        end = pos + tlen
         print >> self.dest, "=" * 60
         print >> self.dest, "offset: %d" % pos
         print >> self.dest, "end pos: %d" % end
         print >> self.dest, "transaction id: %s" % fmt(tid)
-        print >> self.dest, "trec len: %d" % u64(stlen)
+        print >> self.dest, "trec len: %d" % tlen
         print >> self.dest, "status: %r" % status
         user = descr = extra = ""
         if ul:
@@ -60,22 +63,21 @@
         print >> self.dest, "len(extra): %d" % el
         while self.file.tell() < end:
             self.dump_data(pos)
-        stlen2 = self.file.read(8)
-        print >> self.dest, "redundant trec len: %d" % u64(stlen2)
+        tlen2 = u64(self.file.read(8))
+        print >> self.dest, "redundant trec len: %d" % tlen2
         return True
 
     def dump_data(self, tloc):
         pos = self.file.tell()
         h = self.file.read(DATA_HDR_LEN)
         assert len(h) == DATA_HDR_LEN
-        oid, revid, sprev, stloc, vlen, sdlen = struct.unpack(DATA_HDR, h)
-        dlen = u64(sdlen)
+        oid, revid, prev, tloc, vlen, dlen = struct.unpack(DATA_HDR, h)
         print >> self.dest, "-" * 60
         print >> self.dest, "offset: %d" % pos
         print >> self.dest, "oid: %s" % fmt(oid)
         print >> self.dest, "revid: %s" % fmt(revid)
-        print >> self.dest, "previous record offset: %d" % u64(sprev)
-        print >> self.dest, "transaction offset: %d" % u64(stloc)
+        print >> self.dest, "previous record offset: %d" % prev
+        print >> self.dest, "transaction offset: %d" % tloc
         if vlen:
             pnv = self.file.read(8)
             sprevdata = self.file.read(8)