AutoArchive._services.archiver._external_tar_archiver_provider

Modules

external_tar_archiver_provider

class AutoArchive._services.archiver._external_tar_archiver_provider.external_tar_archiver_provider.ExternalTarArchiverProvider(workDir)[source]

Bases: TarArchiverProviderBase

External archiver service provider.

See also: TarArchiverProviderBase.

Raises:

OSError – If creation of the snapshot directory failed.

classmethod getSupportedFeatures(backupType=None)[source]

See: TarArchiverProviderBase.getSupportedFeatures().

backupFiles(backupDefinition, compressionStrength=None, overwriteAtStart=False)[source]

See: TarArchiverProviderBase.backupFiles().

backupFilesIncrementally(backupDefinition, compressionStrength=None, level=None, overwriteAtStart=False)[source]

See: TarArchiverProviderBase.backupFilesIncrementally().

doesAnyBackupLevelExist(backupDefinition, fromLevel=0, keepingId=None)[source]

See: TarArchiverProviderBase.doesAnyBackupLevelExist().

getMaxBackupLevel(backupId)[source]

See: TarArchiverProviderBase.getMaxBackupLevel().

getStoredBackupIds()[source]

See: TarArchiverProviderBase.getStoredBackupIds().

isBackupTypeAvailable_(backupType: Tar, TarGz, TarBz2, TarXz, TarZst) bool[source]

Returns True if passed backupType is available.

A backup type is available if it can be used for backup creation. Usually it means that all required dependencies are installed in the system.

purgeStoredBackupData(backupId)[source]

See: TarArchiverProviderBase.purgeStoredBackupData().

removeBackupIncrements(backupDefinition, level=None, keepingId=None)[source]

See: TarArchiverProviderBase.removeBackupIncrements().

supportedBackupTypes = frozenset({0, 1, 2, 3, 4})

_external_tar_incremental_utility

class AutoArchive._services.archiver._external_tar_archiver_provider._external_tar_incremental_utility._ExternalTarIncrementalUtility(backupId, workDir)[source]

Bases: object

Utility class for GNU tar incremental backup operations.

classmethod getSnapshotsDir(workDir)[source]
classmethod getSnapshotsForBackup(snapshotsDir, backupId='')[source]

Returns sequence of snapshot file names for the archive named backupId or all of them.

Parameters:
  • snapshotsDir (str) – Directory where the snapshot files are stored. Can be obtained with getSnapshotsDir() method.

  • backupId (str) – Name of the archive for which the snapshot file names shall be returned. If not specified all snapshot files will be returned.

Returns:

Sequence of snapshot file names.

Return type:

Sequence<str>

Raises:

OSError – If snapshotsDir does not exist or is not accessible. The exception contains two parameters: the error message and the name of the directory.

classmethod makeSnapshotsDir(workDir)[source]

Creates the snapshots directory.

Raises:

OSError – If creation of the directory was not successful.

static getLevelFromFileName(fileName, keptBackup=False)[source]

Extracts backup level number from the file name.

Parameters:

fileName (str) – Name of the file used to get the backup level from. It should be in the form: ‘<archive_name>[.<level>].<suffix>’.

Returns:

The backup level retrieved from the file name.

Return type:

int

createWorkingSnapshotFile(level)[source]

Copies snapshot file for level to a temporary file.

getMaxBackupLevel()[source]

Returns maximal backup level that is possible to create.

Raises:

OSError – If a system error occurred.

getSnapshotFileName(level, keepingId=None)[source]

Returns full path to snapshot file for a certain backup level.

getSnapshots()[source]

Returns sequence of snapshot file names for current backup.

manageSnapshotFiles(level, latestLevelSnapshotFilePath)[source]

Moves snapshot file to its proper location and name in order to preserve it and removes redundant ones.

Raises:

OSError – If a system error occurred.

removeSnapshotFiles(level)[source]

Remove snapshot files for levels higher or equal to level.

tryRemoveSnapshotFile(level, keepingId=None)[source]

Removes snapshot file for given backup level if it exists.

Parameters:
  • level (int) – Backup level for which the snapshot file shall be removed.

  • keepingId (str) – If not None a kept snapshot with this ID will be removed.

Returns:

True if the snapshot file was removed; False if the file does not exists.

Raises:

OSError – If a system error occurred.