Rev 5120: Add 'data_access' to the AggregateIndex and ensure the callbacks are propogated. in http://bazaar.launchpad.net/~jameinel/bzr/2.2.0b2-pack-collection

John Arbash Meinel john at arbash-meinel.com
Wed Jun 16 17:17:08 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.2.0b2-pack-collection

------------------------------------------------------------
revno: 5120
revision-id: john at arbash-meinel.com-20100616161659-s8luo9fm6h5x9c2v
parent: john at arbash-meinel.com-20100616160540-qdkfkn8hkfitg5f8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.2.0b2-pack-collection
timestamp: Wed 2010-06-16 11:16:59 -0500
message:
  Add 'data_access' to the AggregateIndex and ensure the callbacks are propogated.
-------------- next part --------------
=== modified file 'bzrlib/pack_collection.py'
--- a/bzrlib/pack_collection.py	2010-06-16 16:05:40 +0000
+++ b/bzrlib/pack_collection.py	2010-06-16 16:16:59 +0000
@@ -21,6 +21,7 @@
 
 from bzrlib import (
     index as _mod_index,
+    knit,
     errors,
     )
 
@@ -460,9 +461,9 @@
         self.index_to_pack_access = {}
         self.combined_index = _mod_index.CombinedGraphIndex([],
                                 reload_func=reload_func)
-        # self.data_access = _DirectPackAccess(self.index_to_pack_access,
-        #                                      reload_func=reload_func,
-        #                                      flush_func=flush_func)
+        self.data_access = knit._DirectPackAccess(self.index_to_pack_access,
+                                                  reload_func=reload_func,
+                                                  flush_func=flush_func)
         self.add_callback = None
 
     def add_index(self, index, pack):

=== modified file 'bzrlib/tests/test_pack_collection.py'
--- a/bzrlib/tests/test_pack_collection.py	2010-06-16 16:05:40 +0000
+++ b/bzrlib/tests/test_pack_collection.py	2010-06-16 16:16:59 +0000
@@ -423,6 +423,22 @@
         self.assertRaises(RuntimeError,
                           agg_index.add_writable_index, builder2, pack_obj)
 
+    def test_data_access(self):
+        def reload_func():
+            pass
+        def flush_func():
+            pass
+        agg_index = pack_collection.AggregateIndex(reload_func=reload_func,
+                                                   flush_func=flush_func)
+        index = btree_index.BTreeBuilder()
+        trans_obj = self.get_transport()
+        pack_obj = pack_collection.Pack(trans_obj, 'temp-name')
+        agg_index.add_index(index, pack_obj)
+        data_access = agg_index.data_access
+        self.assertIs(reload_func, data_access._reload_func)
+        self.assertIs(flush_func, data_access._flush_func)
+        
+
 
 class TestPackCollection(tests.TestCaseWithMemoryTransport):
 



More information about the bazaar-commits mailing list