[Groonga-commit] droonga/droonga-engine at 839c329 [master] Use dispatcher's fowarder for direct routing

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 1 18:58:21 JST 2015


YUKI Hiroshi	2015-04-01 18:58:21 +0900 (Wed, 01 Apr 2015)

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

  Message:
    Use dispatcher's fowarder for direct routing

  Modified files:
    lib/droonga/dispatcher.rb

  Modified: lib/droonga/dispatcher.rb (+11 -3)
===================================================================
--- lib/droonga/dispatcher.rb    2015-04-01 18:29:09 +0900 (ba7b226)
+++ lib/droonga/dispatcher.rb    2015-04-01 18:58:21 +0900 (e877441)
@@ -117,7 +117,7 @@ module Droonga
 
     def forward(message, destination)
       logger.trace("forward start")
-      if local?(destination)
+      if local_route?(destination) or direct_route?(destination)
         @forwarder.forward(message, destination)
       else
         @cluster.forward(message, destination)
@@ -195,7 +195,10 @@ module Droonga
           "type" => "dispatcher",
           "to"   => destination,
         }
-        @cluster.forward(forward_message, forward_destination)
+        if direct_route?(forward_destination)
+          @fowrarder.forward(forward_message, forward_destination)
+        else
+          @cluster.forward(forward_message, forward_destination)
       end
       logger.trace("dispatch: done")
     end
@@ -262,10 +265,15 @@ module Droonga
       logger.trace("process_local_message: done")
     end
 
-    def local?(route)
+    def local_route?(route)
       @engine_state.local_route?(route)
     end
 
+    def direct_route?(route)
+      receiver = destination["to"]
+      not****@clust*****_nodes.key?(receiver)
+    end
+
     def write_step?(step)
       return false unless step["dataset"]
 
-------------- next part --------------
HTML����������������������������...
Descargar 



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