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
nexedi
ZODB
Commits
40998e10
Commit
40998e10
authored
Jan 30, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support -d option to specify days
parent
fcaa1e26
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
17 deletions
+32
-17
src/scripts/tests/testzeopack.py
src/scripts/tests/testzeopack.py
+6
-0
src/scripts/zeopack.py
src/scripts/zeopack.py
+26
-17
No files found.
src/scripts/tests/testzeopack.py
View file @
40998e10
...
@@ -60,6 +60,12 @@ class PackerTests(StorageTestBase):
...
@@ -60,6 +60,12 @@ class PackerTests(StorageTestBase):
os
.
system
(
"zeopack.py -h %s -p %s"
%
(
self
.
host
,
self
.
port
))
os
.
system
(
"zeopack.py -h %s -p %s"
%
(
self
.
host
,
self
.
port
))
assert
os
.
path
.
exists
(
self
.
path
+
".old"
)
assert
os
.
path
.
exists
(
self
.
path
+
".old"
)
def
testPackDays
(
self
):
self
.
set_inet_addr
()
self
.
start
()
os
.
system
(
"zeopack.py -h %s -p %s -d 1"
%
(
self
.
host
,
self
.
port
))
assert
os
.
path
.
exists
(
self
.
path
+
".old"
)
def
testAF_UNIXPack
(
self
):
def
testAF_UNIXPack
(
self
):
self
.
addr
=
tempfile
.
mktemp
(
suffix
=
".zeo-socket"
)
self
.
addr
=
tempfile
.
mktemp
(
suffix
=
".zeo-socket"
)
self
.
start
()
self
.
start
()
...
...
src/scripts/zeopack.py
View file @
40998e10
...
@@ -5,27 +5,29 @@ Usage: zeopack.py [options]
...
@@ -5,27 +5,29 @@ Usage: zeopack.py [options]
Options:
Options:
-p -- port to connect to
-p
port
-- port to connect to
-h -- host to connect to (default is current host)
-h
host
-- host to connect to (default is current host)
-U -- Unix-domain socket to connect to
-U
path
-- Unix-domain socket to connect to
-S -- storage name (default is '1')
-S name -- storage name (default is '1')
-d days -- pack objects more than days old
You must specify either -p and -h or -U.
You must specify either -p and -h or -U.
"""
"""
from
ZEO.ClientStorage
import
ClientStorage
from
ZEO.ClientStorage
import
ClientStorage
def
main
(
addr
,
storage
):
def
main
(
addr
,
storage
,
days
):
cs
=
ClientStorage
(
addr
,
storage
=
storage
,
wait_for_server_on_startup
=
1
)
cs
=
ClientStorage
(
addr
,
storage
=
storage
,
wait_for_server_on_startup
=
1
)
# _startup() is an artifact of the way ZEO 1.0 works. The
# _startup() is an artifact of the way ZEO 1.0 works. The
# ClientStorage doesn't get fully initialized until registerDB()
# ClientStorage doesn't get fully initialized until registerDB()
# is called. The only thing we care about, though, is that
# is called. The only thing we care about, though, is that
# registerDB() calls _startup().
# registerDB() calls _startup().
cs
.
_startup
()
cs
.
_startup
()
cs
.
pack
(
wait
=
1
)
cs
.
pack
(
wait
=
1
,
days
=
0
)
def
usage
(
exit
=
1
):
def
usage
(
exit
=
1
):
print
__doc__
print
__doc__
...
@@ -41,7 +43,9 @@ if __name__ == "__main__":
...
@@ -41,7 +43,9 @@ if __name__ == "__main__":
port
=
None
port
=
None
unix
=
None
unix
=
None
storage
=
'1'
storage
=
'1'
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'p:h:U:S:'
)
days
=
0
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'p:h:U:S:d:'
)
for
o
,
a
in
opts
:
for
o
,
a
in
opts
:
if
o
==
'-p'
:
if
o
==
'-p'
:
port
=
int
(
a
)
port
=
int
(
a
)
...
@@ -51,6 +55,11 @@ if __name__ == "__main__":
...
@@ -51,6 +55,11 @@ if __name__ == "__main__":
unix
=
a
unix
=
a
elif
o
==
'-S'
:
elif
o
==
'-S'
:
storage
=
a
storage
=
a
elif
o
==
'-d'
:
days
=
int
(
a
)
except
Exception
,
err
:
print
err
usage
()
if
unix
is
not
None
:
if
unix
is
not
None
:
addr
=
unix
addr
=
unix
...
@@ -61,4 +70,4 @@ if __name__ == "__main__":
...
@@ -61,4 +70,4 @@ if __name__ == "__main__":
usage
()
usage
()
addr
=
host
,
port
addr
=
host
,
port
main
(
addr
,
storage
)
main
(
addr
,
storage
,
days
)
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