The freezer.storage.base Module

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

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)[source]
Returns:
get_increments()[source]

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()[source]
remove()[source]
class freezer.storage.base.Storage(skip_prepare=False)[source]

Bases: object

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

create_dirs(path)[source]
get_file(from_path, to_path)[source]
get_latest_level_zero_increments(engine, hostname_backup_name, recent_to_date=None)[source]

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]

get_level_zero(engine, hostname_backup_name, recent_to_date=None)[source]

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

info()[source]
prepare()[source]

Creates directories, containers :return: nothing

previous_backup(engine, hostname_backup_name, no_incremental, max_level, always_level, restart_always_level)[source]
Parameters:
  • engine (freezer.engine.engine.BackupEngine) – engine instance
  • hostname_backup_name – name of backup
  • no_incremental
  • max_level
  • always_level
  • restart_always_level
Returns:

put_file(from_path, to_path)[source]
Parameters:
  • from_path (str) –
  • to_path (str) –
put_metadata(engine_metadata_path, freezer_metadata_path, backup)[source]
Parameters:
Returns:

remove_older_than(engine, remove_older_timestamp, hostname_backup_name)[source]

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

type
write_backup(rich_queue, backup)[source]
Parameters:
Returns: