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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
1cf61122
Commit
1cf61122
authored
Nov 12, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a small feature from Dieter-- start and stop flags on fsdump().
Also add docstring, copyright notice.
parent
34ee83d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
src/ZODB/fsdump.py
src/ZODB/fsdump.py
+29
-6
No files found.
src/ZODB/fsdump.py
View file @
1cf61122
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Low-level text dumps of FileStorage contents.
fsdump() prints a two-line summary of each transaction and a one-line
summary of each data record in that transaction. This report is often
useful when analyzing a storage's contents.
Dumper() prints a very detailed representation of the contents. Each
header field is printed on a separate line. This produces lots of
data that is useful when debugging the storage implementation.
"""
from
ZODB.FileStorage
import
TRANS_HDR
,
TRANS_HDR_LEN
from
ZODB.FileStorage
import
DATA_HDR
,
DATA_HDR_LEN
,
DATA_VERSION_HDR_LEN
from
ZODB.FileStorage
import
FileIterator
from
ZODB.TimeStamp
import
TimeStamp
from
ZODB.utils
import
u64
...
...
@@ -6,6 +32,7 @@ from ZODB.tests.StorageTestBase import zodb_unpickle
from
cPickle
import
Unpickler
from
cStringIO
import
StringIO
import
md5
import
struct
import
types
def
get_pickle_metadata
(
data
):
...
...
@@ -36,9 +63,9 @@ def get_pickle_metadata(data):
classname
=
''
return
modname
,
classname
def
fsdump
(
path
,
file
=
None
,
with_offset
=
1
):
def
fsdump
(
path
,
file
=
None
,
with_offset
=
True
,
start
=
None
,
stop
=
None
):
i
=
0
iter
=
FileIterator
(
path
)
iter
=
FileIterator
(
path
,
start
,
stop
)
for
trans
in
iter
:
if
with_offset
:
print
>>
file
,
(
"Trans #%05d tid=%016x time=%s size=%d"
...
...
@@ -90,10 +117,6 @@ def fsdump(path, file=None, with_offset=1):
i
+=
1
iter
.
close
()
import
struct
from
ZODB.FileStorage
import
TRANS_HDR
,
TRANS_HDR_LEN
from
ZODB.FileStorage
import
DATA_HDR
,
DATA_HDR_LEN
,
DATA_VERSION_HDR_LEN
def
fmt
(
p64
):
# Return a nicely formatted string for a packaged 64-bit value
return
"%016x"
%
u64
(
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