AutoArchive._application.archiving._archiver_manipulator — AutoArchive Developer Manual (ver. 2.0.6)

# AutoArchive._application.archiving._archiver_manipulator

`ArchiverManipulator` and its helper classes.

## Modules

### archiver_manipulator

class AutoArchive._application.archiving._archiver_manipulator.archiver_manipulator.ArchiverManipulator(backupInformationProvider, componentUi, storage, serviceAccessor: ServiceAccessor)

  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.

  static tryPurgeStoredArchiveData(archiveName, storage, serviceAccessor)

    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.

      - 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.

  createBackup()

    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)

    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)

    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.

### _backup_keeping_manipulations

`_BackupKeepingManipulations` class.

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

  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)

    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)

    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

  Bases: `object`

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