b.s.medium : module documentation

Part of bzrlib.smart

The 'medium' layer for the smart servers and clients.

"Medium" here is the noun meaning "a means of transmission", not the adjective for "the quality between big and small."

Media carry the bytes of the requests somehow (e.g. via TCP, wrapped in HTTP, or over SSH), and pass them to and from the protocol logic. See the overview in bzrlib/transport/smart/__init__.py.

Class SmartMedium Base class for smart protocol media, both client- and server-side.
Class SmartServerStreamMedium Handles smart commands coming over a stream.
Class SmartServerSocketStreamMedium No class docstring; 3/9 methods documented
Class SmartServerPipeStreamMedium No class docstring; 3/8 methods documented
Class SmartClientMediumRequest A request on a SmartClientMedium.
Class SmartClientMedium Smart client is a medium for sending smart protocol requests over.
Class SmartClientStreamMedium Stream based medium common class.
Class SmartSimplePipesClientMedium A client medium using simple pipes.
Class SSHParams A set of parameters for starting a remote bzr via SSH.
Class SmartSSHClientMedium A client medium using SSH.
Class SmartClientSocketMedium A client medium using a socket.
Class SmartTCPClientMedium A client medium that creates a TCP connection.
Class SmartClientAlreadyConnectedSocketMedium A client medium for an already connected socket.
Class SmartClientStreamMediumRequest A SmartClientMediumRequest that works with an SmartClientStreamMedium.
Function _get_protocol_factory_for_bytes Determine the right protocol factory for 'bytes'.
Function _get_line Read bytes using read_bytes_func until a newline byte.
Class _VfsRefuser An object that refuses all VFS requests.
Class _DebugCounter An object that counts the HPSS calls made to each client medium.
def _get_protocol_factory_for_bytes(bytes):

Determine the right protocol factory for 'bytes'.

This will return an appropriate protocol factory depending on the version of the protocol being used, as determined by inspecting the given bytes. The bytes should have at least one newline byte (i.e. be a whole line), otherwise it's possible that a request will be incorrectly identified as version 1.

Typical use would be:

factory, unused_bytes = _get_protocol_factory_for_bytes(bytes)
server_protocol = factory(transport, write_func, root_client_path)
server_protocol.accept_bytes(unused_bytes)
Parametersbytesa str of bytes of the start of the request.
Returns2-tuple of (protocol_factory, unused_bytes). protocol_factory is a callable that takes three args: transport, write_func, root_client_path. unused_bytes are any bytes that were not part of a protocol version marker.
def _get_line(read_bytes_func):
Read bytes using read_bytes_func 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 tuple of two strs: (line, excess)
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.