Class: Riddle::Configuration::DistributedIndex
- Defined in:
- lib/riddle/configuration/distributed_index.rb
Instance Attribute Summary collapse
-
#agent_blackhole ⇒ Object
Returns the value of attribute agent_blackhole.
-
#agent_connect_timeout ⇒ Object
Returns the value of attribute agent_connect_timeout.
-
#agent_query_timeout ⇒ Object
Returns the value of attribute agent_query_timeout.
-
#local_indices ⇒ Object
Returns the value of attribute local_indices.
-
#name ⇒ Object
Returns the value of attribute name.
-
#remote_indices ⇒ Object
Returns the value of attribute remote_indices.
Class Method Summary collapse
Instance Method Summary collapse
- #agent ⇒ Object
-
#initialize(name) ⇒ DistributedIndex
constructor
A new instance of DistributedIndex.
- #local ⇒ Object
- #render ⇒ Object
- #type ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(name) ⇒ DistributedIndex
Returns a new instance of DistributedIndex.
16 17 18 19 20 21 |
# File 'lib/riddle/configuration/distributed_index.rb', line 16 def initialize(name) @name = name @local_indices = [] @remote_indices = [] @agent_blackhole = [] end |
Instance Attribute Details
#agent_blackhole ⇒ Object
Returns the value of attribute agent_blackhole.
13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 13 def agent_blackhole @agent_blackhole end |
#agent_connect_timeout ⇒ Object
Returns the value of attribute agent_connect_timeout.
13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 13 def agent_connect_timeout @agent_connect_timeout end |
#agent_query_timeout ⇒ Object
Returns the value of attribute agent_query_timeout.
13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 13 def agent_query_timeout @agent_query_timeout end |
#local_indices ⇒ Object
Returns the value of attribute local_indices.
13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 13 def local_indices @local_indices end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 13 def name @name end |
#remote_indices ⇒ Object
Returns the value of attribute remote_indices.
13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 13 def remote_indices @remote_indices end |
Class Method Details
.settings ⇒ Object
6 7 8 9 10 11 |
# File 'lib/riddle/configuration/distributed_index.rb', line 6 def self.settings [ :type, :local, :agent, :agent_blackhole, :agent_connect_timeout, :agent_query_timeout ] end |
Instance Method Details
#agent ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/riddle/configuration/distributed_index.rb', line 31 def agent agents = remote_indices.collect { |index| index.remote }.uniq agents.collect { |agent| agent + ":" + remote_indices.select { |index| index.remote == agent }.collect { |index| index.name }.join(",") } end |
#local ⇒ Object
27 28 29 |
# File 'lib/riddle/configuration/distributed_index.rb', line 27 def local self.local_indices end |
#render ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/riddle/configuration/distributed_index.rb', line 40 def render raise ConfigurationError unless valid? ( ["index #{name}", "{"] + settings_body + ["}", ""] ).join("\n") end |
#type ⇒ Object
23 24 25 |
# File 'lib/riddle/configuration/distributed_index.rb', line 23 def type "distributed" end |
#valid? ⇒ Boolean
50 51 52 |
# File 'lib/riddle/configuration/distributed_index.rb', line 50 def valid? @local_indices.length > 0 || @remote_indices.length > 0 end |