YUKI Hiroshi
null+****@clear*****
Wed Jan 29 20:44:28 JST 2014
YUKI Hiroshi 2014-01-29 20:44:28 +0900 (Wed, 29 Jan 2014) New Revision: e158cff8f45a04e27c52648ab8a835a4a8dece95 https://github.com/droonga/fluent-plugin-droonga/commit/e158cff8f45a04e27c52648ab8a835a4a8dece95 Message: Distribute "watch" command by DistributedCommandPlanner Modified files: lib/droonga/plugin/distributor/watch.rb lib/droonga/plugin/handler/watch.rb test/command/suite/watch/subscribe.expected test/command/suite/watch/unsubscribe.expected Modified: lib/droonga/plugin/distributor/watch.rb (+9 -0) =================================================================== --- lib/droonga/plugin/distributor/watch.rb 2014-01-29 20:38:47 +0900 (fc37aef) +++ lib/droonga/plugin/distributor/watch.rb 2014-01-29 20:44:28 +0900 (31dd2f9) @@ -40,5 +40,14 @@ module Droonga def sweep(message) broadcast_all(message) end + + private + def broadcast_all(message) + planner = DistributedCommandPlanner.new(message) + planner.outputs << "success" + planner.reduce("success", "type" => "or") + planner.broadcast_all + distribute(planner.messages) + end end end Modified: lib/droonga/plugin/handler/watch.rb (+8 -2) =================================================================== --- lib/droonga/plugin/handler/watch.rb 2014-01-29 20:38:47 +0900 (6aecbd0) +++ lib/droonga/plugin/handler/watch.rb 2014-01-29 20:44:28 +0900 (21866ee) @@ -56,7 +56,10 @@ module Droonga :route => route, } @watcher.subscribe(normalized_request) - messenger.emit([true]) + outputs = { + "success" => true, + } + messenger.emit(outputs) end command "watch.unsubscribe" => :unsubscribe @@ -68,7 +71,10 @@ module Droonga :query => query, } @watcher.unsubscribe(normalized_request) - messenger.emit([true]) + outputs = { + "success" => true, + } + messenger.emit(outputs) end command "watch.feed" => :feed Modified: test/command/suite/watch/subscribe.expected (+3 -3) =================================================================== --- test/command/suite/watch/subscribe.expected 2014-01-29 20:38:47 +0900 (0cdc070) +++ test/command/suite/watch/subscribe.expected 2014-01-29 20:44:28 +0900 (f5279b2) @@ -5,8 +5,8 @@ "inReplyTo": "request-id", "statusCode": 200, "type": "watch.subscribe.result", - "body": [ - true - ] + "body": { + "success": true + } } ] Modified: test/command/suite/watch/unsubscribe.expected (+3 -3) =================================================================== --- test/command/suite/watch/unsubscribe.expected 2014-01-29 20:38:47 +0900 (7229539) +++ test/command/suite/watch/unsubscribe.expected 2014-01-29 20:44:28 +0900 (2490a87) @@ -5,8 +5,8 @@ "inReplyTo": "request-id", "statusCode": 200, "type": "watch.unsubscribe.result", - "body": [ - true - ] + "body": { + "success": true + } } ] -------------- next part -------------- HTML����������������������������... Descargar