Method: Elastictastic::Rotor#initialize

Defined in:
lib/elastictastic/rotor.rb

#initialize(hosts, options) ⇒ Rotor

Returns a new instance of Rotor.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/elastictastic/rotor.rb', line 11

def initialize(hosts, options)
  node_options = {}
  [:backoff_threshold, :backoff_start, :backoff_max].each do |key|
    node_options[key] = options.delete(key)
  end
  adapter = Adapter[options.delete(:adapter)]
  @connections = hosts.map do |host|
    Node.new(adapter.new(host, options), node_options)
  end
  @head_index = 0
end