Commit 27e185b9 authored by Jim Fulton's avatar Jim Fulton

Made it easier to call pack on the storage. The time argument now

defaults to the present and a 'days' keyword argument can be used to
specify a number of days pervious to the time to pack to.

A wait keyword argment can be provided for pack that causes the client
to wait for a pack response from the server. NOTE: no other requests
will be sent to the server while waiting for the pack response. This
feature should only be used from utility packing scripts.
parent 97129eb2
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Network ZODB storage client """Network ZODB storage client
""" """
__version__='$Revision: 1.22 $'[11:-2] __version__='$Revision: 1.23 $'[11:-2]
import struct, time, os, socket, string, Sync, zrpc, ClientCache import struct, time, os, socket, string, Sync, zrpc, ClientCache
import tempfile, Invalidator, ExtensionClass, thread import tempfile, Invalidator, ExtensionClass, thread
...@@ -368,11 +368,13 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage): ...@@ -368,11 +368,13 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
return oids.pop() return oids.pop()
finally: self._lock_release() finally: self._lock_release()
def pack(self, t, rf): def pack(self, t=None, rf=None, wait=0, days=0):
# Note that we ignore the rf argument. The server # Note that we ignore the rf argument. The server
# will provide it's own implementation. # will provide it's own implementation.
if t is None: t=time.time()
t=t-(days*86400)
self._lock_acquire() self._lock_acquire()
try: return self._call('pack', t) try: return self._call('pack', t, wait)
finally: self._lock_release() finally: self._lock_release()
def store(self, oid, serial, data, version, transaction): def store(self, oid, serial, data, version, transaction):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment