class Riddle::Configuration::DistributedIndex

Attributes

agent_blackhole[RW]
agent_connect_timeout[RW]
agent_query_timeout[RW]
local_indices[RW]
name[RW]
remote_indices[RW]

Public Class Methods

new(name) click to toggle source
# File lib/riddle/configuration/distributed_index.rb, line 14
def initialize(name)
  @name             = name
  @local_indices    = []
  @remote_indices   = []
  @agent_blackhole  = []
end
settings() click to toggle source
# File lib/riddle/configuration/distributed_index.rb, line 4
def self.settings
  [
    :type, :local, :agent, :agent_blackhole,
    :agent_connect_timeout, :agent_query_timeout
  ]
end

Public Instance Methods

agent() click to toggle source
# 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() click to toggle source
# File lib/riddle/configuration/distributed_index.rb, line 25
def local
  self.local_indices
end
render() click to toggle source
# File lib/riddle/configuration/distributed_index.rb, line 38
def render
  raise ConfigurationError unless valid?

  (
    ["index #{name}", "{"] +
    settings_body +
    ["}", ""]
  ).join("\n")
end
type() click to toggle source
# File lib/riddle/configuration/distributed_index.rb, line 21
def type
  "distributed"
end
valid?() click to toggle source
# File lib/riddle/configuration/distributed_index.rb, line 48
def valid?
  @local_indices.length > 0 || @remote_indices.length > 0
end