Rev 5383: Expose the new leaf node factory across the stack. in http://bazaar.launchpad.net/~jameinel/bzr/2.3-btree-chk-leaf

John Arbash Meinel john at arbash-meinel.com
Wed Aug 4 17:33:33 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.3-btree-chk-leaf

------------------------------------------------------------
revno: 5383
revision-id: john at arbash-meinel.com-20100804163326-8were5mus16i815s
parent: john at arbash-meinel.com-20100804161316-5ch5e2sb02zlvgq4
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-btree-chk-leaf
timestamp: Wed 2010-08-04 11:33:26 -0500
message:
  Expose the new leaf node factory across the stack.
  
  This means creating something we can get to at the btree level
  and using it for the gcchk code.
-------------- next part --------------
=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py	2010-08-04 04:36:26 +0000
+++ b/bzrlib/btree_index.py	2010-08-04 16:33:26 +0000
@@ -684,7 +684,7 @@
         self._recommended_pages = self._compute_recommended_pages()
         self._root_node = None
         self._base_offset = offset
-        self._leaf_klass = _LeafNode
+        self._leaf_factory = _LeafNode
         # Default max size is 100,000 leave values
         self._leaf_value_cache = None # lru_cache.LRUCache(100*1000)
         if unlimited_cache:
@@ -1558,8 +1558,8 @@
                     continue
             bytes = zlib.decompress(data)
             if bytes.startswith(_LEAF_FLAG):
-                node = self._leaf_klass(bytes, self._key_length,
-                                        self.node_ref_lists)
+                node = self._leaf_factory(bytes, self._key_length,
+                                          self.node_ref_lists)
             elif bytes.startswith(_INTERNAL_FLAG):
                 node = _InternalNode(bytes)
             else:
@@ -1584,8 +1584,11 @@
             pass
 
 
+_gcchk_factory = _LeafNode
+
 try:
     from bzrlib import _btree_serializer_pyx as _btree_serializer
+    _gcchk_factory = _btree_serializer._parse_into_chk
 except ImportError, e:
     osutils.failed_to_load_extension(e)
     from bzrlib import _btree_serializer_py as _btree_serializer

=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py	2010-05-14 13:25:05 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py	2010-08-04 16:33:26 +0000
@@ -77,6 +77,7 @@
         # from brisbane-core
         if pack_collection.chk_index is not None:
             chk_index = index_builder_class(reference_lists=0)
+            chk_index._leaf_factory = btree_index._gcchk_factory
         else:
             chk_index = None
         Pack.__init__(self,

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2010-05-11 08:36:16 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2010-08-04 16:33:26 +0000
@@ -49,6 +49,7 @@
 """)
 from bzrlib import (
     bzrdir,
+    btree_index,
     errors,
     lockable_files,
     lockdir,
@@ -56,10 +57,6 @@
     )
 
 from bzrlib.decorators import needs_write_lock, only_raises
-from bzrlib.btree_index import (
-    BTreeGraphIndex,
-    BTreeBuilder,
-    )
 from bzrlib.index import (
     GraphIndex,
     InMemoryGraphIndex,
@@ -1681,6 +1678,7 @@
             sig_index = self._make_index(name, '.six')
             if self.chk_index is not None:
                 chk_index = self._make_index(name, '.cix', unlimited_cache=True)
+                chk_index._leaf_factory = btree_index._gcchk_factory
             else:
                 chk_index = None
             result = ExistingPack(self._pack_transport, name, rev_index,
@@ -2829,8 +2827,8 @@
     _commit_builder_class = PackCommitBuilder
     supports_external_lookups = True
     # What index classes to use
-    index_builder_class = BTreeBuilder
-    index_class = BTreeGraphIndex
+    index_builder_class = btree_index.BTreeBuilder
+    index_class = btree_index.BTreeGraphIndex
 
     @property
     def _serializer(self):
@@ -2865,8 +2863,8 @@
     supports_tree_reference = False # no subtrees
     supports_external_lookups = True
     # What index classes to use
-    index_builder_class = BTreeBuilder
-    index_class = BTreeGraphIndex
+    index_builder_class = btree_index.BTreeBuilder
+    index_class = btree_index.BTreeGraphIndex
 
     @property
     def _serializer(self):
@@ -2907,8 +2905,8 @@
     supports_tree_reference = True
     supports_external_lookups = True
     # What index classes to use
-    index_builder_class = BTreeBuilder
-    index_class = BTreeGraphIndex
+    index_builder_class = btree_index.BTreeBuilder
+    index_class = btree_index.BTreeGraphIndex
 
     @property
     def _serializer(self):



More information about the bazaar-commits mailing list