Class: Droonga::Distributor
- Inherits:
-
Object
- Object
- Droonga::Distributor
- Includes:
- TSort
- Defined in:
- lib/droonga/distributor.rb
Defined Under Namespace
Classes: CyclicStepsError, UndefinedInputError
Instance Method Summary collapse
-
#distribute ⇒ Object
-
#initialize(dispatcher, plan) ⇒ Distributor
constructor
A new instance of Distributor.
Constructor Details
#initialize(dispatcher, plan) ⇒ Distributor
Returns a new instance of Distributor.
40 41 42 43 44 |
# File 'lib/droonga/distributor.rb', line 40 def initialize(dispatcher, plan) @dispatcher = dispatcher @plan = plan build_dependencies end |
Instance Method Details
#distribute ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/droonga/distributor.rb', line 46 def distribute steps = [] each_strongly_connected_component do |nodes| raise CyclicStepsError.new(nodes) if nodes.size > 1 nodes.each do |node| steps << @step_maps[node] if node.is_a?(Integer) end end @dispatcher.dispatch_steps(steps) end |