Class: Backup::Storage::Base

Inherits:
Object
  • Object
show all
Includes:
Configuration::Helpers
Defined in:
lib/backup/storage/base.rb

Direct Known Subclasses

CloudFiles, Dropbox, FTP, Local, Ninefold, RSync, S3, SCP, SFTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configuration::Helpers

#clear_defaults!, #load_defaults!

Constructor Details

#initialize(model, storage_id = nil) ⇒ Base

Creates a new instance of the storage object

  • Called with super(model, storage_id) from each subclass



23
24
25
26
27
# File 'lib/backup/storage/base.rb', line 23

def initialize(model, storage_id = nil)
  load_defaults!
  @model = model
  @storage_id = storage_id
end

Instance Attribute Details

#keepObject

Sets the limit to how many backups to keep in the remote location. If exceeded, the oldest will be removed to make room for the newest



11
12
13
# File 'lib/backup/storage/base.rb', line 11

def keep
  @keep
end

#storage_idObject

(Optional) User-defined string used to uniquely identify multiple storages of the same type. This will be appended to the YAML storage file used for cycling backups.



18
19
20
# File 'lib/backup/storage/base.rb', line 18

def storage_id
  @storage_id
end

Instance Method Details

#perform!Object

Performs the backup transfer



31
32
33
34
35
36
37
38
39
# File 'lib/backup/storage/base.rb', line 31

def perform!
  @package = @model.package
  @checksum_creator = @model.checksum_creator
  if @checksum_creator
    @checksum_creator.process_checksum_file_before_transfer(file_names_as_hash, @package.checksum_name, local_path)
  end
  transfer!
  cycle!
end