twindb_backup.status package


twindb_backup.status.base_status module

Base status is a class for a general purpose status.

class twindb_backup.status.base_status.BaseStatus(content=None, dst=None, status_directory=None)[source]

Bases: object

Base class for status. It can be instantiated either from a string with status content or from a destination instance. If the destination is given then the status will be read from a status file on the destination.

  • content (str) – if passed it will initialize a status from this string.
  • dst (BaseDestination) – Destination instance.
  • status_directory (str) – Relative path to a directory where the status file is stored. Usually, it’s a hostname where backup was taken from.

CorruptedStatus – If the content string is not a valid status or empty string.


Add entry to status.

Parameters:backup_copy (BaseCopy) – Instance of backup copy

Returns file name without a directory path where the status is stored in the destination.


Find the latest backup copy.

Returns:backup copy or None if status is empty.
Return type:BaseCopy
Returns:MD5 checksum of the status. It is calculated as a md5 of output of self._status_serialize().
Return type:str

Remove key from the status.

Parameters:key (str) – A copy key in the status.

Write status file to the destination.

Parameters:dst (BasicDestination) – Destination instance.

Return a string that represents current state


Return relative path where status is stored.

Returns:relative to the destination path where the status is stored.
Return type:str

Version of status file. Originally status file didn’t have any versions, but in future the version will be used to work with new features.

twindb_backup.status.exceptions module

Status exceptions

exception twindb_backup.status.exceptions.CorruptedStatus[source]

Bases: twindb_backup.status.exceptions.StatusError

Status file is corrupt

exception twindb_backup.status.exceptions.StatusError[source]

Bases: twindb_backup.exceptions.TwinDBBackupError

General status error

exception twindb_backup.status.exceptions.StatusKeyNotFound[source]

Bases: twindb_backup.status.exceptions.StatusError

Accessing a key that doesn’t exist

twindb_backup.status.mysql_status module

Class to store and work with status file

class twindb_backup.status.mysql_status.MySQLStatus(content=None, dst=None, status_directory=None)[source]

Bases: twindb_backup.status.periodic_status.PeriodicStatus

Class that stores status file and implements operations on it.


Find a backup copy that can be a parent

Parameters:run_type – See get_backup_type().
Returns:Backup copy or None
Return type:MySQLCopy

Check whether there is a full copy.

Parameters:run_type – See get_backup_type().
Returns:True if there is a full copy. False if there is no an eligible full copy.
Return type:bool
next_backup_type(full_backup, run_type)[source]

Return backup type to take. If full_backup=daily then for hourly backups it will be incremental, for all other - full

  • full_backup – when to take full backup according to config.
  • run_type – what kind of backup run it is.

“full” or “incremental”

Return type:


Module contents