~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/pack.py

  • Committer: Martin Pool
  • Date: 2009-07-01 06:15:35 UTC
  • mto: This revision was merged to the branch mainline in revision 4502.
  • Revision ID: mbp@sourcefrog.net-20090701061535-cqboo3s50xqbuubz
Clearer documentation and variable name in ReadVFile

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
159
159
 
160
160
 
161
161
class ReadVFile(object):
162
 
    """Adapt a readv result iterator to a file like protocol."""
 
162
    """Adapt a readv result iterator to a file like protocol.
 
163
    
 
164
    The readv result must support the iterator protocol returning (offset,
 
165
    data_bytes) pairs.
 
166
    """
 
167
 
 
168
    # XXX: This could be a generic transport class, as other code may want to
 
169
    # gradually consume the readv result.
163
170
 
164
171
    def __init__(self, readv_result):
165
172
        self.readv_result = readv_result
169
176
    def _next(self):
170
177
        if (self._string is None or
171
178
            self._string.tell() == self._string_length):
172
 
            length, data = self.readv_result.next()
 
179
            offset, data = self.readv_result.next()
173
180
            self._string_length = len(data)
174
181
            self._string = StringIO(data)
175
182