~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: Martin Pool
  • Date: 2008-10-27 08:02:47 UTC
  • mfrom: (3795 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3798.
  • Revision ID: mbp@sourcefrog.net-20081027080247-0al6nrx2v8u1dcci
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
        self._nodes = {}
85
85
        self._nodes_by_key = None
86
86
        self._key_length = key_elements
 
87
        self._optimize_for_size = False
87
88
 
88
89
    def _check_key(self, key):
89
90
        """Raise BadIndexKey if key is not a valid key for this index."""
278
279
                (len(result.getvalue()), expected_bytes))
279
280
        return result
280
281
 
 
282
    def set_optimize(self, for_size=True):
 
283
        """Change how the builder tries to optimize the result.
 
284
 
 
285
        :param for_size: Tell the builder to try and make the index as small as
 
286
            possible.
 
287
        :return: None
 
288
        """
 
289
        # GraphIndexBuilder itself doesn't pay attention to the flag yet, but
 
290
        # other builders do.
 
291
        self._optimize_for_size = for_size
 
292
 
281
293
 
282
294
class GraphIndex(object):
283
295
    """An index for data with embedded graphs.