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, ...).

id_to_slot(rotation_id)[source]
class archive_rotator.algorithms.RotatorBase[source]

Bases: object

Rotator interface.

id_to_slot(rotation_id)[source]

Given a backup id, assign a rotation slot.

class archive_rotator.algorithms.SimpleRotator(num_rotation_slots, verbose=False)[source]

Bases: archive_rotator.algorithms.RotatorBase

FIFO implementation.

id_to_slot(rotation_id)[source]
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.

id_to_slot(rotation_id)[source]

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
full_output_path(next_rotation_id)[source]
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

Module contents