[Zodb-checkins] CVS: ZODB4/src/zodb/storage - base.py:1.13.4.3

Barry Warsaw barry@wooz.org
Wed, 12 Mar 2003 12:26:06 -0500


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

Modified Files:
      Tag: opaque-pickles-branch
	base.py 
Log Message:
referents -> references

splitrefs(): This should always return a list.


=== ZODB4/src/zodb/storage/base.py 1.13.4.2 => 1.13.4.3 ===
--- ZODB4/src/zodb/storage/base.py:1.13.4.2	Mon Mar 10 14:33:23 2003
+++ ZODB4/src/zodb/storage/base.py	Wed Mar 12 12:26:05 2003
@@ -342,12 +342,16 @@
 
 # A couple of convenience methods
 def splitrefs(refstr, oidlen=8):
+    # refstr is a packed string of reference oids.  Always return a list of
+    # oid strings.  Most storages use fixed oid lengths of 8 bytes, but if
+    # the oids in refstr are a different size, use oidlen to specify.  This
+    # does /not/ support variable length oids in refstr.
     if not refstr:
         return []
     num, extra = divmod(len(refstr), oidlen)
     fmt = '%ds' % oidlen
     assert extra == 0, refstr
-    return struct.unpack('>' + (fmt * num), refstr)
+    return list(struct.unpack('>' + (fmt * num), refstr))
 
 
 
@@ -507,7 +511,7 @@
         self._serials = self._setupDB('serials', db.DB_DUP)
         self._pickles = self._setupDB('pickles')
         self._refcounts = self._setupDB('refcounts')
-        self._referents = self._setupDB('referents')
+        self._references = self._setupDB('references')
         self._oids = self._setupDB('oids')
         self._pending = self._setupDB('pending')
         self._packmark = self._setupDB('packmark')
@@ -708,8 +712,8 @@
         os.unlink(lockfile)
 
     # A couple of convenience methods
-    def _update(self, deltas, referents, incdec):
-        for oid in splitrefs(referents):
+    def _update(self, deltas, references, incdec):
+        for oid in splitrefs(references):
             rc = deltas.get(oid, 0) + incdec
             if rc == 0:
                 # Save space in the dict by zapping zeroes