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_indexes ⇒ Object
Returns the value of attribute local_indexes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#remote_indexes ⇒ Object
Returns the value of attribute remote_indexes.
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.
10 11 12 13 14 15 |
# File 'lib/riddle/configuration/distributed_index.rb', line 10 def initialize(name) @name = name @local_indexes = [] @remote_indexes = [] @agent_blackhole = [] end |
Instance Attribute Details
#agent_blackhole ⇒ Object
Returns the value of attribute agent_blackhole.
7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 7 def agent_blackhole @agent_blackhole end |
#agent_connect_timeout ⇒ Object
Returns the value of attribute agent_connect_timeout.
7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 7 def agent_connect_timeout @agent_connect_timeout end |
#agent_query_timeout ⇒ Object
Returns the value of attribute agent_query_timeout.
7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 7 def agent_query_timeout @agent_query_timeout end |
#local_indexes ⇒ Object
Returns the value of attribute local_indexes.
7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 7 def local_indexes @local_indexes end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 7 def name @name end |
#remote_indexes ⇒ Object
Returns the value of attribute remote_indexes.
7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 7 def remote_indexes @remote_indexes end |
Instance Method Details
#agent ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/riddle/configuration/distributed_index.rb', line 25 def agent agents = remote_indexes.collect { |index| index.remote }.uniq agents.collect { |agent| agent + ":" + remote_indexes.select { |index| index.remote == agent }.collect { |index| index.name }.join(",") } end |
#local ⇒ Object
21 22 23 |
# File 'lib/riddle/configuration/distributed_index.rb', line 21 def local self.local_indexes end |
#render ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/riddle/configuration/distributed_index.rb', line 34 def render raise ConfigurationError unless valid? ( ["index #{name}", "{"] + settings_body + ["}", ""] ).join("\n") end |
#type ⇒ Object
17 18 19 |
# File 'lib/riddle/configuration/distributed_index.rb', line 17 def type "distributed" end |
#valid? ⇒ Boolean
44 45 46 |
# File 'lib/riddle/configuration/distributed_index.rb', line 44 def valid? @local_indexes.length > 0 || @remote_indexes.length > 0 end |