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.
14 15 16 17 18 19 |
# File 'lib/riddle/configuration/distributed_index.rb', line 14 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.
11 12 13 |
# File 'lib/riddle/configuration/distributed_index.rb', line 11 def agent_blackhole @agent_blackhole end |
#agent_connect_timeout ⇒ Object
Returns the value of attribute agent_connect_timeout.
11 12 13 |
# File 'lib/riddle/configuration/distributed_index.rb', line 11 def agent_connect_timeout @agent_connect_timeout end |
#agent_query_timeout ⇒ Object
Returns the value of attribute agent_query_timeout.
11 12 13 |
# File 'lib/riddle/configuration/distributed_index.rb', line 11 def agent_query_timeout @agent_query_timeout end |
#local_indices ⇒ Object
Returns the value of attribute local_indices.
11 12 13 |
# File 'lib/riddle/configuration/distributed_index.rb', line 11 def local_indices @local_indices end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/riddle/configuration/distributed_index.rb', line 11 def name @name end |
#remote_indices ⇒ Object
Returns the value of attribute remote_indices.
11 12 13 |
# File 'lib/riddle/configuration/distributed_index.rb', line 11 def remote_indices @remote_indices end |
Class Method Details
.settings ⇒ Object
4 5 6 7 8 9 |
# File 'lib/riddle/configuration/distributed_index.rb', line 4 def self.settings [ :type, :local, :agent, :agent_blackhole, :agent_connect_timeout, :agent_query_timeout ] end |
Instance Method Details
#agent ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/riddle/configuration/distributed_index.rb', line 29 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
25 26 27 |
# File 'lib/riddle/configuration/distributed_index.rb', line 25 def local self.local_indices end |
#render ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/riddle/configuration/distributed_index.rb', line 38 def render raise ConfigurationError unless valid? ( ["index #{name}", "{"] + settings_body + ["}", ""] ).join("\n") end |
#type ⇒ Object
21 22 23 |
# File 'lib/riddle/configuration/distributed_index.rb', line 21 def type "distributed" end |
#valid? ⇒ Boolean
48 49 50 |
# File 'lib/riddle/configuration/distributed_index.rb', line 48 def valid? @local_indices.length > 0 || @remote_indices.length > 0 end |