duplicity.dup_collections module
Classes and functions on collections of backup volumes
- class duplicity.dup_collections.BackupChain(backend)[source]
Bases:
object
BackupChain - a number of linked BackupSets
A BackupChain always starts with a full backup set and continues with incremental ones.
- class duplicity.dup_collections.BackupSet(backend, action)[source]
Bases:
object
Backup set - the backup information produced by one session
- add_filename(filename, pr=None)[source]
Add a filename to given set. Return true if it fits.
The filename will match the given set if it has the right times and is of the right type. The information will be set from the first filename given.
@param filename: name of file to add @type filename: string
@param pr: pre-computed result of file_naming.parse(filename) @type pr: Optional[ParseResults]
- class duplicity.dup_collections.CollectionsStatus(backend, archive_dir_path, action)[source]
Bases:
object
Hold information about available chains and sets
- get_backup_chain_at_time(time)[source]
Return backup chain covering specified time
Tries to find the backup chain covering the given time. If there is none, return the earliest chain before, and failing that, the earliest chain.
- get_backup_chains(filename_list)[source]
Split given filename_list into chains
Return value will be tuple (list of chains, list of sets, list of incomplete sets), where the list of sets will comprise sets not fitting into any chain, and the incomplete sets are sets missing files.
- get_chains_older_than(t)[source]
Returns a list of backup chains older than the given time t
All of the times will be associated with an intact chain. Furthermore, none of the times will be of a chain which a newer set may depend on. For instance, if set A is a full set older than t, and set B is an incremental based on A which is newer than t, then the time of set A will not be returned.
- get_extraneous()[source]
Return list of the names of extraneous duplicity files
A duplicity file is considered extraneous if it is recognizable as a duplicity file, but isn’t part of some complete backup set, or current signature chain.
- get_last_backup_chain()[source]
Return the last full backup of the collection, or None if there is no full backup chain.
- get_last_full_backup_time()[source]
Return the time of the last full backup, or 0 if there is none.
- get_nth_last_backup_chain(n)[source]
Return the nth-to-last full backup of the collection, or None if there is less than n backup chains.
NOTE: n = 1 -> time of latest available chain (n = 0 is not a valid input). Thus the second-to-last is obtained with n=2 rather than n=1.
- get_nth_last_full_backup_time(n)[source]
Return the time of the nth to last full backup, or 0 if there is none.
- get_older_than(t)[source]
Returns a list of backup sets older than the given time t
All of the times will be associated with an intact chain. Furthermore, none of the times will be of a set which a newer set may depend on. For instance, if set A is a full set older than t, and set B is an incremental based on A which is newer than t, then the time of set A will not be returned.
- get_older_than_required(t)[source]
Returns list of old backup sets required by new sets
This function is similar to the previous one, but it only returns the times of sets which are old but part of the chains where the newer end of the chain is newer than t.
- get_signature_chain_at_time(time)[source]
Return signature chain covering specified time
Tries to find the signature chain covering the given time. If there is none, return the earliest chain before, and failing that, the earliest chain.
- get_signature_chains(local, filelist=None)[source]
Find chains in archive_dir_path (if local is true) or backend
Use filelist if given, otherwise regenerate. Return value is pair (list of chains, list of signature paths not in any chains).
- get_signature_chains_older_than(t)[source]
Returns a list of signature chains older than the given time t
All of the times will be associated with an intact chain. Furthermore, none of the times will be of a chain which a newer set may depend on. For instance, if set A is a full set older than t, and set B is an incremental based on A which is newer than t, then the time of set A will not be returned.
- set_matched_chain_pair(sig_chains, backup_chains)[source]
Set self.matched_chain_pair and self.other_sig/backup_chains
The latest matched_chain_pair will be set. If there are both remote and local signature chains capable of matching the latest backup chain, use the local sig chain (it does not need to be downloaded).
- class duplicity.dup_collections.SignatureChain(local, location)[source]
Bases:
object
A number of linked SignatureSets
Analog to BackupChain - start with a full-sig, and continue with new-sigs.
- __init__(local, location)[source]
Return new SignatureChain.
local should be true iff the signature chain resides in config.archive_dir_path and false if the chain is in config.backend.
@param local: True if sig chain in config.archive_dir_path @type local: Boolean
@param location: Where the sig chain is located @type location: config.archive_dir_path or config.backend