[Zodb-checkins] CVS: ZODB4/src/zodb/zeo - cache.py:1.4 client.py:1.7 commitlog.py:1.3 server.py:1.9 stubs.py:1.6 tbuf.py:1.3

Barry Warsaw barry@wooz.org
Thu, 13 Mar 2003 16:33:01 -0500


Update of /cvs-repository/ZODB4/src/zodb/zeo
In directory cvs.zope.org:/tmp/cvs-serv27419/src/zodb/zeo

Modified Files:
	cache.py client.py commitlog.py server.py stubs.py tbuf.py 
Log Message:
> I believe we're ready to merge back to the head.

merging the opaque-pickles-branch back into the head



=== ZODB4/src/zodb/zeo/cache.py 1.3 => 1.4 ===
--- ZODB4/src/zodb/zeo/cache.py:1.3	Tue Feb 25 13:55:05 2003
+++ ZODB4/src/zodb/zeo/cache.py	Thu Mar 13 16:32:30 2003
@@ -108,11 +108,13 @@
 import logging
 import os
 import time
+import logging
 import tempfile
 from struct import pack, unpack
 from thread import allocate_lock
 
 from zodb.utils import u64
+from zodb.interfaces import ZERO
 
 magic = 'ZEC1'
 headersize = 12
@@ -151,7 +153,7 @@
             # Initialize pairs of filenames, file objects, and serialnos.
             self._p = p = [fmt % 0, fmt % 1]
             self._f = f = [None, None]
-            s = ['\0\0\0\0\0\0\0\0', '\0\0\0\0\0\0\0\0']
+            s = [ZERO, ZERO]
             for i in 0, 1:
                 if os.path.exists(p[i]):
                     fi = open(p[i],'r+b')
@@ -162,7 +164,7 @@
                             fi.seek(headersize + 19)
                             s[i] = fi.read(8)
                     # If we found a non-zero serial, then use the file
-                    if s[i] != '\0\0\0\0\0\0\0\0':
+                    if s[i] != ZERO:
                         f[i] = fi
                     fi = None
 
@@ -447,7 +449,7 @@
         self._trace(0x6A, header[:8], vlen and vheader[:-4] or '',
                     vlen and vserial or header[-8:], dlen)
 
-    def update(self, oid, serial, version, data):
+    def update(self, oid, serial, version, data, refs):
         self._acquire()
         try:
             self._trace(0x3A, oid, version, serial, len(data))
@@ -578,7 +580,7 @@
     def _store(self, oid, p, s, version, pv, sv):
         if not s:
             p = ''
-            s = '\0\0\0\0\0\0\0\0'
+            s = ZERO
         tlen = 31 + len(p)
         if version:
             tlen = tlen + len(version) + 12 + len(pv)


=== ZODB4/src/zodb/zeo/client.py 1.6 => 1.7 ===
--- ZODB4/src/zodb/zeo/client.py:1.6	Thu Mar 13 13:48:58 2003
+++ ZODB4/src/zodb/zeo/client.py	Thu Mar 13 16:32:30 2003
@@ -681,11 +681,11 @@
                 self._seriald[oid] = s
             return r
 
-    def store(self, oid, serial, data, version, transaction):
+    def store(self, oid, serial, data, refs, version, transaction):
         """Storage API: store data for an object."""
         self._check_trans(transaction)
-        self._server.storea(oid, serial, data, version, self._serial)
-        self._tbuf.store(oid, version, data)
+        self._server.storea(oid, serial, data, refs, version, self._serial)
+        self._tbuf.store(oid, version, data, refs)
         return self._check_serials()
 
     def tpcVote(self, transaction):
@@ -804,7 +804,7 @@
                     "client storage: %s" % msg)
             if t is None:
                 break
-            oid, v, p = t
+            oid, v, p, refs = t
             if p is None: # an invalidation
                 s = None
             else:
@@ -812,7 +812,7 @@
             if s == ResolvedSerial or s is None:
                 self._cache.invalidate(oid, v)
             else:
-                self._cache.update(oid, s, v, p)
+                self._cache.update(oid, s, v, p, refs)
         self._tbuf.clear()
 
     def undo(self, trans_id, trans):


=== ZODB4/src/zodb/zeo/commitlog.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/zeo/commitlog.py:1.2	Wed Dec 25 09:12:22 2002
+++ ZODB4/src/zodb/zeo/commitlog.py	Thu Mar 13 16:32:30 2003
@@ -31,8 +31,8 @@
         self.stores = 0
         self.read = 0
 
-    def store(self, oid, serial, data, version):
-        self.pickler.dump((oid, serial, data, version))
+    def store(self, oid, serial, data, refs, version):
+        self.pickler.dump((oid, serial, data, refs, version))
         self.stores += 1
 
     def get_loader(self):


=== ZODB4/src/zodb/zeo/server.py 1.8 => 1.9 ===
--- ZODB4/src/zodb/zeo/server.py:1.8	Thu Mar 13 13:48:58 2003
+++ ZODB4/src/zodb/zeo/server.py	Thu Mar 13 16:32:30 2003
@@ -37,6 +37,7 @@
 from zodb.zeo.zrpc.connection import ManagedServerConnection, Delay, MTDelay
 from zodb.zeo.zrpc.trigger import trigger
 
+from zodb.serialize import findrefs
 from zodb.interfaces import *
 from zodb.storage.interfaces import *
 from zodb.conflict import ResolvedSerial
@@ -375,10 +376,10 @@
     # Most of the real implementations are in methods beginning with
     # an _.
 
-    def storea(self, oid, serial, data, version, id):
+    def storea(self, oid, serial, data, refs, version, id):
         self._check_tid(id, exc=StorageTransactionError)
         self.stats.stores += 1
-        self.txnlog.store(oid, serial, data, version)
+        self.txnlog.store(oid, serial, data, refs, version)
 
     # The following four methods return values, so they must acquire
     # the storage lock and begin the transaction before returning.
@@ -417,10 +418,10 @@
         self.stats.lock_time = time.time()
         self.storage.tpcBegin(txn, tid, status)
 
-    def _store(self, oid, serial, data, version):
+    def _store(self, oid, serial, data, refs, version):
         try:
-            newserial = self.storage.store(oid, serial, data, version,
-                                           self.transaction)
+            newserial = self.storage.store(oid, serial, data, refs,
+                                           version, self.transaction)
         except (SystemExit, KeyboardInterrupt):
             raise
         except Exception, err:


=== ZODB4/src/zodb/zeo/stubs.py 1.5 => 1.6 ===
--- ZODB4/src/zodb/zeo/stubs.py:1.5	Tue Feb 25 13:55:05 2003
+++ ZODB4/src/zodb/zeo/stubs.py	Thu Mar 13 16:32:30 2003
@@ -105,7 +105,7 @@
 
     def getInvalidations(self, tid):
         return self.rpc.call('getInvalidations', tid)
-    
+
     def beginZeoVerify(self):
         self.rpc.callAsync('beginZeoVerify')
 
@@ -124,8 +124,8 @@
     def zeoLoad(self, oid):
         return self.rpc.call('zeoLoad', oid)
 
-    def storea(self, oid, serial, data, version, id):
-        self.rpc.callAsync('storea', oid, serial, data, version, id)
+    def storea(self, oid, serial, data, refs, version, id):
+        self.rpc.callAsync('storea', oid, serial, data, refs, version, id)
 
     def tpcBegin(self, id, user, descr, ext, tid, status):
         return self.rpc.call('tpcBegin', id, user, descr, ext, tid, status)
@@ -175,8 +175,8 @@
     def lastTransaction(self):
         return self.rpc.call('lastTransaction')
 
-    def store(self, oid, serial, data, version, trans):
-        return self.rpc.call('store', oid, serial, data, version, trans)
+    def store(self, oid, serial, data, refs, version, trans):
+        return self.rpc.call('store', oid, serial, data, refs, version, trans)
 
     def undo(self, trans_id, trans):
         return self.rpc.call('undo', trans_id, trans)


=== ZODB4/src/zodb/zeo/tbuf.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/zeo/tbuf.py:1.2	Wed Dec 25 09:12:22 2002
+++ ZODB4/src/zodb/zeo/tbuf.py	Thu Mar 13 16:32:30 2003
@@ -75,31 +75,32 @@
         finally:
             self.lock.release()
 
-    def store(self, oid, version, data):
+    def store(self, oid, version, data, refs):
         self.lock.acquire()
         try:
-            self._store(oid, version, data)
+            self._store(oid, version, data, refs)
         finally:
             self.lock.release()
 
-    def _store(self, oid, version, data):
-        """Store oid, version, data for later retrieval"""
+    def _store(self, oid, version, data, refs):
+        """Store oid, version, data, refs for later retrieval"""
         if self.closed:
             return
-        self.pickler.dump((oid, version, data))
+        self.pickler.dump((oid, version, data, refs))
         self.count += 1
         # Estimate per-record cache size
         self.size = self.size + len(data) + 31
         if version:
             # Assume version data has same size as non-version data
-            self.size = self.size + len(version) + len(data) + 12
+            refslen = len(''.join(refs))
+            self.size = self.size + len(version) + len(data) + refslen + 12
 
     def invalidate(self, oid, version):
         self.lock.acquire()
         try:
             if self.closed:
                 return
-            self.pickler.dump((oid, version, None))
+            self.pickler.dump((oid, version, None, []))
             self.count += 1
         finally:
             self.lock.release()