YUKI Hiroshi
null+****@clear*****
Tue Apr 14 15:08:07 JST 2015
YUKI Hiroshi 2015-04-14 15:08:07 +0900 (Tue, 14 Apr 2015) New Revision: 9a0163c411f67d4c5297293e447a51cfd9981391 https://github.com/droonga/droonga-engine/commit/9a0163c411f67d4c5297293e447a51cfd9981391 Message: Accept :replica option for scatter and broadcast Modified files: lib/droonga/distributed_command_planner.rb lib/droonga/planner.rb Modified: lib/droonga/distributed_command_planner.rb (+2 -3) =================================================================== --- lib/droonga/distributed_command_planner.rb 2015-04-14 14:57:02 +0900 (a1f5102) +++ lib/droonga/distributed_command_planner.rb 2015-04-14 15:08:07 +0900 (e0ff550) @@ -63,7 +63,7 @@ module Droonga "record" => record, "type" => "scatter", "outputs" => [], - "replica" => "all", + "replica" => options[:replica] || "all", "post" => true } end @@ -75,10 +75,9 @@ module Droonga "body" => options[:body] || @source_message["body"], "type" => "broadcast", "outputs" => [], - "replica" => "random" + "replica" => options[:replica] || "random" } if options[:write] - processor["replica"] = "all" processor["post"] = true end @processor = processor Modified: lib/droonga/planner.rb (+5 -1) =================================================================== --- lib/droonga/planner.rb 2015-04-14 14:57:02 +0900 (532b52b) +++ lib/droonga/planner.rb 2015-04-14 15:08:07 +0900 (cb4b1d9) @@ -40,7 +40,11 @@ module Droonga def broadcast(message, options={}) planner = DistributedCommandPlanner.new(@dataset, message) - planner.broadcast(:write => options[:write]) + broadcast_options = { + :write => options[:write], + } + broadcast_options[:replica] = "all" if options[:write] + planner.broadcast(broadcast_options) planner.reduce(options[:reduce]) planner.plan end -------------- next part -------------- HTML����������������������������...Download