/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-23 19:35:38 UTC
  • mto: This revision was merged to the branch mainline in revision 4187.
  • Revision ID: john@arbash-meinel.com-20090323193538-3d01aetz07jsyd3w
Add 'combine_backing_indices' as a flag for GraphIndex.set_optimize().

Update the Packer code so that it sets combine_backing_indices=False, as we know that
we won't be making extra queries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
        self._nodes_by_key = None
100
100
        self._key_length = key_elements
101
101
        self._optimize_for_size = False
 
102
        self._combine_backing_indices = True
102
103
 
103
104
    def _check_key(self, key):
104
105
        """Raise BadIndexKey if key is not a valid key for this index."""
315
316
                (len(result.getvalue()), expected_bytes))
316
317
        return result
317
318
 
318
 
    def set_optimize(self, for_size=True):
 
319
    def set_optimize(self, for_size=None, combine_backing_indices=None):
319
320
        """Change how the builder tries to optimize the result.
320
321
 
321
322
        :param for_size: Tell the builder to try and make the index as small as
322
323
            possible.
 
324
        :param combine_backing_indices: If the builder spills to disk to save
 
325
            memory, should the on-disk indices be combined. Set to True if you
 
326
            are going to be probing the index, but to False if you are not. (If
 
327
            you are not querying, then the time spent combining is wasted.)
323
328
        :return: None
324
329
        """
325
330
        # GraphIndexBuilder itself doesn't pay attention to the flag yet, but
326
331
        # other builders do.
327
 
        self._optimize_for_size = for_size
 
332
        if for_size is not None:
 
333
            self._optimize_for_size = for_size
 
334
        if combine_backing_indices is not None:
 
335
            self._combine_backing_indices = combine_backing_indices
328
336
 
329
337
 
330
338
class GraphIndex(object):