YUKI Hiroshi
null+****@clear*****
Wed Apr 1 18:28:55 JST 2015
YUKI Hiroshi 2015-04-01 18:28:55 +0900 (Wed, 01 Apr 2015) New Revision: 1f8f33cdbb54be171ac6e739d05f728f3176b067 https://github.com/droonga/droonga-engine/commit/1f8f33cdbb54be171ac6e739d05f728f3176b067 Message: Raise error for unexpected forwardings Modified files: lib/droonga/cluster.rb Modified: lib/droonga/cluster.rb (+9 -2) =================================================================== --- lib/droonga/cluster.rb 2015-04-01 18:24:17 +0900 (df6d306) +++ lib/droonga/cluster.rb 2015-04-01 18:28:55 +0900 (dbd9888) @@ -28,6 +28,12 @@ module Droonga class NoCatalogLoaded < StandardError end + class NotStartedYet < StandardError + end + + class UnknownTarget < StandardError + end + class << self def load_state_file path = Path.cluster_state @@ -134,13 +140,14 @@ module Droonga def forward(message, destination) receiver = destination["to"] receiver_node_name = receiver.match(/\A[^:]+:\d+\/[^.]+/).to_s + raise NotStartedYet unless @engine_nodes @engine_nodes.each do |node| if node.name == receiver_node_name node.forward(message, destination) - return true + return end end - false + raise UnknownTarget.new(receiver) end def readable_nodes -------------- next part -------------- HTML����������������������������...Download