[Groonga-commit] droonga/droonga-engine at 262aab3 [buffered-forward] Fix wrong role name

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Dec 18 16:32:58 JST 2014


YUKI Hiroshi	2014-12-18 16:32:58 +0900 (Thu, 18 Dec 2014)

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

  Merged 69350ee: Merge branch 'master' into buffered-forward

  Message:
    Fix wrong role name

  Modified files:
    lib/droonga/engine_state.rb
    lib/droonga/node_status.rb
    lib/droonga/serf.rb

  Modified: lib/droonga/engine_state.rb (+2 -2)
===================================================================
--- lib/droonga/engine_state.rb    2014-12-18 16:15:21 +0900 (c7da680)
+++ lib/droonga/engine_state.rb    2014-12-18 16:32:58 +0900 (f11ccdb)
@@ -142,7 +142,7 @@ module Droonga
     end
 
     def same_role_nodes
-      case node_status.get(:role)
+      case node_status.role
       when NodeStatus::Role::SERVICE_PROVIDER
         all_nodes & service_provider_nodes
       when NodeStatus::Role::ABSORB_SOURCE
@@ -159,7 +159,7 @@ module Droonga
     end
 
     def writable_nodes
-      case node_status.get(:role)
+      case node_status.role
       when NodeStatus::Role::SERVICE_PROVIDER
         all_nodes
       when NodeStatus::Role::ABSORB_SOURCE

  Modified: lib/droonga/node_status.rb (+11 -3)
===================================================================
--- lib/droonga/node_status.rb    2014-12-18 16:15:21 +0900 (9ed1a5b)
+++ lib/droonga/node_status.rb    2014-12-18 16:32:58 +0900 (449c012)
@@ -20,9 +20,9 @@ require "droonga/safe_file_writer"
 module Droonga
   class NodeStatus
     module Role
-      SERVICE_PROVIDER   = "service-provider"
-      ABSORB_SOURCE      = "absorb-source"
-      ABSORB_DESTINATION = "absorb-destination"
+      SERVICE_PROVIDER   = "engine"
+      ABSORB_SOURCE      = "engine-absorb-source"
+      ABSORB_DESTINATION = "engine-absorb-destination"
     end
 
     def initialize
@@ -51,6 +51,14 @@ module Droonga
       SafeFileWriter.write(status_file, JSON.pretty_generate(@status))
     end
 
+    def role
+      get(:role) || Role::SERVICE_PROVIDER
+    end
+
+    def role=(new_role)
+      set(:role, new_role)
+    end
+
     def reload
       @status = load
     end

  Modified: lib/droonga/serf.rb (+4 -8)
===================================================================
--- lib/droonga/serf.rb    2014-12-18 16:15:21 +0900 (f1dca7f)
+++ lib/droonga/serf.rb    2014-12-18 16:32:58 +0900 (b3690ae)
@@ -150,17 +150,13 @@ module Droonga
     end
 
     def role
-      node_status.get(:role) || NodeStatus::Role::SERVICE_PROVIDER
+      node_status.role
     end
 
     def role=(new_role)
-      if new_role
-        set_tag("role", new_role)
-        node_status.set(:role, new_role)
-      else
-        delete_tag("role")
-        node_status.delete(:role)
-      end
+      new_role ||= NodeStatus::Role::SERVICE_PROVIDER
+      set_tag("role", new_role)
+      node_status.role = new_role
     end
 
     def cluster_id
-------------- next part --------------
HTML����������������������������...
Download 



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