[Groonga-commit] droonga/droonga-engine at 9fa7a82 [master] Put list of live nodes under "state" dir

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri May 23 17:45:21 JST 2014


YUKI Hiroshi	2014-05-23 17:45:21 +0900 (Fri, 23 May 2014)

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

  Message:
    Put list of live nodes under "state" dir

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

  Modified: lib/droonga/base_path.rb (+4 -0)
===================================================================
--- lib/droonga/base_path.rb    2014-05-23 16:29:37 +0900 (a2ee959)
+++ lib/droonga/base_path.rb    2014-05-23 17:45:21 +0900 (7d1ebac)
@@ -22,5 +22,9 @@ module Droonga
     def base_path
       @base_path ||= Pathname.new(ENV[BASE_DIR_ENV_NAME] || Dir.pwd)
     end
+
+    def state_dir_path
+      @state_dir_path ||= base_path + "state"
+    end
   end
 end

  Modified: lib/droonga/command/serf_event_handler.rb (+1 -1)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-05-23 16:29:37 +0900 (4e825d8)
+++ lib/droonga/command/serf_event_handler.rb    2014-05-23 17:45:21 +0900 (05ed117)
@@ -69,7 +69,7 @@ module Droonga
       end
 
       def list_file
-        @list_file ||= Droonga.base_path + LiveNodesListObserver::DEFAULT_LIST_PATH
+        @list_file ||= Droonga.state_dir_path + LiveNodesListObserver::LIST_FILE_NAME
       end
 
       def output_live_nodes

  Modified: lib/droonga/live_nodes_list_observer.rb (+3 -5)
===================================================================
--- lib/droonga/live_nodes_list_observer.rb    2014-05-23 16:29:37 +0900 (2c906f8)
+++ lib/droonga/live_nodes_list_observer.rb    2014-05-23 17:45:21 +0900 (d850599)
@@ -44,9 +44,7 @@ module Droonga
       @listener.stop
     end
 
-    LIST_FILE_NAME = "list.json"
-    OBSERVE_DIR_NAME = "live-nodes"
-    DEFAULT_LIST_PATH = "#{OBSERVE_DIR_NAME}/#{LIST_FILE_NAME}"
+    LIST_FILE_NAME = "live-nodes.json"
 
     def file_path
       @file_path ||= prepare_file_path
@@ -66,8 +64,8 @@ module Droonga
 
     private
     def prepare_file_path
-      path = ENV["DROONGA_LIVE_NODES_LIST"] || DEFAULT_LIST_PATH
-      File.expand_path(path, Droonga.base_path)
+      path = ENV["DROONGA_LIVE_NODES_LIST"] || LIST_FILE_NAME
+      File.expand_path(path, Droonga.state_dir_path)
     end
 
     def log_tag
-------------- next part --------------
HTML����������������������������...
下载 



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