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
fcaa1e26
Commit
fcaa1e26
authored
Jan 30, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Utility to connect to ZEO server and pack it.
parent
d23eb779
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
0 deletions
+134
-0
src/scripts/tests/testzeopack.py
src/scripts/tests/testzeopack.py
+70
-0
src/scripts/zeopack.py
src/scripts/zeopack.py
+64
-0
No files found.
src/scripts/tests/testzeopack.py
0 → 100644
View file @
fcaa1e26
# Some simple tests for zeopack.py
# For this to work, zeopack.py must by on your PATH.
from
ZODB.FileStorage
import
FileStorage
from
ZODB.tests.StorageTestBase
import
StorageTestBase
from
ZEO.tests
import
forker
import
ZODB
import
os
import
socket
import
tempfile
import
unittest
# XXX The forker interface isn't clearly defined. It's different on
# different branches of ZEO. This will break someday.
# XXX Only handle the Unix variant of the forker. Just to give Tim
# something to do.
class
PackerTests
(
StorageTestBase
):
def
start
(
self
):
self
.
path
=
tempfile
.
mktemp
(
suffix
=
".fs"
)
self
.
_storage
=
FileStorage
(
self
.
path
)
self
.
db
=
ZODB
.
DB
(
self
.
_storage
)
self
.
do_updates
()
self
.
pid
,
self
.
exit
=
forker
.
start_zeo_server
(
self
.
_storage
,
self
.
addr
)
def
do_updates
(
self
):
for
i
in
range
(
100
):
self
.
_dostore
()
def
tearDown
(
self
):
self
.
db
.
close
()
self
.
_storage
.
close
()
self
.
exit
.
close
()
try
:
os
.
kill
(
self
.
pid
,
9
)
except
os
.
error
:
pass
try
:
os
.
waitpid
(
self
.
pid
,
0
)
except
os
.
error
,
err
:
print
err
for
ext
in
''
,
'.old'
,
'.lock'
,
'.index'
,
'.tmp'
:
path
=
self
.
path
+
ext
try
:
os
.
remove
(
path
)
except
os
.
error
:
pass
def
set_inet_addr
(
self
):
self
.
host
=
socket
.
gethostname
()
self
.
port
=
forker
.
get_port
()
self
.
addr
=
self
.
host
,
self
.
port
def
testPack
(
self
):
self
.
set_inet_addr
()
self
.
start
()
os
.
system
(
"zeopack.py -h %s -p %s"
%
(
self
.
host
,
self
.
port
))
assert
os
.
path
.
exists
(
self
.
path
+
".old"
)
def
testAF_UNIXPack
(
self
):
self
.
addr
=
tempfile
.
mktemp
(
suffix
=
".zeo-socket"
)
self
.
start
()
os
.
system
(
"zeopack.py -U %s"
%
self
.
addr
)
assert
os
.
path
.
exists
(
self
.
path
+
".old"
)
if
__name__
==
"__main__"
:
unittest
.
main
()
src/scripts/zeopack.py
0 → 100755
View file @
fcaa1e26
#! /usr/bin/env python
"""Connect to a ZEO server and ask it to pack.
Usage: zeopack.py [options]
Options:
-p -- port to connect to
-h -- host to connect to (default is current host)
-U -- Unix-domain socket to connect to
-S -- storage name (default is '1')
You must specify either -p and -h or -U.
"""
from
ZEO.ClientStorage
import
ClientStorage
def
main
(
addr
,
storage
):
cs
=
ClientStorage
(
addr
,
storage
=
storage
,
wait_for_server_on_startup
=
1
)
# _startup() is an artifact of the way ZEO 1.0 works. The
# ClientStorage doesn't get fully initialized until registerDB()
# is called. The only thing we care about, though, is that
# registerDB() calls _startup().
cs
.
_startup
()
cs
.
pack
(
wait
=
1
)
def
usage
(
exit
=
1
):
print
__doc__
print
" "
.
join
(
sys
.
argv
)
sys
.
exit
(
exit
)
if
__name__
==
"__main__"
:
import
getopt
import
socket
import
sys
host
=
None
port
=
None
unix
=
None
storage
=
'1'
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'p:h:U:S:'
)
for
o
,
a
in
opts
:
if
o
==
'-p'
:
port
=
int
(
a
)
elif
o
==
'-h'
:
host
=
a
elif
o
==
'-U'
:
unix
=
a
elif
o
==
'-S'
:
storage
=
a
if
unix
is
not
None
:
addr
=
unix
else
:
if
host
is
None
:
host
=
socket
.
gethostname
()
if
port
is
None
:
usage
()
addr
=
host
,
port
main
(
addr
,
storage
)
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