YUKI Hiroshi
null+****@clear*****
Thu Dec 11 18:01:30 JST 2014
YUKI Hiroshi 2014-12-11 18:01:30 +0900 (Thu, 11 Dec 2014) New Revision: 39ac1f11bb26da52ceb62bb1743f72a0a837da58 https://github.com/droonga/droonga-engine/commit/39ac1f11bb26da52ceb62bb1743f72a0a837da58 Merged 97ba0d9: Merge ../droonga-engine into replicas-in-a-branch Message: Return detailed status of nodes by system/status. old => new live=true => status=active live=false => status=inactive --- => status=suspended (newly introduced!) Modified files: lib/droonga/plugins/system.rb test/unit/plugins/system/test_status.rb Modified: lib/droonga/plugins/system.rb (+9 -1) =================================================================== --- lib/droonga/plugins/system.rb 2014-12-11 17:50:40 +0900 (16c6d4d) +++ lib/droonga/plugins/system.rb 2014-12-11 18:01:30 +0900 (e8a6a40) @@ -27,10 +27,18 @@ module Droonga def handle(message) engine_state =****@messe*****_state live_nodes = engine_state.live_nodes + suspended_nodes = engine_state.suspended_nodes nodes = {} engine_state.all_nodes.collect do |identifier| + if suspended_nodes.include?(identifier) + status = "suspended" + elsif live_nodes.include?(identifier) + status = "active" + else + status = "inactive" + end nodes[identifier] = { - "live" => live_nodes.include?(identifier), + "status" => status, } end Modified: test/unit/plugins/system/test_status.rb (+12 -2) =================================================================== --- test/unit/plugins/system/test_status.rb 2014-12-11 17:50:40 +0900 (6f304b8) +++ test/unit/plugins/system/test_status.rb 2014-12-11 18:01:30 +0900 (7eb671e) @@ -50,6 +50,7 @@ class SystemStatusHandlerTest < Test::Unit::TestCase [ "127.0.0.1:10031/droonga", "127.0.0.1:10032/droonga", + "127.0.0.1:10033/droonga", ] end @@ -58,6 +59,12 @@ class SystemStatusHandlerTest < Test::Unit::TestCase "127.0.0.1:10031/droonga", ] end + + def suspended_nodes + [ + "127.0.0.1:10032/droonga", + ] + end end public @@ -67,10 +74,13 @@ class SystemStatusHandlerTest < Test::Unit::TestCase status = { "nodes" => { "127.0.0.1:10031/droonga" => { - "live" => true, + "status" => "active", }, "127.0.0.1:10032/droonga" => { - "live" => false, + "status" => "suspended", + }, + "127.0.0.1:10033/droonga" => { + "status" => "inactive", }, }, } -------------- next part -------------- HTML����������������������������...Download