Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
7aa7c699
Commit
7aa7c699
authored
Feb 03, 2005
by
Dmitry Vasiliev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Size info for object records was added. Also use enumerate() builtin.
parent
475d8cb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
src/ZODB/FileStorage/fsdump.py
src/ZODB/FileStorage/fsdump.py
+9
-11
No files found.
src/ZODB/FileStorage/fsdump.py
View file @
7aa7c699
...
@@ -21,9 +21,8 @@ from ZODB.utils import u64, get_pickle_metadata
...
@@ -21,9 +21,8 @@ from ZODB.utils import u64, get_pickle_metadata
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
def
fsdump
(
path
,
file
=
None
,
with_offset
=
1
):
def
fsdump
(
path
,
file
=
None
,
with_offset
=
1
):
i
=
0
iter
=
FileIterator
(
path
)
iter
=
FileIterator
(
path
)
for
trans
in
iter
:
for
i
,
trans
in
enumerate
(
iter
)
:
if
with_offset
:
if
with_offset
:
print
>>
file
,
"Trans #%05d tid=%016x time=%s offset=%d"
%
\
print
>>
file
,
"Trans #%05d tid=%016x time=%s offset=%d"
%
\
(
i
,
u64
(
trans
.
tid
),
str
(
TimeStamp
(
trans
.
tid
)),
trans
.
_pos
)
(
i
,
u64
(
trans
.
tid
),
str
(
TimeStamp
(
trans
.
tid
)),
trans
.
_pos
)
...
@@ -32,12 +31,13 @@ def fsdump(path, file=None, with_offset=1):
...
@@ -32,12 +31,13 @@ def fsdump(path, file=None, with_offset=1):
(
i
,
u64
(
trans
.
tid
),
str
(
TimeStamp
(
trans
.
tid
)))
(
i
,
u64
(
trans
.
tid
),
str
(
TimeStamp
(
trans
.
tid
)))
print
>>
file
,
"
\
t
status=%s user=%s description=%s"
%
\
print
>>
file
,
"
\
t
status=%s user=%s description=%s"
%
\
(
`trans.status`
,
trans
.
user
,
trans
.
description
)
(
`trans.status`
,
trans
.
user
,
trans
.
description
)
j
=
0
for
j
,
rec
in
enumerate
(
trans
):
for
rec
in
trans
:
if
rec
.
data
is
None
:
if
rec
.
data
is
None
:
fullclass
=
"undo or abort of object creation"
fullclass
=
"undo or abort of object creation"
size
=
""
else
:
else
:
modname
,
classname
=
get_pickle_metadata
(
rec
.
data
)
modname
,
classname
=
get_pickle_metadata
(
rec
.
data
)
size
=
" size=%d"
%
len
(
rec
.
data
)
fullclass
=
"%s.%s"
%
(
modname
,
classname
)
fullclass
=
"%s.%s"
%
(
modname
,
classname
)
# FIXME: Is this used?
# FIXME: Is this used?
# special case for testing purposes
# special case for testing purposes
...
@@ -45,20 +45,18 @@ def fsdump(path, file=None, with_offset=1):
...
@@ -45,20 +45,18 @@ def fsdump(path, file=None, with_offset=1):
obj
=
zodb_unpickle
(
rec
.
data
)
obj
=
zodb_unpickle
(
rec
.
data
)
fullclass
=
"%s %s"
%
(
fullclass
,
obj
.
value
)
fullclass
=
"%s %s"
%
(
fullclass
,
obj
.
value
)
if
rec
.
version
:
if
rec
.
version
:
version
=
"
version=%s
"
%
rec
.
version
version
=
"
version=%s
"
%
rec
.
version
else
:
else
:
version
=
''
version
=
""
if
rec
.
data_txn
:
if
rec
.
data_txn
:
# XXX It would be nice to print the transaction number
# XXX It would be nice to print the transaction number
# (i) but it would be too expensive to keep track of.
# (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
:
else
:
bp
=
""
bp
=
""
print
>>
file
,
" data #%05d oid=%016x %sclass=%s %s"
%
\
print
>>
file
,
" data #%05d oid=%016x%s%s class=%s%s"
%
\
(
j
,
u64
(
rec
.
oid
),
version
,
fullclass
,
bp
)
(
j
,
u64
(
rec
.
oid
),
version
,
size
,
fullclass
,
bp
)
j
+=
1
print
>>
file
print
>>
file
i
+=
1
iter
.
close
()
iter
.
close
()
def
fmt
(
p64
):
def
fmt
(
p64
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment