Rev 3811: refactor for clarity. in http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/remote_readv_sections
John Arbash Meinel
john at arbash-meinel.com
Wed Oct 29 19:24:15 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/remote_readv_sections
------------------------------------------------------------
revno: 3811
revision-id: john at arbash-meinel.com-20081029192401-uaawypax2idzlxnl
parent: john at arbash-meinel.com-20081029192344-inemp5hyyi61n39h
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: remote_readv_sections
timestamp: Wed 2008-10-29 14:24:01 -0500
message:
refactor for clarity.
-------------- next part --------------
=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py 2008-10-28 19:39:57 +0000
+++ b/bzrlib/btree_index.py 2008-10-29 19:24:01 +0000
@@ -848,17 +848,21 @@
"""
return self._get_nodes(self._internal_node_cache, node_indexes)
- def _get_leaf_nodes(self, node_indexes):
- """Get a bunch of nodes, from cache or disk."""
- found = self._get_nodes(self._leaf_node_cache, node_indexes)
+ def _cache_leaf_values(self, nodes):
+ """Cache directly from key => value, skipping the btree."""
if self._leaf_value_cache is not None:
- for node in found.itervalues():
+ for node in nodes.itervalues():
for key, value in node.keys.iteritems():
if key in self._leaf_value_cache:
# Don't add the rest of the keys, we've seen this node
# before.
break
self._leaf_value_cache[key] = value
+
+ def _get_leaf_nodes(self, node_indexes):
+ """Get a bunch of nodes, from cache or disk."""
+ found = self._get_nodes(self._leaf_node_cache, node_indexes)
+ self._cache_leaf_values(found)
return found
def iter_all_entries(self):
More information about the bazaar-commits
mailing list