Class: ChefBackup::DataMap

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_backup/data_map.rb

Overview

DataMap class to store data about the data we’re backing up

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ DataMap

Returns a new instance of DataMap.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
21
22
23
24
25
# File 'lib/chef_backup/data_map.rb', line 16

def initialize
  @services = {}
  @configs = {}
  @ha = {}
  yield self if block_given?

  @backup_time ||= Time.now.iso8601
  @strategy ||= 'none'
  @toplogy ||= 'idontknow'
end

Class Attribute Details

.data_mapObject



7
8
9
# File 'lib/chef_backup/data_map.rb', line 7

def data_map
  @data_map ||= new
end

Instance Attribute Details

#backup_timeObject

Returns the value of attribute backup_time.



14
15
16
# File 'lib/chef_backup/data_map.rb', line 14

def backup_time
  @backup_time
end

#configsObject

Returns the value of attribute configs.



14
15
16
# File 'lib/chef_backup/data_map.rb', line 14

def configs
  @configs
end

#haObject

Returns the value of attribute ha.



14
15
16
# File 'lib/chef_backup/data_map.rb', line 14

def ha
  @ha
end

#servicesObject

Returns the value of attribute services.



14
15
16
# File 'lib/chef_backup/data_map.rb', line 14

def services
  @services
end

#strategyObject

Returns the value of attribute strategy.



14
15
16
# File 'lib/chef_backup/data_map.rb', line 14

def strategy
  @strategy
end

#topologyObject

Returns the value of attribute topology.



14
15
16
# File 'lib/chef_backup/data_map.rb', line 14

def topology
  @topology
end

Instance Method Details

#add_config(config, path) ⇒ Object



32
33
34
35
# File 'lib/chef_backup/data_map.rb', line 32

def add_config(config, path)
  @configs[config] ||= {}
  @configs[config]['data_dir'] = path
end

#add_ha_info(k, v) ⇒ Object



37
38
39
# File 'lib/chef_backup/data_map.rb', line 37

def add_ha_info(k, v)
  @ha[k] = v
end

#add_service(service, data_dir) ⇒ Object



27
28
29
30
# File 'lib/chef_backup/data_map.rb', line 27

def add_service(service, data_dir)
  @services[service] ||= {}
  @services[service]['data_dir'] = data_dir
end

#manifestObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/chef_backup/data_map.rb', line 41

def manifest
  {
    'strategy' => strategy,
    'backup_time' => backup_time,
    'topology' => topology,
    'ha' => ha,
    'services' => services,
    'configs' => configs
  }
end