[Zodb-checkins] CVS: ZODB3/ZEO - ClientCache.py:1.42 ClientStorage.py:1.82
Guido van Rossum
guido@python.org
Tue, 7 Jan 2003 17:34:10 -0500
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv31208
Modified Files:
ClientCache.py ClientStorage.py
Log Message:
No longer use CLIENT_HOME, INSTANCE_HOME, or ZEO_CLIENT environment
variables. Updated docstrings/comments.
=== ZODB3/ZEO/ClientCache.py 1.41 => 1.42 ===
--- ZODB3/ZEO/ClientCache.py:1.41 Fri Jan 3 17:07:38 2003
+++ ZODB3/ZEO/ClientCache.py Tue Jan 7 17:34:06 2003
@@ -122,16 +122,18 @@
magic = 'ZEC1'
headersize = 12
+MB = 1024**2
+
class ClientCache:
__implements__ = ICache
- def __init__(self, storage='1', size=20000000, client=None, var=None):
+ def __init__(self, storage='1', size=20*MB, client=None, var=None):
# Arguments:
# storage -- storage name (used in filenames and log messages)
# size -- size limit in bytes of both files together
# client -- if not None, use a persistent cache file and use this name
- # var -- directory where to create persistent cache files
+ # var -- directory where to create persistent cache files; default cwd
self._storage = storage
self._limit = size / 2
@@ -145,15 +147,8 @@
if client is not None:
# Create a persistent cache
- # CLIENT_HOME and INSTANCE_HOME are builtins set by App.FindHomes
if var is None:
- try:
- var = CLIENT_HOME
- except:
- try:
- var = os.path.join(INSTANCE_HOME, 'var')
- except:
- var = os.getcwd()
+ var = os.getcwd()
fmt = os.path.join(var, "c%s-%s-%%s.zec" % (storage, client))
# Initialize pairs of filenames, file objects, and serialnos.
=== ZODB3/ZEO/ClientStorage.py 1.81 => 1.82 ===
--- ZODB3/ZEO/ClientStorage.py:1.81 Fri Jan 3 17:07:38 2003
+++ ZODB3/ZEO/ClientStorage.py Tue Jan 7 17:34:06 2003
@@ -141,16 +141,15 @@
name -- The storage name, defaulting to ''. If this is false,
str(addr) is used as the storage name.
- client -- The client name, defaulting to None. If this is
- false, the environment value ZEO_CLIENT is used. If the
- effective value is true, the client cache is persistent.
- See ClientCache for more info.
+ client -- A name used to construct persistent cache filenames.
+ Defaults to None, in which case the cache is not persistent.
debug -- Ignored. This is present only for backwards
compatibility with ZEO 1.
- var -- The 'var' directory, defaulting to None, in which
- the persistent cache files should be written.
+ var -- When client is not None, this specifies the directory
+ where the persistent cache files are created. It defaults
+ to None, in whichcase the current directory is used.
min_disconnect_poll -- The minimum delay in seconds between
attempts to connect to the server, in seconds. Defaults
@@ -249,7 +248,7 @@
self._oid = '\0\0\0\0\0\0\0\0'
# Decide whether to use non-temporary files
- client = client or os.environ.get('ZEO_CLIENT')
+ client = client
self._cache = self.ClientCacheClass(storage, cache_size,
client=client, var=var)