b.s.m.SmartMedium(object) : class documentation

Part of bzrlib.smart.medium View In Hierarchy

Known subclasses: bzrlib.smart.medium.SmartClientMedium, bzrlib.smart.medium.SmartServerStreamMedium

Base class for smart protocol media, both client- and server-side.
Method __init__ Undocumented
Method read_bytes Read some bytes from this medium.
Method _push_back Return unused bytes to the medium, because they belong to the next
Method _get_push_back_buffer Undocumented
Method _read_bytes Undocumented
Method _get_line Read bytes from this request's response until a newline byte.
Method _report_activity Notify that this medium has activity.
def __init__(self):
Undocumented
def _push_back(self, bytes):
Return unused bytes to the medium, because they belong to the next request(s).

This sets the _push_back_buffer to the given bytes.

def _get_push_back_buffer(self):
Undocumented
def read_bytes(self, desired_count):
Read some bytes from this medium.
Returnssome bytes, possibly more or less than the number requested in 'desired_count' depending on the medium.
def _read_bytes(self, count):
Undocumented
def _get_line(self):
Read bytes from this request's response until a newline byte.

This isn't particularly efficient, so should only be used when the expected size of the line is quite short.

Returnsa string of bytes ending in a newline (byte 0x0A).
def _report_activity(self, bytes, direction):
Notify that this medium has activity.

Implementations should call this from all methods that actually do IO. Be careful that it's not called twice, if one method is implemented on top of another.

ParametersbytesNumber of bytes read or written.
direction'read' or 'write' or None.
API Documentation for Bazaar, generated by pydoctor at 2019-10-20 00:34:54.