[Groonga-commit] droonga/droonga-engine at 62841ce [master] Output tags to the list of live nodes

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jun 26 14:00:24 JST 2014


YUKI Hiroshi	2014-06-26 14:00:24 +0900 (Thu, 26 Jun 2014)

  New Revision: 62841ce15ff66bc826ef3b89c6ff6179a94a57a5
  https://github.com/droonga/droonga-engine/commit/62841ce15ff66bc826ef3b89c6ff6179a94a57a5

  Message:
    Output tags to the list of live nodes

  Modified files:
    lib/droonga/command/serf_event_handler.rb

  Modified: lib/droonga/command/serf_event_handler.rb (+13 -1)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-06-26 13:56:46 +0900 (c9da937)
+++ lib/droonga/command/serf_event_handler.rb    2014-06-26 14:00:24 +0900 (d304fa6)
@@ -54,15 +54,27 @@ module Droonga
         end
       end
 
+      def parse_tags(tags)
+        parsed = {}
+        return parsed unless tags
+
+        tags.split(",").each do |tag|
+          key, value = tag.split("=")
+          parsed[key] = value
+        end
+        parsed
+      end
+
       def live_nodes
         nodes = {}
         members = `#{@serf} members -rpc-addr #{@serf_rpc_address}`
         members.each_line do |member|
-          name, address, status, = member.strip.split(/\s+/)
+          name, address, status, tags, = member.strip.split(/\s+/)
           next unless status == "alive"
 
           nodes[name] = {
             "serfAddress" => address,
+            "tags" => parse_tags(tags),
           }
         end
         nodes
-------------- next part --------------
HTML����������������������������...
Download 



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