[Zodb-checkins] CVS: Zope3/lib/python/ZEO - ClientCache.py:1.28 stats.py:1.2

Jeremy Hylton jeremy@zope.com
Mon, 25 Nov 2002 14:55:21 -0500


Update of /cvs-repository/Zope3/lib/python/ZEO
In directory cvs.zope.org:/tmp/cvs-serv7770/ZEO

Modified Files:
	ClientCache.py stats.py 
Log Message:
First step in ZODB3 / ZODB4 integration.

Merge FileStorage and BaseStorage changes and all the other dependent
stuff.

Make copyTransactionsFrom() always use restore().
Replace all uses of U64 with u64.
Use newTimeStamp() from ZODB.TimeStamp.
Remove __len__() and getSize().
Add getExtensionMethods().


=== Zope3/lib/python/ZEO/ClientCache.py 1.27 => 1.28 ===
--- Zope3/lib/python/ZEO/ClientCache.py:1.27	Fri Nov 22 16:24:53 2002
+++ Zope3/lib/python/ZEO/ClientCache.py	Mon Nov 25 14:54:50 2002
@@ -106,7 +106,7 @@
 from struct import pack, unpack
 from thread import allocate_lock
 
-from ZODB.utils import U64
+from ZODB.utils import u64
 
 import zLOG
 from ZEO.ICache import ICache
@@ -241,13 +241,13 @@
             if len(h) != 27:
                 self.log("invalidate: short record for oid %16x "
                          "at position %d in cache file %d"
-                         % (U64(oid), ap, p < 0))
+                         % (u64(oid), ap, p < 0))
                 del self._index[oid]
                 return None
             if h[:8] != oid:
                 self.log("invalidate: oid mismatch: expected %16x read %16x "
                          "at position %d in cache file %d"
-                         % (U64(oid), U64(h[:8]), ap, p < 0))
+                         % (u64(oid), u64(h[:8]), ap, p < 0))
                 del self._index[oid]
                 return None
             f.seek(ap+8) # Switch from reading to writing
@@ -282,7 +282,7 @@
             if tlen <= 0 or vlen < 0 or dlen < 0 or vlen+dlen > tlen:
                 self.log("load: bad record for oid %16x "
                          "at position %d in cache file %d"
-                         % (U64(oid), ap, p < 0))
+                         % (u64(oid), ap, p < 0))
                 del self._index[oid]
                 return None
 
@@ -453,7 +453,7 @@
             if tlen <= 0 or vlen < 0 or dlen < 0 or vlen+dlen > tlen:
                 self.log("modifiedInVersion: bad record for oid %16x "
                          "at position %d in cache file %d"
-                         % (U64(oid), ap, p < 0))
+                         % (u64(oid), ap, p < 0))
                 del self._index[oid]
                 return None
 


=== Zope3/lib/python/ZEO/stats.py 1.1 => 1.2 ===
--- Zope3/lib/python/ZEO/stats.py:1.1	Fri Nov 22 16:24:53 2002
+++ Zope3/lib/python/ZEO/stats.py	Mon Nov 25 14:54:50 2002
@@ -211,8 +211,8 @@
                     time.ctime(ts)[4:-5],
                     current,
                     code,
-                    U64(oid),
-                    U64(serial),
+                    u64(oid),
+                    u64(serial),
                     version,
                     dlen and str(dlen) or "")
             if code & 0x70 == 0x20:
@@ -352,9 +352,9 @@
     L.sort()
     return L
 
-def U64(s):
-    h, v = struct.unpack(">II", s)
-    return (long(h) << 32) + v
+def u64(v):
+    """Unpack an 8-byte string into a 64-bit long integer."""
+    return struct.unpack(">Q", v)[0]
 
 def addcommas(n):
     sign, s = '', str(n)