AutoArchive._application.archiving._archiver_manipulator

ArchiverManipulator and its helper classes.

Modules

archiver_manipulator

ArchiverManipulator class.

class AutoArchive._application.archiving._archiver_manipulator.archiver_manipulator.ArchiverManipulator(backupInformationProvider, componentUi, storage, serviceAccessor)[source]

Bases: object

Performs actions with backups.

Uses _TarArchiverProviderBase-like services to manipulate with or create backups.

Note

backupInformationProvider is not updated by this class.

Parameters:
  • backupInformationProvider – Represents the archive that this instance shall be manipulating with.
  • componentUi (CmdlineUi) – Access to user interface.
  • storage (FileStorage) – Application storage.
  • serviceAccessor (ServiceAccessor) – Access to services.
Raises RuntimeError:
 

If the archiver service could not be created.

createBackup()[source]

Runs the archiver and creates a backup.

Returns:

Path to the created backup.

Return type:

str

Raises:
  • RuntimeError – If the backup operation was aborted due to a fatal error.
  • OSError – If a system error occurred while making the backup.
isOptionSupported(option)[source]

Returns True if the passed option is supported by the current configuration of this instance.

Whether an option is supported or not depends on the archiver type set in the archive specification file that is currently attached.

Parameters:option (Option) – The option which shall be tested for support.
Returns:True if the passed option is supported; False otherwise.
Return type:bool
saveBackupLevelInfo(backupFilePath)[source]

Saves all the information required for backup level restarting to the persistent storage.

Note

This method should be called only once after the backup was created.

Parameters:backupFilePath (str) – Path to the created backup.
static tryPurgeStoredArchiveData(archiveName, userConfigDir, storage, serviceAccessor)[source]

Deletes all data stored for the archive named archiveName if any.

See also: _BackupInformationProvider.getStoredArchiveNames()

Parameters:
  • archiveName (str) – Name of the archive which data shall be purged.
  • userConfigDir (str) – Path to the user configuration directory.
  • storage (IStorage) – The application storage.
  • serviceAccessor (IServiceAccessor) – Service accessor.
Returns:

True if data was purged; False otherwise.

Return type:

bool

Raises:
  • RuntimeError – If the archiver service could not be created.
  • OSError – If an error occurred during the operation of removing data from a physical storage.

_backup_keeping_manipulations

_BackupKeepingManipulations class.

class AutoArchive._application.archiving._archiver_manipulator._backup_keeping_manipulations._BackupKeepingManipulations(archiveSpec, componentUi, archiverService)[source]

Bases: object

Operations for keeping old backups.

Parameters:
  • archiveSpec (_ArchiveSpec) – Archive specification of the backup that this instance will operate on.
  • componentUi (CmdlineUi) – Component UI instance.
  • archiverService (_TarArchiverProviderBase) – Archiver service to use for operations with the backup.
keepOldBackups(backupDefinition)[source]

Keeps old backups according configuration settings.

Parameters:backupDefinition (BackupDefinition) – Provides information about backup which shall be kept. It has to be populated from the same _ArchiveSpec instance as passed to the constructor.
keepOldIncrementalBackups(backupDefinition, fromLevel)[source]

Keeps old incremental backups according configuration settings.

Parameters:backupDefinition (BackupDefinition) – Provides information about backup which shall be kept. It has to be populated from the same _ArchiveSpec instance as passed to the constructor.

_keeping_id_operations

_KeepingIdOperations class.

class AutoArchive._application.archiving._archiver_manipulator._keeping_id_operations._KeepingIdOperations[source]

Bases: object

classmethod getNextKeepingId(keepingId=None)[source]
classmethod intToKeepingId(number)[source]
classmethod keepingIdToInt(keepingId)[source]
maxKeepingIdAsInt = 675