Class: Gru::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/gru/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Configuration

Returns a new instance of Configuration.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gru/configuration.rb', line 8

def initialize(settings)
  @host_maximums = settings.delete(:host_maximums) || settings.delete(:cluster_maximums)
  @cluster_maximums = settings.delete(:cluster_maximums) || @host_maximums
  @rebalance_flag = settings.delete(:rebalance_flag) || false
  @cluster_name = settings.delete(:cluster_name) || 'default'
  @environment_name = settings.delete(:environment_name) || 'default'
  @presume_host_dead_after = settings.delete(:presume_host_dead_after)
  @client_settings = settings.delete(:client_settings)
  @manage_worker_heartbeats = settings.delete(:manage_worker_heartbeats) || false
  @max_worker_processes_per_host = settings.delete(:max_workers_per_host) || 30
  @adapter = Gru::Adapters::RedisAdapter.new(self)
  if @cluster_maximums.nil?
    raise ArgumentError, "Need at least a cluster configuration"
  end
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def adapter
  @adapter
end

#client_settingsObject (readonly)

Returns the value of attribute client_settings.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def client_settings
  @client_settings
end

#cluster_maximumsObject (readonly)

Returns the value of attribute cluster_maximums.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def cluster_maximums
  @cluster_maximums
end

#cluster_nameObject (readonly)

Returns the value of attribute cluster_name.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def cluster_name
  @cluster_name
end

#environment_nameObject (readonly)

Returns the value of attribute environment_name.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def environment_name
  @environment_name
end

#host_maximumsObject (readonly)

Returns the value of attribute host_maximums.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def host_maximums
  @host_maximums
end

#manage_worker_heartbeatsObject (readonly)

Returns the value of attribute manage_worker_heartbeats.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def manage_worker_heartbeats
  @manage_worker_heartbeats
end

#max_worker_processes_per_hostObject (readonly)

Returns the value of attribute max_worker_processes_per_host.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def max_worker_processes_per_host
  @max_worker_processes_per_host
end

#presume_host_dead_afterObject (readonly)

Returns the value of attribute presume_host_dead_after.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def presume_host_dead_after
  @presume_host_dead_after
end

#rebalance_flagObject (readonly)

Returns the value of attribute rebalance_flag.



6
7
8
# File 'lib/gru/configuration.rb', line 6

def rebalance_flag
  @rebalance_flag
end