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
26
# File 'lib/chef_backup/data_map.rb', line 16

def initialize
  @services = {}
  @configs = {}
  @versions = {}
  @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

#versionsObject

Returns the value of attribute versions.



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

def versions
  @versions
end

Instance Method Details

#add_config(config, path) ⇒ Object



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

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

#add_ha_info(k, v) ⇒ Object



42
43
44
# File 'lib/chef_backup/data_map.rb', line 42

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

#add_service(service, data_dir) ⇒ Object



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

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

#add_version(project_name, data) ⇒ Object



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

def add_version(project_name, data)
  @versions[project_name] = data
end

#manifestObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/chef_backup/data_map.rb', line 46

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