Class: ChefZero::DataStore::V2ToV1Adapter

Inherits:
InterfaceV1
  • Object
show all
Defined in:
lib/chef_zero/data_store/v2_to_v1_adapter.rb

Direct Known Subclasses

MemoryStore

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InterfaceV1

#interface_version

Constructor Details

#initializeV2ToV1Adapter

Returns a new instance of V2ToV1Adapter.



24
25
26
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 24

def initialize
  @single_org = "chef"
end

Instance Attribute Details

#real_storeObject (readonly)

Returns the value of attribute real_store.



28
29
30
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 28

def real_store
  @real_store
end

#single_orgObject (readonly)

Returns the value of attribute single_org.



29
30
31
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 29

def single_org
  @single_org
end

Instance Method Details

#clearObject



31
32
33
34
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 31

def clear
  real_store.clear
  real_store.create_dir([ "organizations" ], single_org, :recursive)
end

#create(path, name, data, *options) ⇒ Object



42
43
44
45
46
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 42

def create(path, name, data, *options)
  fix_exceptions do
    real_store.create(fix_path(path), name, data, *options)
  end
end

#create_dir(path, name, *options) ⇒ Object



36
37
38
39
40
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 36

def create_dir(path, name, *options)
  fix_exceptions do
    real_store.create_dir(fix_path(path), name, *options)
  end
end

#delete(path) ⇒ Object



60
61
62
63
64
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 60

def delete(path)
  fix_exceptions do
    real_store.delete(fix_path(path))
  end
end

#delete_dir(path, *options) ⇒ Object



66
67
68
69
70
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 66

def delete_dir(path, *options)
  fix_exceptions do
    real_store.delete_dir(fix_path(path), *options)
  end
end

#exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


78
79
80
81
82
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 78

def exists?(path)
  fix_exceptions do
    real_store.exists?(fix_path(path))
  end
end

#exists_dir?(path) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
87
88
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 84

def exists_dir?(path)
  fix_exceptions do
    real_store.exists_dir?(fix_path(path))
  end
end

#get(path, request = nil) ⇒ Object



48
49
50
51
52
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 48

def get(path, request = nil)
  fix_exceptions do
    real_store.get(fix_path(path), request)
  end
end

#list(path) ⇒ Object



72
73
74
75
76
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 72

def list(path)
  fix_exceptions do
    real_store.list(fix_path(path))
  end
end

#set(path, data, *options) ⇒ Object



54
55
56
57
58
# File 'lib/chef_zero/data_store/v2_to_v1_adapter.rb', line 54

def set(path, data, *options)
  fix_exceptions do
    real_store.set(fix_path(path), data, *options)
  end
end