Class: Snapshoter::Volume

Inherits:
Object
  • Object
show all
Defined in:
lib/snapshoter/volume.rb

Constant Summary collapse

ValidFrequencies =
[:hourly, :daily, :weekly]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(volume_id, options = {}) ⇒ Volume

Returns a new instance of Volume.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/snapshoter/volume.rb', line 18

def initialize(volume_id, options={})
  options = options.symbolize_keys
  
  @id = volume_id
  @mount_point = options.delete(:mount_point)
  @freeze_xfs = options.delete(:freeze_xfs) || false
  @frequency = options.delete(:frequency) || 'daily'
  @freeze_mysql = options.delete(:freeze_mysql) || false
  @mysql_user = options.delete(:mysql_user) || 'root'
  @mysql_password = options.delete(:mysql_password)
  @mysql_port = options.delete(:mysql_port) 
  @mysql_sock = options.delete(:mysql_sock) 
  @keep = options.delete(:keep) || 7
  
  @frequency = @frequency.to_sym
  
  validate!(options)
end

Instance Attribute Details

#freeze_mysqlObject (readonly)

Returns the value of attribute freeze_mysql.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def freeze_mysql
  @freeze_mysql
end

#freeze_xfsObject (readonly)

Returns the value of attribute freeze_xfs.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def freeze_xfs
  @freeze_xfs
end

#frequencyObject (readonly)

Returns the value of attribute frequency.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def frequency
  @frequency
end

#idObject (readonly)

Returns the value of attribute id.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def id
  @id
end

#keepObject (readonly)

Returns the value of attribute keep.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def keep
  @keep
end

#mount_pointObject (readonly)

Returns the value of attribute mount_point.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def mount_point
  @mount_point
end

#mysql_passwordObject (readonly)

Returns the value of attribute mysql_password.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def mysql_password
  @mysql_password
end

#mysql_portObject (readonly)

Returns the value of attribute mysql_port.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def mysql_port
  @mysql_port
end

#mysql_sockObject (readonly)

Returns the value of attribute mysql_sock.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def mysql_sock
  @mysql_sock
end

#mysql_userObject (readonly)

Returns the value of attribute mysql_user.



16
17
18
# File 'lib/snapshoter/volume.rb', line 16

def mysql_user
  @mysql_user
end

Instance Method Details

#to_sObject



37
38
39
# File 'lib/snapshoter/volume.rb', line 37

def to_s
  "##{@id}"
end