b.t.t.TransportTraceDecorator(decorator.TransportDecorator) : class documentation

Part of bzrlib.transport.trace View In Hierarchy

A tracing decorator for Transports.

Calls that potentially perform IO are logged to self._activity. The _activity attribute is shared as the transport is cloned, but not if a new transport is created without cloning.

Not all operations are logged at this point, if you need an unlogged operation please add a test to the tests of this transport, for the logging of the operation you want logged.

See also TransportLogDecorator, that records a machine-readable log in memory for eg testing.

Method __init__ Set the 'base' path where files will be stored.
Method append_file See Transport.append_file().
Method append_bytes See Transport.append_bytes().
Method delete See Transport.delete().
Method delete_tree See Transport.delete_tree().
Method get See Transport.get().
Method get_smart_client Undocumented
Method has See Transport.has().
Method is_readonly See Transport.is_readonly.
Method mkdir See Transport.mkdir().
Method open_write_stream See Transport.open_write_stream.
Method put_file See Transport.put_file().
Method put_bytes See Transport.put_bytes().
Method put_bytes_non_atomic See Transport.put_bytes_non_atomic.
Method listable See Transport.listable.
Method iter_files_recursive See Transport.iter_files_recursive().
Method list_dir See Transport.list_dir().
Method readv Get parts of the file at the given relative path.
Method recommended_page_size See Transport.recommended_page_size().
Method rename Rename a file or directory.
Method rmdir See Transport.rmdir.
Method stat See Transport.stat().
Method lock_read See Transport.lock_read.
Method lock_write See Transport.lock_write.
Class Method _get_url_prefix Tracing transports are identified by 'trace+'
Method _trace Record that a transport operation occured.

Inherited from TransportDecorator:

Method abspath See Transport.abspath().
Method clone See Transport.clone().
Method external_url See bzrlib.transport.Transport.external_url.
Method _can_roundtrip_unix_modebits See Transport._can_roundtrip_unix_modebits().
Method _readv See Transport._readv.
Method _get_segment_parameters Undocumented
Method _set_segment_parameters Undocumented
Method _redirected_to Returns a transport suitable to re-issue a redirected request.

Inherited from Transport (via TransportDecorator):

Method create_prefix Create all the directories leading down to self.base.
Method ensure_base Ensure that the directory this transport references exists.
Method get_segment_parameters Return the segment parameters for the top segment of the URL.
Method relpath Return the local path portion from a given absolute path.
Method local_abspath Return the absolute path on the local filesystem.
Method has_multi Return True/False for each entry in relpaths
Method has_any Return True if any of the paths exist.
Method get_bytes Get a raw string of the bytes for a file at the given location.
Method get_smart_medium Return a smart client medium for this transport if possible.
Method get_multi Get a list of file-like objects, one for each entry in relpaths.
Method put_file_non_atomic Copy the file-like object into the target location.
Method mkdir_multi Create a group of directories
Method append_multi Append the text in each file-like or string object to
Method copy Copy the item at rel_from to the location at rel_to.
Method copy_multi Copy a bunch of entries.
Method copy_to Copy a set of entries from self into another Transport.
Method copy_tree Copy a subtree from one relpath to another.
Method copy_tree_to_transport Copy a subtree from one transport to another.
Method move Move the item at rel_from to the location at rel_to.
Method move_multi Move a bunch of entries.
Method move_multi_to Move a bunch of entries to a single location.
Method delete_multi Queue up a bunch of deletes to be done.
Method __repr__ Undocumented
Method stat_multi Stat multiple files and return the information.
Method readlink Return a string representing the path to which the symbolic link points.
Method hardlink Create a hardlink pointing to source named link_name.
Method symlink Create a symlink pointing to source named link_name.
Method disconnect Undocumented
Method _translate_error Translate an IOError or OSError into an appropriate bzr error.
Method _pump Most children will need to copy from one file-like
Method _get_total Try to figure out how many entries are in multi,
Method _report_activity Notify that this transport has activity.
Method _update_pb Update the progress bar based on the current count
Method _iterate_over Iterate over all entries in multi, passing them to func,
Method _seek_and_read An implementation of readv that uses fp.seek and fp.read.
Method _sort_expand_and_combine Helper for readv.
Static Method _coalesce_offsets Yield coalesced offsets.
Method _reuse_for Undocumented
def __init__(self, url, _decorated=None, _from_transport=None):
Set the 'base' path where files will be stored.

_decorated is a private parameter for cloning.

def append_file(self, relpath, f, mode=None):
See Transport.append_file().
def append_bytes(self, relpath, bytes, mode=None):
See Transport.append_bytes().
def delete(self, relpath):
See Transport.delete().
def delete_tree(self, relpath):
See Transport.delete_tree().
def _get_url_prefix(self):
Tracing transports are identified by 'trace+'
def get(self, relpath):
See Transport.get().
def get_smart_client(self):
def has(self, relpath):
See Transport.has().
def is_readonly(self):
See Transport.is_readonly.
def mkdir(self, relpath, mode=None):
See Transport.mkdir().
def open_write_stream(self, relpath, mode=None):
See Transport.open_write_stream.
def put_file(self, relpath, f, mode=None):
See Transport.put_file().
def put_bytes(self, relpath, bytes, mode=None):
See Transport.put_bytes().
def put_bytes_non_atomic(self, relpath, bytes, mode=None, create_parent_dir=False, dir_mode=None):
See Transport.put_bytes_non_atomic.
def listable(self):
See Transport.listable.
def iter_files_recursive(self):
See Transport.iter_files_recursive().
def list_dir(self, relpath):
See Transport.list_dir().
def readv(self, relpath, offsets, adjust_for_latency=False, upper_limit=None):
Get parts of the file at the given relative path.
ParametersrelpathThe path to read data from.
offsetsA list of (offset, size) tuples.
adjust_for_latencyAdjust the requested offsets to accomodate transport latency. This may re-order the offsets, expand them to grab adjacent data when there is likely a high cost to requesting data relative to delivering it.
upper_limitWhen adjust_for_latency is True setting upper_limit allows the caller to tell the transport about the length of the file, so that requests are not issued for ranges beyond the end of the file. This matters because some servers and/or transports error in such a case rather than just satisfying the available ranges. upper_limit should always be provided when adjust_for_latency is True, and should be the size of the file in bytes.
ReturnsA list or generator of (offset, data) tuples
def recommended_page_size(self):
See Transport.recommended_page_size().
def rename(self, rel_from, rel_to):
Rename a file or directory.

This must fail if the destination is a nonempty directory - it must not automatically remove it. It should raise DirectoryNotEmpty, or some other PathError if the case can't be specifically detected.

If the destination is an empty directory or a file this function may either fail or succeed, depending on the underlying transport. It should not attempt to remove the destination if overwriting is not the native transport behaviour. If at all possible the transport should ensure that the rename either completes or not, without leaving the destination deleted and the new file not moved in place.

This is intended mainly for use in implementing LockDir.

def rmdir(self, relpath):
See Transport.rmdir.
def stat(self, relpath):
See Transport.stat().
def lock_read(self, relpath):
See Transport.lock_read.
def lock_write(self, relpath):
See Transport.lock_write.
def _trace(self, operation_tuple):
Record that a transport operation occured.
ParametersoperationTuple of transport call name and arguments.
API Documentation for Bazaar, generated by pydoctor at 2022-01-22 00:20:18.