AutoArchive._services.archiver

Archiver Service Component.

Provides services for creating the backup.

Modules

archiver_service_creator

ArchiverServiceProviders enum and ArchiverServiceCreator class.

class AutoArchive._services.archiver.archiver_service_creator.ArchiverServiceCreator[source]

Bases: object

Creator of archiver service instances.

classmethod destroyServices()[source]

Removes all existing archiver service instances.

Existing instances of all services will be forgotten. Subsequent request to getOrCreateArchiverService() will result in creation of a new instance.

classmethod getOrCreateArchiverService(archiverServiceProvider, workDir)[source]

Gets existing or creates the new archiver service instance.

See also: destroyServices().

Parameters:
  • archiverServiceProvider (ArchiverServiceProviders) – The requested service provider.
  • workDir (str) – Path to a directory which can be used to persistently store data.
Returns:

Instance of an archiver service.

Return type:

IArchiver

Raises:

RuntimeError – If creation of the service provider failed.

classmethod getSupportedBackupTypes(archiverServiceProvider)[source]

Returns a set of backup types supported by the given archiver service provider.

Parameters:archiverServiceProvider (ArchiverServiceProviders) – Service provider for which the backup types shall be returned.
Returns:Set of supported backup types.
Return type:set<BackupTypes>
classmethod getSupportedFeatures(archiverServiceProvider, backupType=None)[source]

Returns a set of features supported by the given archiver service provider.

Parameters:
  • archiverServiceProvider (ArchiverServiceProviders) – Service provider for which the backup types shall be returned.
  • backupType (BackupTypes) – The backup type for which the features shall be returned or None if all supported features shall be returned.
Returns:

Set of supported features.

Return type:

set<ArchiverFeatures>

Raises:

ValueError – If the given backupType is not supported by the archiverServiceProvider

_tar_archiver_provider_base

_TarArchiverProviderBase class.

class AutoArchive._services.archiver._tar_archiver_provider_base._TarArchiverProviderBase(workDir)[source]

Bases: AutoArchive._archiving.iarchiver.IArchiver

Base class for tar archiver service providers.

Abstract constructor of this class, should be called from derived constructors. It initializes the workDir_ property.

Parameters:workDir (str) – Path to a writable directory. The service will use it as persistent storage.
backupFiles(backupDefinition, compressionStrength=None)[source]

Performs basic checks before the backup creation.

Note

Derived classes should call this base method on the beginning of the overridden method.

See also: IArchiver.backupFiles().

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

Performs basic checks before the incremental backup creation.

Note

Derived classes should call this base method on the beginning of the overridden method.

See also: IArchiver.backupFilesIncrementally().

static getBackupFilePath_(backupId, backupType, destination, level=None)[source]

Assembles the backup file name and returns a path to it.

Parameters:
  • backupId (str) – ID of the backup for which the path shall be returned.
  • backupType (BackupTypes) – Type of the backup.
  • destination (str) – Path to the directory where the to the backup shall be created.
  • level (int) – Backup level.
Returns:

Path to the backup file.

Return type:

str

getMaxBackupLevel(backupId)[source]

See: IArchiver.getMaxBackupLevel().

getStoredBackupIds()[source]

See: IArchiver.getMaxBackupLevel().

classmethod getSupportedFeatures(backupType=None)[source]

See: IArchiver.getSupportedFeatures().

classmethod getWorkingPath_(properPath)[source]
purgeStoredBackupData(backupId)[source]

See: IArchiver.purgeStoredBackupData().

classmethod raiseIfUnsupportedBackupType_(backupType)[source]

Raises an exception if the passed backupType is not supported by the implementation.

See also: IArchiver.supportedBackupTypes.

Parameters:backupType (BackupTypes) – The backup type that shall be checked.
Raises:ValueError – If the passed backupType is not supported by the concrete implementation.
classmethod raiseIfUnsupportedFeature_(backupType, compressionStrength=None, level=None)[source]
removeBackup(backupDefinition)[source]

See: IArchiver.removeBackup().

removeBackupIncrements(backupDefinition, level=None)[source]

See: IArchiver.removeBackupIncrements().

backupOperationError = <AutoArchive._py_additions.event object>
fileAdd = <AutoArchive._py_additions.event object>
workDir_

Gets path to the working directory.

Return type:str

_external_tar_archiver_provider

_ExternalTarArchiverProvider class.

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

Bases: AutoArchive._services.archiver._tar_archiver_provider_base._TarArchiverProviderBase

External archiver service provider.

See also: _TarArchiverProviderBase.

Raises:OSError – If creation of the snapshot directory failed.
backupFiles(backupDefinition, compressionStrength=None)[source]

See: _TarArchiverProviderBase.backupFiles().

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

See: _TarArchiverProviderBase.backupFilesIncrementally().

getMaxBackupLevel(backupId)[source]

See: _TarArchiverProviderBase.getMaxBackupLevel().

getStoredBackupIds()[source]

See: _TarArchiverProviderBase.getStoredBackupIds().

classmethod getSupportedFeatures(backupType=None)[source]

See: _TarArchiverProviderBase.getSupportedFeatures().

purgeStoredBackupData(backupId)[source]

See: _TarArchiverProviderBase.purgeStoredBackupData().

removeBackupIncrements(backupDefinition, level=None)[source]

See: _TarArchiverProviderBase.removeBackupIncrements().

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

_internal_tar_archiver_provider

_InternalTarArchiverProvider class.

class AutoArchive._services.archiver._internal_tar_archiver_provider._InternalTarArchiverProvider(workDir)[source]

Bases: AutoArchive._services.archiver._tar_archiver_provider_base._TarArchiverProviderBase

Internal archiver service provider.

See also: _TarArchiverProviderBase.

backupFiles(backupDefinition, compressionStrength=None)[source]

See: _TarArchiverProviderBase.backupFiles().

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

See: _TarArchiverProviderBase.backupFilesIncrementally().

classmethod getSupportedFeatures(backupType=None)[source]

See: _TarArchiverProviderBase.getSupportedFeatures().

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