Class Backup::Model
In: lib/backup/model.rb
Parent: Object

Methods

Included Modules

Backup::CLI::Helpers

Attributes

archives  [R]  The archives attr_accessor holds an array of archive objects
compressor  [R]  Holds the configured Compressor
databases  [R]  The databases attribute holds an array of database objects
encryptor  [R]  Holds the configured Encryptor
label  [R]  The label (stored as a String) is used for a more friendly user output
notifiers  [R]  The notifiers attr_accessor holds an array of notifier objects
package  [R]  The final backup Package this model will create.
splitter  [R]  Holds the configured Splitter
storages  [R]  The storages attribute holds an array of storage objects
syncers  [R]  The syncers attribute holds an array of syncer objects
time  [R]  The time when the backup initiated (in format: 2011.02.20.03.29.59)
trigger  [R]  The trigger (stored as a String) is used as an identifier for initializing the backup process

Public Class methods

The Backup::Model.all class method keeps track of all the models that have been instantiated. It returns the @all class variable, which contains an array of all the models

Return the first model matching trigger. Raises Errors::MissingTriggerError if no matches are found.

Find and return an Array of all models matching trigger Used to match triggers using a wildcard (*)

Takes a trigger, label and the configuration block. After the instance has evaluated the configuration block to configure the model, it will be appended to Model.all

Public Instance methods

Adds an archive to the array of archives to store during the backup process

Adds a compressor to use during the backup process

Adds a database to the array of databases to dump during the backup process

Adds an encryptor to use during the backup process

Adds a notifier to the array of notifiers to use during the backup process

Performs the backup process

[Databases] Runs all (if any) database objects to dump the databases

[Archives] Runs all (if any) archive objects to package all their paths in to a single tar file and places it in the backup folder

[Packaging] After all the database dumps and archives are placed inside the folder, it‘ll make a single .tar package (archive) out of it

[Encryption] Optionally encrypts the packaged file with the configured encryptor

[Compression] Optionally compresses the each Archive and Database dump with the configured compressor

[Splitting] Optionally splits the backup file in to multiple smaller chunks before transferring them

[Storages] Runs all (if any) storage objects to store the backups to remote locations and (if configured) it‘ll cycle the files on the remote location to limit the amount of backups stored on each individual location

[Syncers] Runs all (if any) sync objects to store the backups to remote locations. A Syncer does not go through the process of packaging, compressing, encrypting backups. A Syncer directly transfers data from the filesystem to the remote location

[Notifiers] Runs all (if any) notifier objects when a backup proces finished with or without any errors.

[Cleaning] Once the final Packaging is complete, the temporary folder used will be removed. Then, once all Storages have run, the final packaged files will be removed. If any errors occur during the backup process, all temporary files will be left in place. If the error occurs before Packaging, then the temporary folder (tmp_path/trigger) will remain and may contain all or some of the configured Archives and/or Database dumps. If the error occurs after Packaging, but before the Storages complete, then the final packaged files (located in the root of tmp_path) will remain. *** Important *** If an error occurs and any of the above mentioned temporary files remain, those files *** will be removed *** before the next scheduled backup for the same trigger.

Ensure DATA_PATH and DATA_PATH/TRIGGER are created if they do not yet exist

Clean any temporary files and/or package files left over from the last time this model/trigger was performed. Logs warnings if files exist and are cleaned.

Adds a method that allows the user to configure this backup model to use a Splitter, with the given chunk_size The chunk_size (in megabytes) will later determine in how many chunks the backup needs to be split into

Adds a storage method to the array of storage methods to use during the backup process

Adds a syncer method to the array of syncer methods to use during the backup process

[Validate]