Class: Pmux::StorageAdapter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pmux/storage_adapter.rb

Direct Known Subclasses

GlusterFSAdapter, LocalAdapter

Constant Summary collapse

Adapters =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(addrs = [], options = {}) ⇒ StorageAdapter

Returns a new instance of StorageAdapter.



17
18
19
20
21
# File 'lib/pmux/storage_adapter.rb', line 17

def initialize addrs=[], options={}
  @addrs = addrs
  @options = options
  @h = init_node_hash addrs
end

Instance Attribute Details

#addrsObject (readonly)

Returns the value of attribute addrs.



15
16
17
# File 'lib/pmux/storage_adapter.rb', line 15

def addrs
  @addrs
end

Class Method Details

.create(name, addrs, options = {}) ⇒ Object



10
11
12
13
# File 'lib/pmux/storage_adapter.rb', line 10

def self.create name, addrs, options={}
  adapter_class = Adapters[name] || GlusterFSAdapter
  adapter_class.new addrs, options
end

Instance Method Details

#connect_to_storage(locator_host, locator_port) ⇒ Object



27
28
# File 'lib/pmux/storage_adapter.rb', line 27

def connect_to_storage locator_host, locator_port
end

#init_node_hash(addrs) ⇒ Object



23
24
25
# File 'lib/pmux/storage_adapter.rb', line 23

def init_node_hash addrs
  Hash[*(addrs.map {|addr| [addr, {}]}).flatten]
end