~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Aaron Bentley
  • Date: 2008-10-26 10:00:24 UTC
  • mfrom: (0.12.70 shelf-manager)
  • mto: This revision was merged to the branch mainline in revision 3823.
  • Revision ID: aaron@aaronbentley.com-20081026100024-08whjq5p54yah68r
Merge shelf-manager into shelf-ui

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        self._nodes = {}
140
140
        # Indicate it hasn't been built yet
141
141
        self._nodes_by_key = None
 
142
        self._optimize_for_size = False
142
143
 
143
144
    def add_node(self, key, value, references=()):
144
145
        """Add a node to the index.
276
277
                    length = _PAGE_SIZE
277
278
                    if internal_row.nodes == 0:
278
279
                        length -= _RESERVED_HEADER_BYTES # padded
279
 
                    internal_row.writer = chunk_writer.ChunkWriter(length, 0)
 
280
                    internal_row.writer = chunk_writer.ChunkWriter(length, 0,
 
281
                        optimize_for_size=self._optimize_for_size)
280
282
                    internal_row.writer.write(_INTERNAL_FLAG)
281
283
                    internal_row.writer.write(_INTERNAL_OFFSET +
282
284
                        str(rows[pos + 1].nodes) + "\n")
284
286
            length = _PAGE_SIZE
285
287
            if rows[-1].nodes == 0:
286
288
                length -= _RESERVED_HEADER_BYTES # padded
287
 
            rows[-1].writer = chunk_writer.ChunkWriter(length)
 
289
            rows[-1].writer = chunk_writer.ChunkWriter(length,
 
290
                optimize_for_size=self._optimize_for_size)
288
291
            rows[-1].writer.write(_LEAF_FLAG)
289
292
        if rows[-1].writer.write(line):
290
293
            # this key did not fit in the node:
313
316
                # This will be padded, hence the -100
314
317
                new_row.writer = chunk_writer.ChunkWriter(
315
318
                    _PAGE_SIZE - _RESERVED_HEADER_BYTES,
316
 
                    reserved_bytes)
 
319
                    reserved_bytes,
 
320
                    optimize_for_size=self._optimize_for_size)
317
321
                new_row.writer.write(_INTERNAL_FLAG)
318
322
                new_row.writer.write(_INTERNAL_OFFSET +
319
323
                    str(rows[1].nodes - 1) + "\n")