Package duplicity :: Module diffdir
[hide private]
[frames] | no frames]

Module diffdir

source code

Functions for producing signatures and deltas of directories

Note that the main processes of this module have two parts. In the first, the signature or delta is constructed of a ROPath iterator. In the second, the ROPath iterator is put into tar block form.

Classes [hide private]
  DeltaTarBlockIter
TarBlockIter that yields parts of a deltatar file
  DiffDirException
  DummyBlockIter
TarBlockIter that does no file reading
  FileWithReadCounter
File-like object which also computes amount read as it is read
  FileWithSignature
File-like object which also computes signature as it is read
  SigTarBlockIter
TarBlockIter that yields blocks of a signature tar from path_iter
  TarBlock
Contain information to add next file to tar
  TarBlockIter
A bit like an iterator, yield tar blocks given input iterator
Functions [hide private]
 
DirDelta(path_iter, dirsig_fileobj_list)
Produce tarblock diff given dirsig_fileobj_list and pathiter
source code
 
DirDelta_WriteSig(path_iter, sig_infp_list, newsig_outfp)
Like DirDelta but also write signature into sig_fileobj
source code
 
DirFull(path_iter)
Return a tarblock full backup of items in path_iter
source code
 
DirFull_WriteSig(path_iter, sig_outfp)
Return full backup like above, but also write signature to sig_outfp
source code
 
DirSig(path_iter)
Alias for SigTarBlockIter below
source code
 
collate2iters(riter1, riter2)
Collate two iterators.
source code
 
combine_path_iters(path_iter_list)
Produce new iterator by combining the iterators in path_iter_list
source code
 
delta_iter_error_handler(exc, new_path, sig_path, sig_tar=None)
Called by get_delta_iter, report error in getting delta
source code
 
get_block_size(file_len)
Return a reasonable block size to use on files of length file_len
source code
 
get_combined_path_iter(sig_infp_list)
Return path iter combining signatures in list of open sig files
source code
 
get_delta_iter(new_iter, sig_iter, sig_fileobj=None)
Generate delta iter from new Path iter and sig Path iter.
source code
 
get_delta_path(new_path, sig_path, sigTarFile=None)
Return new delta_path which, when read, writes sig to sig_fileobj, if sigTarFile is not None
source code
 
log_delta_path(delta_path, new_path=None, stats=None)
Look at delta path and log delta.
source code
 
sigtar2path_iter(sigtarobj)
Convert signature tar file object open for reading into path iter
source code
 
write_block_iter(block_iter, out_obj)
Write block_iter to filename, path, or file object
source code
Variables [hide private]
  __package__ = 'duplicity'
  stats = None
hash(x)
Function Details [hide private]

DirDelta(path_iter, dirsig_fileobj_list)

source code 

Produce tarblock diff given dirsig_fileobj_list and pathiter

dirsig_fileobj_list should either be a tar fileobj or a list of those, sorted so the most recent is last.

DirDelta_WriteSig(path_iter, sig_infp_list, newsig_outfp)

source code 

Like DirDelta but also write signature into sig_fileobj

Like DirDelta, sig_infp_list can be a tar fileobj or a sorted list of those. A signature will only be written to newsig_outfp if it is different from (the combined) sig_infp_list.

DirFull(path_iter)

source code 

Return a tarblock full backup of items in path_iter

A full backup is just a diff starting from nothing (it may be less elegant than using a standard tar file, but we can be sure that it will be easy to split up the tar and make the volumes the same sizes).

collate2iters(riter1, riter2)

source code 

Collate two iterators.

The elements yielded by each iterator must be have an index variable, and this function returns pairs (elem1, elem2), (elem1, None), or (None, elem2) two elements in a pair will have the same index, and earlier indicies are yielded later than later indicies.

combine_path_iters(path_iter_list)

source code 

Produce new iterator by combining the iterators in path_iter_list

This new iter will iterate every path that is in path_iter_list in order of increasing index. If multiple iterators in path_iter_list yield paths with the same index, combine_path_iters will discard all paths but the one yielded by the last path_iter.

This is used to combine signature iters, as the output will be a full up-to-date signature iter.

get_block_size(file_len)

source code 

Return a reasonable block size to use on files of length file_len

If the block size is too big, deltas will be bigger than is necessary. If the block size is too small, making deltas and patching can take a really long time.

get_delta_iter(new_iter, sig_iter, sig_fileobj=None)

source code 

Generate delta iter from new Path iter and sig Path iter.

For each delta path of regular file type, path.difftype with be set to "snapshot", "diff". sig_iter will probably iterate ROPaths instead of Paths.

If sig_fileobj is not None, will also write signatures to sig_fileobj.

log_delta_path(delta_path, new_path=None, stats=None)

source code 

Look at delta path and log delta. Add stats if new_path is set