Class: Droonga::StepRunner

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/droonga/step_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(plugins) ⇒ StepRunner



24
25
26
27
28
29
30
31
32
# File 'lib/droonga/step_runner.rb', line 24

def initialize(plugins)
  @definitions = {}
  plugins.each do |name|
    plugin = Plugin.registry[name]
    plugin.single_step_definitions.each do |definition|
      @definitions[definition.name] = definition
    end
  end
end

Instance Method Details

#find(type) ⇒ Object



54
55
56
# File 'lib/droonga/step_runner.rb', line 54

def find(type)
  @definitions[type]
end

#plan(message) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/droonga/step_runner.rb', line 37

def plan(message)
  type = message["type"]
  logger.trace("plan: start",
               :dataset => message["dataset"],
               :type => type)
  definition = find(type)
  if definition.nil?
    raise UnsupportedMessageError.new(:planner, message)
  end
  step = SingleStep.new(definition)
  plan = step.plan(message)
  logger.trace("plan: done",
               :dataset => message["dataset"],
               :type => type)
  plan
end

#shutdownObject



34
35
# File 'lib/droonga/step_runner.rb', line 34

def shutdown
end