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
Kirill Smelkov
ZODB
Commits
9203aa1c
Commit
9203aa1c
authored
May 03, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A very simple tool to report the size of objects in a storage.
parent
ea067781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
src/scripts/space.py
src/scripts/space.py
+36
-0
No files found.
src/scripts/space.py
0 → 100644
View file @
9203aa1c
#! /usr/bin/env python
"""Report on the space used by objects in a storage.
usage: space.py data.fs
The current implementation only supports FileStorage.
Current limitations / simplifications: Ignores revisions and versions.
"""
import
ZODB
from
ZODB.FileStorage
import
FileStorage
from
ZODB.utils
import
U64
from
ZODB.fsdump
import
get_pickle_metadata
def
main
(
path
):
fs
=
FileStorage
(
path
,
read_only
=
1
)
# break into the file implementation
if
hasattr
(
fs
.
_index
,
'iterkeys'
):
iter
=
fs
.
_index
.
iterkeys
()
else
:
iter
=
fs
.
_index
.
keys
()
for
oid
in
iter
:
data
,
serialno
=
fs
.
load
(
oid
,
''
)
mod
,
klass
=
get_pickle_metadata
(
data
)
print
"%8s %5d %s.%s"
%
(
U64
(
oid
),
len
(
data
),
mod
,
klass
)
if
__name__
==
"__main__"
:
import
sys
try
:
path
,
=
sys
.
argv
[
1
:]
except
ValueError
:
print
__doc__
sys
.
exit
(
2
)
main
(
path
)
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