Class: EY::Backup::Loader

Inherits:
Base
  • Object
show all
Includes:
Logging
Defined in:
lib/ey_backup/loader.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#logger

Constructor Details

#initialize(database, index) ⇒ Loader

Returns a new instance of Loader.



14
15
16
# File 'lib/ey_backup/loader.rb', line 14

def initialize(database, index)
  @database, @index = database, index
end

Class Method Details

.download(database, index) ⇒ Object



10
11
12
# File 'lib/ey_backup/loader.rb', line 10

def self.download(database, index)
  new(database, index).download
end

.run(database, index) ⇒ Object



6
7
8
# File 'lib/ey_backup/loader.rb', line 6

def self.run(database, index)
  new(database, index).run
end

Instance Method Details

#downloadObject



25
26
27
28
29
30
31
32
# File 'lib/ey_backup/loader.rb', line 25

def download
  FileUtils.mkdir_p(EY::Backup.tmp_dir)

  backup = BackupSet.download(@database, @index)
  backup.join!
  backup.remove_split_files!
  backup
end

#runObject



18
19
20
21
22
23
# File 'lib/ey_backup/loader.rb', line 18

def run
  info "Restoring #{@database.name}"
  backup = download
  backup.load!
  backup.remove_joined_file!
end