freezer.storage.base module

class freezer.storage.base.Backup(engine, hostname_backup_name, level_zero_timestamp, timestamp, level, storage=None)

Bases: object

Internal freezer representation of backup. Includes:

  • name (hostname_backup_name) of backup

  • timestamp of backup (when it was executed)

  • level of backup (freezer supports incremental backup): Completed full backup has level 0 and can be restored without any additional information. Levels 1, 2, … means that our backup is incremental and contains only smart portion of information (that was actually changed since the last backup)

copy(storage)
Returns

engine_metadata()
get_increments()

Gets all incremental backups based on a level-zero backup with timestamp :rtype: dict[int, freezer.storage.base.Backup] :return: Dictionary[backup_level, backup]

metadata()
remove()
class freezer.storage.base.Storage(skip_prepare=False)

Bases: object

Any freezer storage implementation should be inherited from this abstract class.

abstract create_dirs(path)
abstract get_file(from_path, to_path)
get_latest_level_zero_increments(engine, hostname_backup_name, recent_to_date=None)

Returns the latest zero level backup with increments :param engine: :param hostname_backup_name: :param recent_to_date: :rtype: dict[int, freezer.storage.base.Backup] :return: Dictionary[backup_level, backup]

abstract get_level_zero(engine, hostname_backup_name, recent_to_date=None)

Gets backups by backup_name and hostname :type engine: freezer.engine.engine.BackupEngine :param hostname_backup_name: :type hostname_backup_name: str :type recent_to_date: int :param recent_to_date: :rtype: collections.Iterable[freezer.storage.base.Backup] :return: dictionary of level zero timestamps with attached storage

abstract info()
abstract prepare()

Creates directories, containers :return: nothing

previous_backup(engine, hostname_backup_name, no_incremental, max_level, always_level, restart_always_level)
Parameters
  • engine (freezer.engine.engine.BackupEngine) – engine instance

  • hostname_backup_name – name of backup

  • no_incremental

  • max_level

  • always_level

  • restart_always_level

Returns

abstract put_file(from_path, to_path)
Parameters
  • from_path (str) –

  • to_path (str) –

abstract put_metadata(engine_metadata_path, freezer_metadata_path, backup)
Parameters
Returns

remove_older_than(engine, remove_older_timestamp, hostname_backup_name)

Removes backups which are older than or equal to the specified timestamp :type engine: freezer.engine.engine.BackupEngine :type remove_older_timestamp: int :type hostname_backup_name: str

property type
abstract write_backup(rich_queue, backup)
Parameters
Returns