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:
TarArchiverProviderBaseExternal archiver service provider.
See also:
TarArchiverProviderBase.- Raises:
OSError – If creation of the snapshot directory failed.
- backupFilesIncrementally(backupDefinition, compressionStrength=None, level=None, overwriteAtStart=False)[source]¶
- isBackupTypeAvailable_(backupType: Tar, TarGz, TarBz2, TarXz, TarZst) bool[source]¶
Returns
Trueif passedbackupTypeis 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.
- 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:
objectUtility class for GNU tar incremental backup operations.
- classmethod getSnapshotsForBackup(snapshotsDir, backupId='')[source]¶
Returns sequence of snapshot file names for the archive named
backupIdor all of them.- Parameters:
snapshotsDir (
str) – Directory where the snapshot files are stored. Can be obtained withgetSnapshotsDir()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
snapshotsDirdoes 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
- 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.
- 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.
- 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 notNonea kept snapshot with this ID will be removed.
- Returns:
Trueif the snapshot file was removed;Falseif the file does not exists.- Raises:
OSError – If a system error occurred.