[Zodb-checkins] CVS: Packages/ZEO - ClientStorage.py:1.26.4.15 ServerStub.py:1.1.2.6 StorageServer.py:1.21.4.11

jeremy@digicool.com jeremy@digicool.com
Fri, 27 Apr 2001 16:57:20 -0400 (EDT)


Update of /cvs-repository/Packages/ZEO
In directory korak:/tmp/cvs-serv20312

Modified Files:
      Tag: ZEO-ZRPC-Dev
	ClientStorage.py ServerStub.py StorageServer.py 
Log Message:
Support for transactionalUndo

Add default args to undoInfo().
Define supportsTransactionalUndo() via get_info() call.
XXX In transactionalUndo() on client, invalidate objects immediately.
This may not be right, because it assumes that transaction will
commit.  To do it right, I think the TransactionBuffer needs to be
updated with a second kind record -- the undo record, which only
invalidates the cache.

Also, modify _check_serials so test isn't "not StringType" but "is
Exception."





--- Updated File ClientStorage.py in package Packages/ZEO --
--- ClientStorage.py	2001/04/25 22:55:03	1.26.4.14
+++ ClientStorage.py	2001/04/27 20:57:18	1.26.4.15
@@ -183,9 +183,6 @@
 
         self.__name__ = name
 
-        # Allocate locks:
-##        import debuglock
-##        commit_lock = debuglock.DebugLock()
         commit_lock = thread.allocate_lock()
         self._commit_lock_acquire = commit_lock.acquire
         self._commit_lock_release = commit_lock.release
@@ -376,6 +373,8 @@
             r = self._serials[:l]
             del self._serials[:l]
             for oid, s in r:
+                if isinstance(s, Exception):
+                    raise s
                 self._seriald[oid] = s
             return r
 
@@ -405,6 +404,9 @@
     
     def supportsVersions(self):
         return self._info['supportsVersions']
+
+    def supportsTransactionalUndo(self):
+        return self._info['supportsTransactionalUndo']
         
     def tpc_abort(self, transaction):
         self._lock_acquire()
@@ -498,6 +500,19 @@
             self._commit_lock_release()
         finally: self._lock_release()
 
+    def transactionalUndo(self, trans_id, trans):
+        if trans is not self._transaction:
+            raise POSException.StorageTransactionError(self._transaction,
+                                                       transaction)
+        self._lock_acquire()
+        try:
+            oids = self._server.transactionalUndo(trans_id, self._serial)
+            for oid in oids:
+                self._cache.invalidate(oid, '')
+            return oids
+        finally:
+            self._lock_release()
+
     def undo(self, transaction_id):
         self._lock_acquire()
         try:
@@ -509,7 +524,7 @@
         finally: self._lock_release()
 
 
-    def undoInfo(self, first, last, specification):
+    def undoInfo(self, first=0, last=-20, specification=None):
         self._lock_acquire()
         try:
             return self._server.undoInfo(first, last, specification)

--- Updated File ServerStub.py in package Packages/ZEO --
--- ServerStub.py	2001/04/25 22:51:32	1.1.2.5
+++ ServerStub.py	2001/04/27 20:57:19	1.1.2.6
@@ -83,6 +83,9 @@
     def store(self, oid, serial, data, version, trans):
         return self.rpc.call('store', oid, serial, data, version, trans)
 
+    def transactionalUndo(self, trans_id, trans):
+        return self.rpc.call('transactionalUndo', trans_id, trans)
+
     def undo(self, trans_id):
         return self.rpc.call('undo', trans_id)
 

--- Updated File StorageServer.py in package Packages/ZEO --
--- StorageServer.py	2001/04/25 22:55:03	1.21.4.10
+++ StorageServer.py	2001/04/27 20:57:19	1.21.4.11
@@ -230,19 +230,19 @@
         self._log("registered storage %s: %s" % (storage_id, storage))
 
     def get_info(self):
-        return {
-            'length': len(self.__storage),
-            'size': self.__storage.getSize(),
-            'name': self.__storage.getName(),
-            'supportsUndo': self.__storage.supportsUndo(),
-            'supportsVersions': self.__storage.supportsVersions(),
-            }
+        return {'length': len(self.__storage),
+                'size': self.__storage.getSize(),
+                'name': self.__storage.getName(),
+                'supportsUndo': self.__storage.supportsUndo(),
+                'supportsVersions': self.__storage.supportsVersions(),
+                'supportsTransactionalUndo':
+                self.__storage.supportsTransactionalUndo(),
+                }
 
     def get_size_info(self):
-        return {
-            'length': len(self.__storage),
-            'size': self.__storage.getSize(),
-            }
+        return {'length': len(self.__storage),
+                'size': self.__storage.getSize(),
+                }
 
     def zeoLoad(self, oid):
         v = self.__storage.modifiedInVersion(oid)
@@ -352,6 +352,10 @@
     def vote(self, id):
         self._check_tid(id, exc=StorageTransactionError)
         return self.__storage.tpc_vote(self._transaction)
+
+    def transactionalUndo(self, trans_id, id):
+        self._check_tid(id, exc=StorageTransactionError)
+        return self.__storage.transactionalUndo(trans_id, self._transaction)
         
     def undo(self, transaction_id):
         oids = self.__storage.undo(transaction_id)