b.transport : package documentation

Part of bzrlib

Transport is an abstraction layer to handle file access.

The abstraction is to allow access from the local filesystem, as well as remote (such as http or sftp).

Transports are constructed from a string, being a URL or (as a degenerate case) a local filesystem path. This is typically the top directory of a bzrdir, repository, or similar object we are interested in working with. The Transport returned has methods to read, write and manipulate files within it.

Module brokenrename Transport implementation that doesn't detect clashing renames.
Module chroot Implementation of Transport that prevents access to locations above a set
Module decorator Implementation of Transport that decorates another transport.
Module fakenfs Transport implementation that adapts another transport to look like NFS.
Module fakevfat Fake transport with some restrictions of Windows VFAT filesystems.
Package ftp Implementation of Transport over ftp.
Module gio_transport Implementation of Transport over gio.
Package http Base implementation of Transport over http.
Module local Transport for the local filesystem.
Module log Transport decorator that logs transport operations to .bzr.log.
Module memory Implementation of Transport that uses memory for its storage.
Module nosmart Implementation of Transport that never has a smart medium.
Module pathfilter A transport decorator that filters all paths that are passed to it.
Module readonly Implementation of Transport that adapts another transport to be readonly.
Module remote RemoteTransport client for the smart-server.
Module sftp Implementation of Transport over SFTP, using paramiko.
Module ssh Foundation SSH support for SFTP and smart server.
Module trace Implementation of Transport that traces transport operations.
Module unlistable Transport implementation that disables listing to simulate HTTP cheaply.

From the __init__.py module:

Class AppendBasedFileStream A file stream object returned by open_write_stream.
Class ConnectedTransport A transport connected to a remote server.
Class FileFileStream A file stream object returned by open_write_stream.
Class FileStream Base class for FileStreams.
Class LateReadError A helper for transports which pretends to be a readable file.
Class Server A Transport Server.
Class Transport This class encapsulates methods for retrieving or putting a file
Class TransportListRegistry A registry which simplifies tracking available Transports.
Function do_catching_redirections Execute an action with given transport catching redirections.
Function get_transport Open a transport to access a URL or directory.
Function get_transport_from_path Open a transport for a local path.
Function get_transport_from_url Open a transport to access a URL.
Function location_to_url Determine a fully qualified URL from a location string.
Function register_lazy_transport Undocumented
Function register_transport Undocumented
Function register_transport_proto Undocumented
Function register_urlparse_netloc_protocol Ensure that protocol is setup to be used with urlparse netloc parsing.
Function unregister_transport Unregister a transport.
Class _CoalescedOffset A data container for keeping track of coalesced offsets.
Class _SharedConnection A connection shared between several transports.
Function _clear_protocol_handlers Undocumented
Function _get_protocol_handlers Return a dictionary of {urlprefix: [factory]}
Function _get_transport_modules Return a list of the modules providing transports.
Function _set_protocol_handlers Replace the current protocol handlers dictionary.
Function _try_transport_factories Undocumented
Function _unregister_urlparse_netloc_protocol Remove protocol from urlparse netloc parsing.
def _get_protocol_handlers():
Return a dictionary of {urlprefix: [factory]}
def _set_protocol_handlers(new_handlers):
Replace the current protocol handlers dictionary.

WARNING this will remove all build in protocols. Use with care.

def _clear_protocol_handlers():
Undocumented
def _get_transport_modules():
Return a list of the modules providing transports.
def register_transport_proto(prefix, help=None, info=None, register_netloc=False):
Undocumented
def register_lazy_transport(prefix, module, classname):
Undocumented
def register_transport(prefix, klass, override=DEPRECATED_PARAMETER):
Undocumented
def register_urlparse_netloc_protocol(protocol):
Ensure that protocol is setup to be used with urlparse netloc parsing.
def _unregister_urlparse_netloc_protocol(protocol):
Remove protocol from urlparse netloc parsing.

Except for tests, you should never use that function. Using it with 'http', for example, will break all http transports.

def unregister_transport(scheme, factory):
Unregister a transport.
def location_to_url(location):
Determine a fully qualified URL from a location string.

This will try to interpret location as both a URL and a directory path. It will also lookup the location in directories.

ParameterslocationUnicode or byte string object with a location
ReturnsByte string with resulting URL
RaisesInvalidURLIf the location is already a URL, but not valid.
def get_transport_from_path(path, possible_transports=None):
Open a transport for a local path.
ParameterspathLocal path as byte or unicode string
ReturnsTransport object for path
def get_transport_from_url(url, possible_transports=None):
Open a transport to access a URL.
Parametersbasea URL
transportsoptional reusable transports list. If not None, created transports will be added to the list.
ReturnsA new transport optionally sharing its connection with one of possible_transports.
def get_transport(base, possible_transports=None):
Open a transport to access a URL or directory.
Parametersbaseeither a URL or a directory name.
transportsoptional reusable transports list. If not None, created transports will be added to the list.
ReturnsA new transport optionally sharing its connection with one of possible_transports.
def _try_transport_factories(base, factory_list):
Undocumented
def do_catching_redirections(action, transport, redirected):
Execute an action with given transport catching redirections.

This is a facility provided for callers needing to follow redirections silently. The silence is relative: it is the caller responsability to inform the user about each redirection or only inform the user of a user via the exception parameter.

ParametersactionA callable, what the caller want to do while catching redirections.
transportThe initial transport used.
redirectedA callable receiving the redirected transport and the RedirectRequested exception.
ReturnsWhatever 'action' returns
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.