Package duplicity :: Module backend :: Class Backend
[hide private]
[frames] | no frames]

Class Backend

source code

Represents a generic duplicity backend, capable of storing and retrieving files.

Concrete sub-classes are expected to implement:

Optional:

Instance Methods [hide private]
 
__init__(self, parsed_url) source code
 
put(self, source_path, remote_filename=None)
Transfer source_path (Path object) to remote_filename (string)
source code
 
move(self, source_path, remote_filename=None)
Move source_path (Path object) to remote_filename (string)
source code
 
get(self, remote_filename, local_path)
Retrieve remote_filename and place in local_path
source code
 
list(self)
Return list of filenames (strings) present in backend
source code
 
delete(self, filename_list)
Delete each filename in filename_list, in order if possible.
source code
 
query_info(self, filename_list, raise_errors=True)
Return metadata about each filename in filename_list
source code
 
get_password(self)
Return a password for authentication purposes.
source code
 
munge_password(self, commandline)
Remove password from commandline by substituting the password found in the URL, if any, with a generic place-holder.
source code
 
run_command(self, commandline) source code
 
run_command_persist(self, commandline) source code
 
popen(self, commandline) source code
 
popen_persist(self, commandline) source code
 
_subprocess_popen(self, commandline)
For internal use.
source code
 
subprocess_popen(self, commandline)
Execute the given command line with error check.
source code
 
subprocess_popen_persist(self, commandline)
Execute the given command line with error check.
source code
 
get_fileobj_read(self, filename, parseresults=None)
Return fileobject opened for reading of filename on backend
source code
 
get_fileobj_write(self, filename, parseresults=None, sizelist=None)
Return fileobj opened for writing, which will cause the file to be written to the backend on close().
source code
 
get_data(self, filename, parseresults=None)
Retrieve a file from backend, process it, return contents.
source code
 
put_data(self, buffer, filename, parseresults=None)
Put buffer into filename on backend after processing.
source code
 
close(self)
Close the backend, releasing any resources held and invalidating any file objects obtained from the backend.
source code
Class Variables [hide private]
  use_getpass = True
  popen_persist_breaks = {}
Method Details [hide private]

put(self, source_path, remote_filename=None)

source code 

Transfer source_path (Path object) to remote_filename (string)

If remote_filename is None, get the filename from the last path component of pathname.

move(self, source_path, remote_filename=None)

source code 

Move source_path (Path object) to remote_filename (string)

Same as put(), but unlinks source_path in the process. This allows the local backend to do this more efficiently using rename.

get_password(self)

source code 

Return a password for authentication purposes. The password will be obtained from the backend URL, the environment, by asking the user, or by some other method. When applicable, the result will be cached for future invocations.

munge_password(self, commandline)

source code 

Remove password from commandline by substituting the password found in the URL, if any, with a generic place-holder.

This is intended for display purposes only, and it is not guaranteed that the results are correct (i.e., more than just the ':password@' may be substituted.

_subprocess_popen(self, commandline)

source code 

For internal use. Execute the given command line, interpreted as a shell command. Returns int Exitcode, string StdOut, string StdErr

subprocess_popen(self, commandline)

source code 

Execute the given command line with error check. Returns int Exitcode, string StdOut, string StdErr

Raise a BackendException on failure.

subprocess_popen_persist(self, commandline)

source code 

Execute the given command line with error check. Retries globals.num_retries times with 30s delay. Returns int Exitcode, string StdOut, string StdErr

Raise a BackendException on failure.

get_fileobj_read(self, filename, parseresults=None)

source code 

Return fileobject opened for reading of filename on backend

The file will be downloaded first into a temp file. When the returned fileobj is closed, the temp file will be deleted.

get_fileobj_write(self, filename, parseresults=None, sizelist=None)

source code 

Return fileobj opened for writing, which will cause the file to be written to the backend on close().

The file will be encoded as specified in parseresults (or as read from the filename), and stored in a temp file until it can be copied over and deleted.

If sizelist is not None, it should be set to an empty list. The number of bytes will be inserted into the list.