SVN: ZODB/branches/hannosch-pickle-protocol2/ Warmup excercise, handle the protocol level of the zeo cache

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <[email protected]>
Log message for revision 111817:
  Warmup excercise, handle the protocol level of the zeo cache
  

Changed:
  U   ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZEO/ClientStorage.py
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZODB/component.xml
  U   ZODB/branches/hannosch-pickle-protocol2/src/ZODB/config.py

-=-
Modified: ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf	2010-05-01 11:18:59 UTC (rev 111816)
+++ ZODB/branches/hannosch-pickle-protocol2/etc/sample.conf	2010-05-01 11:51:50 UTC (rev 111817)
@@ -31,3 +31,13 @@
         cache-size 200000000
     </zeoclient>
 </zodb>
+
+<zodb zeofs_pcache_prot2>
+    <zeoclient>
+        server $host:8100
+        client 1
+        var var
+        cache-size 200000000
+        cache-protocol 2
+    </zeoclient>
+</zodb>

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZEO/ClientStorage.py	2010-05-01 11:18:59 UTC (rev 111816)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZEO/ClientStorage.py	2010-05-01 11:51:50 UTC (rev 111817)
@@ -123,6 +123,7 @@
                  username='', password='', realm=None,
                  blob_dir=None, shared_blob_dir=False,
                  blob_cache_size=None, blob_cache_size_check=10,
+                 cache_protocol=1,
                  ):
         """ClientStorage constructor.
 
@@ -234,6 +235,9 @@
             loaded into the cache. Defaults to 10% of the blob cache
             size.   This option is ignored if shared_blob_dir is true.
 
+        cache_protocol
+            The pickle protocol used for the ZEO cache. Defaults to 1.
+
         Note that the authentication protocol is defined by the server
         and is detected by the ClientStorage upon connecting (see
         testConnection() and doAuth() for details).
@@ -396,8 +400,8 @@
             cache_path = None
 
         self._cache = self.ClientCacheClass(cache_path, size=cache_size)
+        self._cache_protocol = cache_protocol
 
-
         self._blob_cache_size = blob_cache_size
         self._blob_data_bytes_loaded = 0
         if blob_cache_size is not None:
@@ -1299,7 +1303,7 @@
         # setup tempfile to hold zeoVerify results and interim
         # invalidation results
         self._tfile = tempfile.TemporaryFile(suffix=".inv")
-        self._pickler = cPickle.Pickler(self._tfile, 1)
+        self._pickler = cPickle.Pickler(self._tfile, self._cache_protocol)
         self._pickler.fast = 1 # Don't use the memo
 
         if self._connection.peer_protocol_version < 'Z309':

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZODB/component.xml
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZODB/component.xml	2010-05-01 11:18:59 UTC (rev 111816)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZODB/component.xml	2010-05-01 11:51:50 UTC (rev 111817)
@@ -138,6 +138,11 @@
         The maximum size of the client cache, in bytes, KB or MB.
       </description>
     </key>
+    <key name="cache-protocol" required="no" datatype="integer">
+      <description>
+        The pickle protocol used for the cache. Defaults to 1.
+      </description>
+    </key>
     <key name="name" default="">
       <description>
         The storage name.  If unspecified, the address of the server

Modified: ZODB/branches/hannosch-pickle-protocol2/src/ZODB/config.py
===================================================================
--- ZODB/branches/hannosch-pickle-protocol2/src/ZODB/config.py	2010-05-01 11:18:59 UTC (rev 111816)
+++ ZODB/branches/hannosch-pickle-protocol2/src/ZODB/config.py	2010-05-01 11:51:50 UTC (rev 111817)
@@ -188,6 +188,8 @@
             options['blob_cache_size'] = self.config.blob_cache_size
         if self.config.blob_cache_size_check is not None:
             options['blob_cache_size_check'] = self.config.blob_cache_size_check
+        if self.config.cache_protocol is not None:
+            options['cache_protocol'] = self.config.cache_protocol
 
         return ClientStorage(
             L,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.