Archiving component internal package.
ArchivingComponent class.
Bases: AutoArchive._mainf.icomponent.IComponent, AutoArchive._archiving.iarchiving.IArchiving
Provides an interface for working with archives.
During construction it registers itself as IArchiving component interface to interfaceAccessor.
Several methods of this class requires an archive specification file as the input parameter (usually named specFile). This file should contain all information required to create the backup. Its format is defined by the standard configparser module. It has to contain section [Content] and may contain section [Archive]. The [Content] section requires following options to be present: path, include-files and exclude-files. Optionally, name can be present. Options in the archive specification file has higher priority than those in the configuration.
See: IArchiving.getArchiveInfo()
Warning
This method utilizes the user configuration directory so the option Options.USER_CONFIG_DIR has to point to an existing directory.
See: IArchiving.getStoredArchiveInfo().
Warning
This method utilizes the user configuration directory so the option Options.USER_CONFIG_DIR has to point to an existing directory.
See: IArchiving.getStoredArchiveNames().
Warning
This method utilizes the user configuration directory so the option Options.USER_CONFIG_DIR has to point to an existing directory.
Creates the backup based on specFile.
The result can be a file with a full backup or an incremental backup of some particular level. This depends on the archive specification file (specFile), the configuration (IAppConfig), previous operations with the specFile and the time. Some of the properties of ArchiveInfo returned by the method getArchiveInfo() can be used to determine what the result will be. The path and name of the created file will be assembled as follows: “<Options.DEST_DIR>/<archive_name>[.<backup_level>].<archiver_specific_extension>”.
Method uses IComponentUi interface to report errors, warnings et al. to the user.
Warning
This method utilizes the user configuration directory so the option Options.USER_CONFIG_DIR has to point to an existing directory.
See also: IArchiving.makeBackup().
See: IArchiving.purgeStoredArchiveData().
Warning
This method utilizes the user configuration directory so the option Options.USER_CONFIG_DIR has to point to an existing directory.
See: IComponent.run().
_ArchiverManipulator class.
Bases: builtins.object
Performs actions with backups.
Uses IArchiver services to manipulate with or create backups.
Note
backupInformationProvider is not updated by this class.
Parameters: |
|
---|---|
Raises RuntimeError: | |
If the archiver service could not be created. |
Runs the archiver and creates a backup.
Returns: | Path to the created backup. |
---|---|
Return type: | str |
Raises: |
|
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 |
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. |
---|
Deletes all data stored for the archive named archiveName if any.
See also: _BackupInformationProvider.getStoredArchiveNames()
Parameters: |
|
---|---|
Returns: | True if data was purged; False otherwise. |
Return type: | bool |
Raises: |
|
_BackupInformationProvider class.
Bases: builtins.object
Provides information about backups.
Parameters: |
|
---|---|
Raises: |
|
Returns current backup level for the passed archiveName.
Parameters: |
|
---|---|
Returns: | Current backup level for archiveName or None |
Return type: | int |
Raises: |
|
Reads the last full restart date from the persistent storage and returns it.
Returns: | Date of the last full backup level restart. |
---|---|
Return type: | datetime.date |
Reads the last restart date from the persistent storage and returns it.
Returns: | Date of the last backup level restart. |
---|---|
Return type: | datetime.date |
Reads the date of a backup level restart from storage and returns it.
Parameters: |
|
---|---|
Returns: | A backup level restart date. |
Return type: | datetime.date |
Returns iterable of archive names which has some data stored in a persistent storage.
Persistent storages from which archive names are retrieved are specific to the concrete archiver service. A typical storage used by archivers is the application storage (IStorage).
Parameters: |
|
---|---|
Returns: | Set of archive names. |
Return type: | set<str> |
Raises RuntimeError: | |
If the archiver service could not be created. |
Gets the archive specification that corresponds to the backup about which this instance provides information.
Return type: | _ArchiveSpec |
---|
Gets the backup level that would be created if the backup creation was triggered.
Return type: | int |
---|
Gets a backup level to which a next restart would be done.
Return type: | int |
---|
_ArchiverMaps and _RestartStorageVariables classes.
Bases: builtins.object
Mappings which involves archiver types.
Bases: builtins.object
Names of storage variables for backup level restarting.
_ArchiveSpec class.
Bases: AutoArchive._configuration.configuration_base.ConfigurationBase
The archive specification.
Contains all information needed to create the backup such as the name, list of files which shall be included into the backup, list of files to exclude, etc. These values can be configured in the archive specification file (specFile) or in the general configuration such as command line or configuration files. Options that can be read from this class are defined as static attributes of _ArchiveSpecOptions and Options. If an option is not defined in the archive specification file it is read from configuration.
The instance is fully populated during construction.
Parameters: |
|
---|---|
Raises: |
|
Bases: builtins.object
Constants for options used specifically in the archive specification file.
These constants should be used to access options in _ArchiveSpec.
Note
It is not allowed to change values of these constants.
Files and directories that will be excluded from the backup (frozenset<str>). Note that frozenset<str> is not supported by OptionsUtils.strToOptionType(); it is not used while populating this option. Guaranteed to be defined.
Files and directories that will be included in the backup (frozenset<str>). Note that frozenset<str> is not supported by OptionsUtils.strToOptionType(); it is not used while populating this option. Guaranteed to be defined.
Archive name (str). Guaranteed to be defined.
Path to the base directory for INCLUDE_FILES, EXCLUDE_FILES (SpecialOptionTypes.PATH). Guaranteed to be defined.