Kouhei Sutou
null+****@clear*****
Sun Mar 23 17:14:13 JST 2014
Kouhei Sutou 2014-03-23 17:14:13 +0900 (Sun, 23 Mar 2014) New Revision: 8e235cf9836fd6677364b1e6f6ded8014c7d4a0c https://github.com/droonga/fluent-plugin-droonga/commit/8e235cf9836fd6677364b1e6f6ded8014c7d4a0c Message: distributor: build dependencies on constructor Modified files: lib/droonga/distributor.rb Modified: lib/droonga/distributor.rb (+11 -8) =================================================================== --- lib/droonga/distributor.rb 2014-03-23 17:12:50 +0900 (bb7fbee) +++ lib/droonga/distributor.rb 2014-03-23 17:14:13 +0900 (3642c38) @@ -40,17 +40,10 @@ module Droonga def initialize(dispatcher, plan) @dispatcher = dispatcher @plan = plan + build_dependencies end def distribute - @dependency = {} - @plan.each do |step| - @dependency[step] = step["inputs"] - next unless step["outputs"] - step["outputs"].each do |output| - @dependency[output] = [step] - end - end steps = [] each_strongly_connected_component do |nodes| raise CyclicStepsError.new(nodes) if nodes.size > 1 @@ -60,6 +53,16 @@ module Droonga end private + def build_dependencies + @plan.each do |step| + @dependency[step] = step["inputs"] + next unless step["outputs"] + step["outputs"].each do |output| + @dependency[output] = [step] + end + end + end + def tsort_each_node(&block) @dependency.each_key(&block) end -------------- next part -------------- HTML����������������������������...Download