Package duplicity :: Module lazy :: Class IterTreeReducer
[hide private]
[frames] | no frames]

Class IterTreeReducer

source code

Tree style reducer object for iterator - stolen from rdiff-backup

The indicies of a RORPIter form a tree type structure. This class can be used on each element of an iter in sequence and the result will be as if the corresponding tree was reduced. This tries to bridge the gap between the tree nature of directories, and the iterator nature of the connection between hosts and the temporal order in which the files are processed.

This will usually be used by subclassing ITRBranch below and then call the initializer below with the new class.

Instance Methods [hide private]
 
Finish(self)
Call at end of sequence to tie everything up
source code
 
__call__(self, *args)
Process args, where args[0] is current position in iterator
source code
 
__init__(self, branch_class, branch_args)
ITR initializer
source code
 
add_branch(self)
Return branch of type self.branch_class, add to branch list
source code
 
finish_branches(self, index)
Run Finish() on all branches index has passed
source code
 
process_w_branch(self, index, branch, args)
Run start_process on latest branch
source code
Method Details [hide private]

__call__(self, *args)
(Call operator)

source code 

Process args, where args[0] is current position in iterator

Returns true if args successfully processed, false if index is not in the current tree and thus the final result is available.

Also note below we set self.index after doing the necessary start processing, in case there is a crash in the middle.

finish_branches(self, index)

source code 

Run Finish() on all branches index has passed

When we pass out of a branch, delete it and process it with the parent. The innermost branches will be the last in the list. Return None if we are out of the entire tree, and 1 otherwise.