~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-25 21:13:22 UTC
  • mto: This revision was merged to the branch mainline in revision 4051.
  • Revision ID: john@arbash-meinel.com-20090225211322-qc94czk3s1g7nliq
Some direct tests for _group_keys_for_io

Show diffs side-by-side

added added

removed removed

Lines of Context:
1256
1256
                prefix_order.append(prefix)
1257
1257
        return split_by_prefix, prefix_order
1258
1258
 
1259
 
    def _group_keys_for_io(self, keys, non_local_keys, positions):
 
1259
    def _group_keys_for_io(self, keys, non_local_keys, positions,
 
1260
                           _min_buffer_size=_STREAM_MIN_BUFFER_SIZE):
1260
1261
        """For the given keys, group them into 'best-sized' requests.
1261
1262
 
1262
1263
        The idea is to avoid making 1 request per file, but to never try to
1264
1265
        possible, we should try to group requests to the same pack file
1265
1266
        together.
1266
1267
 
1267
 
        :return: yield (keys, non_local) tuples that indicate what keys should
1268
 
            be fetched next.
 
1268
        :return: list of (keys, non_local) tuples that indicate what keys
 
1269
            should be fetched next.
1269
1270
        """
1270
1271
        # TODO: Ideally we would group on 2 factors. We want to extract texts
1271
1272
        #       from the same pack file together, and we want to extract all
1287
1288
            cur_size += this_size
1288
1289
            cur_keys.extend(keys)
1289
1290
            cur_non_local.update(non_local)
1290
 
            if cur_size > _STREAM_MIN_BUFFER_SIZE:
 
1291
            if cur_size > _min_buffer_size:
1291
1292
                result.append((cur_keys, cur_non_local))
1292
1293
                sizes.append(cur_size)
1293
1294
                cur_keys = []