Part of bzrlib.transport.sftp View In Hierarchy
Method | disconnect | Disconnect the transport. |
Method | has | Does the target location exist? |
Method | get | Get the file at the given relative path. |
Method | get_bytes | Get a raw string of the bytes for a file at the given location. |
Method | recommended_page_size | See Transport.recommended_page_size(). |
Method | put_file | Copy the file-like object into the location. |
Method | put_file_non_atomic | Copy the file-like object into the target location. |
Method | put_bytes_non_atomic | Copy the string into the target location. |
Method | iter_files_recursive | Walk the relative paths of all files in this transport. |
Method | mkdir | Create a directory at the given path. |
Method | open_write_stream | See Transport.open_write_stream. |
Method | append_file | Append the text in the file-like object into the final |
Method | rename | Rename without special overwriting |
Method | move | Move the item at rel_from to the location at rel_to |
Method | delete | Delete the item at relpath |
Method | external_url | See bzrlib.transport.Transport.external_url. |
Method | listable | Return True if this store supports listing. |
Method | list_dir | Return a list of all files at the given location. |
Method | rmdir | See Transport.rmdir. |
Method | stat | Return the stat information for a file. |
Method | readlink | See Transport.readlink. |
Method | symlink | See Transport.symlink. |
Method | lock_read | Lock the given file for shared (read) access. |
Method | lock_write | Lock the given file for exclusive (write) access. |
Method | _remote_path | Return the path to be passed along the sftp protocol for relpath. |
Method | _create_connection | Create a new connection with the provided credentials. |
Method | _get_sftp | Ensures that a connection is established |
Method | _readv | See Transport.readv() |
Method | _sftp_readv | Use the readv() member of fp to do async readv. |
Method | _put | Helper function so both put() and copy_abspaths can reuse the code |
Method | _put_non_atomic_helper | Undocumented |
Method | _mkdir | Undocumented |
Method | _translate_io_exception | Translate a paramiko or IOError into a friendlier exception. |
Method | _rename_and_overwrite | Do a fancy rename on the remote server. |
Method | _sftp_open_exclusive | Open a remote path exclusively. |
Method | _can_roundtrip_unix_modebits | Return true if this transport can store and retrieve unix modebits. |
Inherited from ConnectedTransport:
Method | __init__ | Constructor. |
Method | clone | Return a new transport with root at self.base + offset |
Method | relpath | Return the local path portion from a given absolute path |
Method | abspath | Return the full url to the given relative path. |
Method | _user | Undocumented |
Method | _password | Undocumented |
Method | _host | Undocumented |
Method | _port | Undocumented |
Method | _path | Undocumented |
Method | _scheme | Undocumented |
Static Method | _split_url | Undocumented |
Static Method | _unsplit_url | Build the full URL for the given already URL encoded path. |
Method | _get_shared_connection | Get the object shared amongst cloned transports. |
Method | _set_connection | Record a newly created connection with its associated credentials. |
Method | _get_connection | Returns the transport specific connection object. |
Method | _get_credentials | Returns the credentials used to establish the connection. |
Method | _update_credentials | Update the credentials of the current connection. |
Method | _reuse_for | Returns a transport sharing the same connection if possible. |
Inherited from Transport (via ConnectedTransport):
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 | 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_smart_medium | Return a smart client medium for this transport if possible. |
Method | readv | Get parts of the file at the given relative path. |
Method | get_multi | Get a list of file-like objects, one for each entry in relpaths. |
Method | put_bytes | Atomically put the supplied bytes into the given location. |
Method | mkdir_multi | Create a group of directories |
Method | append_bytes | Append bytes to a file at relpath. |
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_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 | delete_tree | Delete an entire tree. This may require a listable transport. |
Method | __repr__ | Undocumented |
Method | stat_multi | Stat multiple files and return the information. |
Method | hardlink | Create a hardlink pointing to source named link_name. |
Method | is_readonly | Return true if this connection cannot be written to. |
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 | _redirected_to | Returns a transport suitable to re-issue a redirected request. |
Parameters | relpath | is a urlencoded string. |
The credentials are only the password as it may have been entered interactively by the user and may be different from the one provided in base url at transport creation time.
Parameters | credentials | The credentials needed to establish the connection. |
Returns | The created connection and its associated credentials. |
If and when required the transport willl reconnect automatically.
Parameters | relpath | The relative path to the file |
Parameters | relpath | The relative path to the file |
For SFTP we suggest a large page size to reduce the overhead introduced by latency.
Then read them using paramiko.readv(). paramiko.readv() does not support ranges > 64K, so it caps the request size, and just reads until it gets all the stuff it wants.
Parameters | relpath | Location to put the contents, relative to base. |
f | File-like object. | |
mode | The final mode for the file |
This function is not strictly safe to use. It is only meant to be used when you already know that the target does not exist. It is not safe, because it will open and truncate the remote file. So there may be a time when the file has invalid contents.
Parameters | relpath | The remote location to put the contents. |
f | File-like object. | |
mode | Possible access permissions for new file. None means do not set remote permissions. | |
create_parent_dir | If we cannot create the target file because the parent directory does not exist, go ahead and create it, and then try again. |
This function is not strictly safe to use. See Transport.put_bytes_non_atomic for more information.
Parameters | relpath | The remote location to put the contents. |
bytes | A string object containing the raw bytes to write into the target file. | |
mode | Possible access permissions for new file. None means do not set remote permissions. | |
create_parent_dir | If we cannot create the target file because the parent directory does not exist, go ahead and create it, and then try again. | |
dir_mode | Possible access permissions for new directories. |
Parameters | e | The original exception |
path | The path in question when the error is raised | |
more_info | Extra information that can be included, such as what was going on | |
failure_exc | Paramiko has the super fun ability to raise completely opaque errors that just set "e.args = ('Failure',)" with no more information. If this parameter is set, it defines the exception to raise in these cases. |
Using the implementation provided by osutils.
Returns | A lock object, which has an unlock() member function |
SFTP supports O_EXCL (SFTP_FLAG_EXCL), which fails if the file already exists. However it does not expose this at the higher level of SFTPClient.open(), so we have to sneak away with it.
WARNING: This breaks the SFTPClient abstraction, so it could easily break against an updated version of paramiko.
Parameters | abspath | The remote absolute path where the file should be opened |
mode | The mode permissions bits for the new file |
(For example, 0700 to make a directory owner-private.)
Note: most callers will not want to switch on this, but should rather just try and set permissions and let them be either stored or not. This is intended mainly for the use of the test suite.
Warning: this is not guaranteed to be accurate as sometimes we can't be sure: for example with vfat mounted on unix, or a windows sftp server.