b.t.s._SFTPReadvHelper(object) : class documentation

Part of bzrlib.transport.sftp View In Hierarchy

A class to help with managing the state of a readv request.
Method __init__ Create a new readv helper.
Method request_and_yield_offsets Request the data from the remote machine, yielding the results.
Method _get_requests Break up the offsets into individual requests over sftp.
def __init__(self, original_offsets, relpath, _report_activity):
Create a new readv helper.
Parametersoriginal_offsetsThe original requests given by the caller of readv()
relpathThe name of the file (if known)
_report_activityA Transport._report_activity bound method, to be called as data arrives.
def _get_requests(self):
Break up the offsets into individual requests over sftp.

The SFTP spec only requires implementers to support 32kB requests. We could try something larger (openssh supports 64kB), but then we have to handle requests that fail. So instead, we just break up our maximum chunks into 32kB chunks, and asyncronously requests them. Newer versions of paramiko would do the chunking for us, but we want to start processing results right away, so we do it ourselves.

def request_and_yield_offsets(self, fp):
Request the data from the remote machine, yielding the results.
ParametersfpA Paramiko SFTPFile object that supports readv.
ReturnsYield the data requested by the original readv caller, one by one.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.