Commit 7aa7c699 authored by Dmitry Vasiliev's avatar Dmitry Vasiliev

Size info for object records was added. Also use enumerate() builtin.

parent 475d8cb8
......@@ -21,9 +21,8 @@ from ZODB.utils import u64, get_pickle_metadata
from ZODB.tests.StorageTestBase import zodb_unpickle
def fsdump(path, file=None, with_offset=1):
i = 0
iter = FileIterator(path)
for trans in iter:
for i, trans in enumerate(iter):
if with_offset:
print >> file, "Trans #%05d tid=%016x time=%s offset=%d" % \
(i, u64(trans.tid), str(TimeStamp(trans.tid)), trans._pos)
......@@ -32,12 +31,13 @@ def fsdump(path, file=None, with_offset=1):
(i, u64(trans.tid), str(TimeStamp(trans.tid)))
print >> file, "\tstatus=%s user=%s description=%s" % \
(`trans.status`, trans.user, trans.description)
j = 0
for rec in trans:
for j, rec in enumerate(trans):
if rec.data is None:
fullclass = "undo or abort of object creation"
size = ""
else:
modname, classname = get_pickle_metadata(rec.data)
size = " size=%d" % len(rec.data)
fullclass = "%s.%s" % (modname, classname)
# FIXME: Is this used?
# special case for testing purposes
......@@ -45,20 +45,18 @@ def fsdump(path, file=None, with_offset=1):
obj = zodb_unpickle(rec.data)
fullclass = "%s %s" % (fullclass, obj.value)
if rec.version:
version = "version=%s " % rec.version
version = " version=%s" % rec.version
else:
version = ''
version = ""
if rec.data_txn:
# XXX It would be nice to print the transaction number
# (i) but it would be too expensive to keep track of.
bp = "bp=%016x" % u64(rec.data_txn)
bp = " bp=%016x" % u64(rec.data_txn)
else:
bp = ""
print >> file, " data #%05d oid=%016x %sclass=%s %s" % \
(j, u64(rec.oid), version, fullclass, bp)
j += 1
print >> file, " data #%05d oid=%016x%s%s class=%s%s" % \
(j, u64(rec.oid), version, size, fullclass, bp)
print >> file
i += 1
iter.close()
def fmt(p64):
......
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