[Zodb-checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.73.2.7.2.11 ServerStub.py:1.9.22.4

Guido van Rossum guido@python.org
Wed, 18 Dec 2002 22:37:39 -0500


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv23586

Modified Files:
      Tag: ZODB3-fast-restart-branch
	ClientStorage.py ServerStub.py 
Log Message:
Add protocol negotiation.  After an insight provided by Tim, I figured
out a way to do protocol negotiation at the connection level in the
client, by waiting until the server handshake is received before
sending the client handshake.  Clients running protocol 2.0.1 can now
talk to servers running 2.0.0 or 2.0.1; however, servers running
protocol 2.0.1 can only talk to clients running 2.0.1.  This means
that clients must be upgraded before servers.  See extensive comments
in connection.py, in class ManagedConnection.

Some backward compatibility code was added to ClientStorage.py and
ServerStub.py.


=== ZODB3/ZEO/ClientStorage.py 1.73.2.7.2.10 => 1.73.2.7.2.11 ===
--- ZODB3/ZEO/ClientStorage.py:1.73.2.7.2.10	Tue Dec 17 17:13:07 2002
+++ ZODB3/ZEO/ClientStorage.py	Wed Dec 18 22:37:08 2002
@@ -409,7 +409,8 @@
             # log some hints about last transaction
             log2(INFO, "last inval tid: %r %s"
                  % (last_inval_tid, tid2time(last_inval_tid)))
-            log2(INFO, "last transaction: %r %s" % (ltid, tid2time(ltid)))
+            log2(INFO, "last transaction: %r %s" %
+                 (ltid, ltid and tid2time(ltid)))
 
             pair = server.getInvalidations(last_inval_tid)
             if pair is not None:
@@ -845,3 +846,12 @@
             self._cache.invalidate(oid, version=version)
             if db is not None:
                 db.invalidate(oid, version=version)
+
+    # The following are for compatibility with protocol version 2.0.0
+
+    def invalidateTrans(self, args):
+        return invalidateTransaction(None, args)
+
+    invalidate = invalidateVerify
+    end = endVerify
+    Invalidate = invalidateTrans


=== ZODB3/ZEO/ServerStub.py 1.9.22.3 => 1.9.22.4 ===
--- ZODB3/ZEO/ServerStub.py:1.9.22.3	Tue Dec 17 15:50:13 2002
+++ ZODB3/ZEO/ServerStub.py	Wed Dec 18 22:37:08 2002
@@ -32,6 +32,9 @@
         zrpc.connection.Connection class.
         """
         self.rpc = rpc
+        if self.rpc.peer_protocol_version == 'Z200':
+            self.lastTransaction = lambda: None
+            self.getInvalidations = lambda tid: None
 
     def _update(self):
         """Handle pending incoming messages.
@@ -49,9 +52,11 @@
         return self.rpc.call('get_info')
 
     def lastTransaction(self):
+        # Not in protocol version 2.0.0; see __init__()
         return self.rpc.call('lastTransaction')
 
     def getInvalidations(self, tid):
+        # Not in protocol version 2.0.0; see __init__()
         return self.rpc.call('getInvalidations', tid)
 
     def zeoVerify(self, oid, s, sv):