archive_rotator package¶
Submodules¶
archive_rotator.algorithms module¶
archive_rotator.algorithms¶
Rotation algorithms are defined here.
-
class
archive_rotator.algorithms.
HanoiRotator
(num_rotation_slots, verbose=False)[source]¶ Bases:
archive_rotator.algorithms.RotatorBase
Tower of Hanoi implementation. A backup slot is a power of two (1, 2, 4, 8, ...).
-
class
archive_rotator.algorithms.
SimpleRotator
(num_rotation_slots, verbose=False)[source]¶ Bases:
archive_rotator.algorithms.RotatorBase
FIFO implementation.
-
class
archive_rotator.algorithms.
TieredRotator
(tier_sizes, verbose=False)[source]¶ Bases:
archive_rotator.algorithms.RotatorBase
Tiered rotation schedule.
This is a generalization of the grandfather-father-son rotation algorithm.
archive_rotator.cli module¶
archive_rotator.rotator module¶
archive_rotator.rotator¶
File moving logic goes here.
-
class
archive_rotator.rotator.
Paths
(path, ext, destination_dir)[source]¶ Bases:
object
Holds configuration of paths. Computes the output path.
-
full_input_path
¶
-
output_path_no_ext
¶
-
-
archive_rotator.rotator.
rotate
(algorithm, path, ext='', destination_dir=None, verbose=False)[source]¶ Programmatic access to the archive rotator
Parameters: - algorithm – an instance of BaseRotator from algorithms.py
- path – full path to input file
- ext – (optional) file extension to preserve
- destination_dir – (optional) different location for output file
- verbose – (optional) print more to stdout
Returns: nothing