[Zope3-checkins] CVS: Zope3/src/zodb/storage - fsindex.py:1.2.4.1

Jeremy Hylton jeremy@zope.com
Thu, 23 Jan 2003 12:15:27 -0500


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

Modified Files:
      Tag: new-pickle-branch
	fsindex.py 
Log Message:
Add an __iter__() method to an fsIndex.


=== Zope3/src/zodb/storage/fsindex.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zodb/storage/fsindex.py:1.2	Wed Dec 25 09:12:19 2002
+++ Zope3/src/zodb/storage/fsindex.py	Thu Jan 23 12:15:25 2003
@@ -11,9 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Implement an OID to File-position (long integer) mapping
-"""
-#
+"""Implement an OID to File-position (long integer) mapping."""
+
 # To save space, we do two things:
 #
 #     1. We split the keys (OIDS) into 6-byte prefixes and 2-byte suffixes.
@@ -34,10 +33,11 @@
 # bytes back before using u64 to convert the data back to (long)
 # integers.
 
-from zodb.btrees._fsBTree import fsBTree as _fsBTree
-
+from __future__ import generators
 import struct
 
+from zodb.btrees._fsBTree import fsBTree as _fsBTree
+
 # convert between numbers and six-byte strings
 
 _t32 = 1L<< 32
@@ -104,6 +104,11 @@
 
     def clear(self):
         self._data.clear()
+
+    def __iter__(self):
+        for prefix, tree in self._data.items():
+            for suffix in tree:
+                yield prefix + suffix
 
     def keys(self):
         r = []