[Groonga-commit] droonga/droonga-engine at adf12e1 [master] Don't use NodeRole's instance from others

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 21 13:34:01 JST 2015


YUKI Hiroshi	2015-04-21 13:34:01 +0900 (Tue, 21 Apr 2015)

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

  Message:
    Don't use NodeRole's instance from others

  Modified files:
    lib/droonga/node_role.rb
    lib/droonga/serf.rb

  Modified: lib/droonga/node_role.rb (+4 -0)
===================================================================
--- lib/droonga/node_role.rb    2015-04-21 13:32:59 +0900 (2c31baa)
+++ lib/droonga/node_role.rb    2015-04-21 13:34:01 +0900 (6af0985)
@@ -26,6 +26,10 @@ module Droonga
     ]
 
     class << self
+      def normalize(role)
+        new(role).to_s
+      end
+
       def mine
         if @mine
           @mine.to_s

  Modified: lib/droonga/serf.rb (+4 -5)
===================================================================
--- lib/droonga/serf.rb    2015-04-21 13:32:59 +0900 (41be5a4)
+++ lib/droonga/serf.rb    2015-04-21 13:34:01 +0900 (9c24cdd)
@@ -196,15 +196,14 @@ module Droonga
     end
 
     def role
-      role = NodeRole.new(get_tag("role"))
-      role.to_s
+      NodeRole.normalize(get_tag("role"))
     end
 
     def role=(new_role)
-      role = NodeRole.new(new_role)
-      set_tag("role", role.to_s)
+      role = NodeRole.normalize(new_role)
+      set_tag("role", role)
       # after that you must run update_cluster_state to update the cluster information cache
-      role.to_s
+      role
     end
 
     def last_processed_message_timestamp
-------------- next part --------------
HTML����������������������������...
Download 



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