class documentation

Variant of Protocol that allows reading up to a size without blocking.

This class has a recv() method that behaves like socket.recv() in addition to a read() method.

If you want to read n bytes from the wire and block until exactly n bytes (or EOF) are read, use read(n). If you want to read at most n bytes from the wire but don't care if you get less, use recv(n). Note that recv(n) will still block until at least one byte is read.

Method __init__ Initialize ReceivableProtocol.
Method read Read bytes from the socket.
Method recv Receive bytes from the socket with buffering.
Instance Variable _rbuf Undocumented
Instance Variable _rbufsize Undocumented
Instance Variable _recv Undocumented

Inherited from Protocol:

Method __del__ Ensure transport is closed when Protocol is garbage collected.
Method __enter__ Enter context manager.
Method __exit__ Exit context manager and close transport.
Method close Close the underlying transport if a close function was provided.
Method eof Test whether the protocol stream has reached EOF.
Method read_cmd Read a command and some arguments from the git client.
Method read_pkt_line Reads a pkt-line from the remote git process.
Method read_pkt_seq Read a sequence of pkt-lines from the remote git process.
Method send_cmd Send a command and some arguments to a git server.
Method unread_pkt_line Unread a single line of data into the readahead buffer.
Method write_pkt_line Sends a pkt-line to the remote git process.
Method write_sideband Write multiplexed data to the sideband.
Instance Variable report_activity Undocumented
Instance Variable write Undocumented
Instance Variable _close Undocumented
Instance Variable _readahead Undocumented
def __init__(self, recv: Callable[[int], bytes], write: Callable[[bytes], int | None], close: Callable[[], None] | None = None, report_activity: Callable[[int, str], None] | None = None, rbufsize: int = _RBUFSIZE):

Initialize ReceivableProtocol.

Parameters
recv:Callable[[int], bytes]Function to receive bytes from the transport
write:Callable[[bytes], int | None]Function to write bytes to the transport
close:Callable[[], None] | NoneOptional function to close the transport
report_activity:Callable[[int, str], None] | NoneOptional function to report activity
rbufsize:intRead buffer size
def read(self, size: int) -> bytes:

Read bytes from the socket.

Parameters
size:intNumber of bytes to read
Returns
bytesBytes read from socket
def recv(self, size: int) -> bytes:

Receive bytes from the socket with buffering.

Parameters
size:intMaximum number of bytes to receive
Returns
bytesBytes received from socket
_rbuf =

Undocumented

_rbufsize =

Undocumented

_recv =

Undocumented