[Groonga-commit] droonga/droonga-engine at ad2342c [master] Extract logic to get destinations from steps

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jun 26 19:39:35 JST 2014


YUKI Hiroshi	2014-06-26 19:39:35 +0900 (Thu, 26 Jun 2014)

  New Revision: ad2342ca657edcbb8340d35e1c6ca44a8a9ba152
  https://github.com/droonga/droonga-engine/commit/ad2342ca657edcbb8340d35e1c6ca44a8a9ba152

  Message:
    Extract logic to get destinations from steps

  Modified files:
    lib/droonga/dispatcher.rb

  Modified: lib/droonga/dispatcher.rb (+12 -9)
===================================================================
--- lib/droonga/dispatcher.rb    2014-06-26 18:47:29 +0900 (84861a6)
+++ lib/droonga/dispatcher.rb    2014-06-26 19:39:35 +0900 (235bb20)
@@ -170,28 +170,31 @@ module Droonga
 
     def dispatch_steps(steps)
       id = @engine_state.generate_id
-      destinations = {}
       steps.each do |step|
         dataset =****@catal*****(step["dataset"])
         if dataset
-          target_nodes = nil
-          target_nodes = @engine_state.live_nodes unless write_step?(step)
-          routes = dataset.get_routes(step, target_nodes)
+          routes = dataset.get_routes(step, @engine_state.live_nodes)
           step["routes"] = routes
         else
           step["routes"] ||= [id]
         end
-        routes = step["routes"]
-        routes.each do |route|
-          destinations[farm_path(route)] = true
-        end
       end
       dispatch_message = { "id" => id, "steps" => steps }
-      destinations.each_key do |destination|
+      get_destinations(steps).each do |destination|
         dispatch(dispatch_message, destination)
       end
     end
 
+    def get_destinations(steps)
+      destinations = {}
+      steps.each do |step|
+        step["routes"].each do |route|
+          destinations[farm_path(route)] = true
+        end
+      end
+      destinations.keys
+    end
+
     def process_local_message(local_message)
       task = local_message["task"]
       slice_name = task["route"]
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index