CedarBackup2.extend.split

Package CedarBackup2 :: Package extend :: Module split |
[hide private]
[frames] | no frames]

# Module split

source code

Provides an extension to split up large files in staging directories.

When this extension is executed, it will look through the configured Cedar Backup staging directory for files exceeding a specified size limit, and split them down into smaller files using the 'split' utility. Any directory which has already been split (as indicated by the `cback.split` file) will be ignored.

This extension requires a new configuration section <split> and is intended to be run immediately after the standard stage action or immediately before the standard store action. Aside from its own configuration, it requires the options and staging configuration sections in the standard Cedar Backup configuration file.

Author: Kenneth J. Pronovici <pronovic@ieee.org>

Classes | [hide private]
| SplitConfig Class representing split configuration.
| LocalConfig Class representing this extension's configuration document.

Functions | [hide private]
executeAction(configPath, options, config) Executes the split backup action. | source code
_splitDailyDir(dailyDir, sizeLimit, splitSize, backupUser, backupGroup) Splits large files in a daily staging directory. | source code
_splitFile(sourcePath, splitSize, backupUser, backupGroup, removeSource=False) Splits the source file into chunks of the indicated size. | source code

Variables | [hide private]
| logger = `logging.getLogger("CedarBackup2.log.extend.split")`
| SPLIT_COMMAND = ``[``'``split``'``]``
| SPLIT_INDICATOR = ``'``cback.split``'``
| __package__ = ``'``CedarBackup2.extend``'``

Function Details | [hide private]

### executeAction(configPath, options, config) | source code
Executes the split backup action. Parameters: `configPath` (String representing a path on disk.) - Path to configuration file on disk. `options` (Options object.) - Program command-line options. `config` (Config object.) - Program configuration. Raises: `ValueError` - Under many generic error conditions `IOError` - If there are I/O problems reading or writing files

### _splitDailyDir(dailyDir, sizeLimit, splitSize, backupUser, backupGroup) | source code
Splits large files in a daily staging directory. Files that match INDICATOR_PATTERNS (i.e. `"cback.store"`, `"cback.stage"`, etc.) are assumed to be indicator files and are ignored. All other files are split. Parameters: `dailyDir` - Daily directory to encrypt `sizeLimit` - Size limit, in bytes `splitSize` - Split size, in bytes `backupUser` - User that target files should be owned by `backupGroup` - Group that target files should be owned by Raises: `ValueError` - If the encrypt mode is not supported. `ValueError` - If the daily staging directory does not exist.

### _splitFile(sourcePath, splitSize, backupUser, backupGroup, removeSource=False) | source code
Splits the source file into chunks of the indicated size. The split files will be owned by the indicated backup user and group. If `removeSource` is `True`, then the source file will be removed after it is successfully split. Parameters: `sourcePath` - Absolute path of the source file to split `splitSize` - Encryption mode (only "gpg" is allowed) `backupUser` - User that target files should be owned by `backupGroup` - Group that target files should be owned by `removeSource` - Indicates whether to remove the source file Raises: `IOError` - If there is a problem accessing, splitting or removing the source file.