Class: StateRecorder

Inherits:
Object
  • Object
show all
Defined in:
lib/backup/state_recorder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStateRecorder

Returns a new instance of StateRecorder.



8
9
10
11
# File 'lib/backup/state_recorder.rb', line 8

def initialize
  @sons_since_last_promotion     = 0
  @fathers_since_last_promotion  = 0
end

Instance Attribute Details

#fathers_since_last_promotionObject

Returns the value of attribute fathers_since_last_promotion.



5
6
7
# File 'lib/backup/state_recorder.rb', line 5

def fathers_since_last_promotion
  @fathers_since_last_promotion
end

#saved_state_folderObject

Returns the value of attribute saved_state_folder.



6
7
8
# File 'lib/backup/state_recorder.rb', line 6

def saved_state_folder
  @saved_state_folder
end

#sons_since_last_promotionObject

Returns the value of attribute sons_since_last_promotion.



4
5
6
# File 'lib/backup/state_recorder.rb', line 4

def sons_since_last_promotion
  @sons_since_last_promotion
end

Instance Method Details

#cleanup_snapshotsObject

cleanup all the snapshots created by madeline



14
15
16
17
18
19
20
# File 'lib/backup/state_recorder.rb', line 14

def cleanup_snapshots
  files = Dir[saved_state_folder + "/*.snapshot"] 
  files.pop
  files.sort.each do |f|
    FileUtils.rm(f, :verbose => false)
  end
end