Class: Madeleine::Recoverer
- Inherits:
-
Object
- Object
- Madeleine::Recoverer
- Defined in:
- lib/madeleine.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(directory_name, marshaller) ⇒ Recoverer
constructor
A new instance of Recoverer.
- #recover_logs(executer) ⇒ Object
- #recover_snapshot(new_system_block) ⇒ Object
Constructor Details
#initialize(directory_name, marshaller) ⇒ Recoverer
Returns a new instance of Recoverer.
207 208 209 |
# File 'lib/madeleine.rb', line 207 def initialize(directory_name, marshaller) @directory_name, @marshaller = directory_name, marshaller end |
Instance Method Details
#recover_logs(executer) ⇒ Object
225 226 227 228 229 230 231 232 233 |
# File 'lib/madeleine.rb', line 225 def recover_logs(executer) executer.recovery { CommandLog.log_file_names(@directory_name, FileService.new).each {|file_name| open(@directory_name + File::SEPARATOR + file_name, "rb") {|log| recover_log(executer, log) } } } end |
#recover_snapshot(new_system_block) ⇒ Object
211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/madeleine.rb', line 211 def recover_snapshot(new_system_block) system = nil id = SnapshotFile.highest_id(@directory_name) if id > 0 snapshot_file = SnapshotFile.new(@directory_name, id).name open(snapshot_file, "rb") {|snapshot| system = @marshaller.load(snapshot) } else system = new_system_block.call end system end |