[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.60.4.2.8.2

Jeremy Hylton jeremy@zope.com
Mon, 3 Dec 2001 16:15:20 -0500


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv11787/ZODB

Modified Files:
      Tag: BTreeFSIndex-branch
	FileStorage.py 
Log Message:
Two small changes related to fsIndex.

Put the import-failed logic for fsIndex in FileStorage rather than in
fsIndex.  The indention is easier here.

Use fsIndexes for the pindex and nvindex during a pack.  Each of these
can get fairly large, so it makes sense to use the more efficient
representation. 



=== StandaloneZODB/ZODB/FileStorage.py 1.60.4.2.8.1 => 1.60.4.2.8.2 ===
 import ConflictResolution
 
-from fsIndex import fsIndex
+try:
+    from fsIndex import fsIndex
+except ImportError:
+    def fsIndex():
+        return {}
 
 try: from posix import fsync
 except: fsync=None
@@ -333,7 +337,8 @@
         self._index_get=index.get
         self._vindex_get=vindex.get
 
-    def __len__(self): return len(self._index)
+    def __len__(self):
+        return len(self._index)
 
     def _newIndexes(self):
         return fsIndex(), {}, {}, {}
@@ -1246,7 +1251,7 @@
     
             rootl=[z64]
             pop=rootl.pop
-            pindex={}
+            pindex=fsIndex()
             referenced=pindex.has_key
             _load=self._load
             _loada=self._loada
@@ -1276,7 +1281,7 @@
     
             # Index for non-version data.  This is a temporary structure
             # to reduce I/O during packing
-            nvindex={}
+            nvindex=fsIndex()
     
             # Cache a bunch of methods
             seek=file.seek