twindb_backup.cache package

Submodules

twindb_backup.cache.cache module

Backup copy cache

class twindb_backup.cache.cache.Cache(path)[source]

Bases: object

Class implements local cache to save full backup copies

add(path, key=None)[source]

Add directory to cache. The directory may be a full or relative path with backup copy. The directory name must match with a file name of the backup copy. If backup copy is /path/to/backups/master1/daily/mysql/mysql-2017-05-13_22_04_06.xbstream.gz. then the directory can be something like /var/tmp/mysql-2017-05-13_22_04_06.xbstream.gz/.

Let’s say we want to add /var/tmp/mysql-2017-05-13_22_04_06.xbstream.gz/ to the cache in /var/tmp/cache. Then this method will create directory /var/tmp/cache/mysql-2017-05-13_22_04_06.xbstream.gz/.

If you want to save directory /var/tmp/foo in cache under a key name mysql-2017-05-13_22_04_06.xbstream.gz you need to specify the key e.g. add('/var/tmp/cache', 'mysql-2017-05-13_22_04_06.xbstream.gz')

Parameters:
  • path (str) – full or relative path
  • key – if specified the directory will be added as this key name in the cache
Raise:

CacheException if errors

purge()[source]

Remove all entries from the cache

restore_in(item, path)[source]

Restore backup copy item in path.

Parameters:
  • item (str) – directory in the cache
  • path (str) – directory where to restore item
exception twindb_backup.cache.cache.CacheException[source]

Bases: exceptions.Exception

Cache errors

Module contents