[Groonga-commit] droonga/droonga-engine at 81b2f83 [master] Add method to collect suspended nodes based on serf tag

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Dec 11 17:50:40 JST 2014


YUKI Hiroshi	2014-12-11 17:50:40 +0900 (Thu, 11 Dec 2014)

  New Revision: 81b2f83f3928142ec2c78a124a5d6d55f43054f5
  https://github.com/droonga/droonga-engine/commit/81b2f83f3928142ec2c78a124a5d6d55f43054f5

  Merged 97ba0d9: Merge ../droonga-engine into replicas-in-a-branch

  Message:
    Add method to collect suspended nodes based on serf tag

  Modified files:
    lib/droonga/engine_state.rb
    lib/droonga/live_nodes_list.rb

  Modified: lib/droonga/engine_state.rb (+8 -0)
===================================================================
--- lib/droonga/engine_state.rb    2014-12-11 17:47:20 +0900 (74dc881)
+++ lib/droonga/engine_state.rb    2014-12-11 17:50:40 +0900 (2f8574d)
@@ -117,6 +117,14 @@ module Droonga
       end
     end
 
+    def suspended_nodes
+      if @live_nodes_list
+        @live_nodes_list.suspended_nodes
+      else
+        []
+      end
+    end
+
     def live_nodes_list=(nodes_list)
       old_live_nodes_list = @live_nodes_list
       @live_nodes_list = nodes_list

  Modified: lib/droonga/live_nodes_list.rb (+15 -0)
===================================================================
--- lib/droonga/live_nodes_list.rb    2014-12-11 17:47:20 +0900 (0a9e5cd)
+++ lib/droonga/live_nodes_list.rb    2014-12-11 17:50:40 +0900 (cf4ab3a)
@@ -22,5 +22,20 @@ module Droonga
     def all_nodes
       @nodes.keys
     end
+
+    def suspended_nodes
+      @suspended_nodes ||= collect_suspended_nodes
+    end
+
+    private
+    def collect_suspended_nodes
+      nodes = []
+      @nodes.each do |name, state|
+        if state["tags"]["suspended"] == "true"
+          nodes << name
+        end
+      end
+      nodes
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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