YUKI Hiroshi
null+****@clear*****
Thu Jun 26 11:40:43 JST 2014
YUKI Hiroshi 2014-06-26 11:40:43 +0900 (Thu, 26 Jun 2014) New Revision: 5536a78ba1fa376aa43feaf1e072dc05ef6f5bd0 https://github.com/droonga/droonga-engine/commit/5536a78ba1fa376aa43feaf1e072dc05ef6f5bd0 Message: Store list of live nodes to EngineState Modified files: lib/droonga/engine.rb lib/droonga/engine_state.rb Modified: lib/droonga/engine.rb (+3 -6) =================================================================== --- lib/droonga/engine.rb 2014-06-25 17:54:32 +0900 (1976e5a) +++ lib/droonga/engine.rb 2014-06-26 11:40:43 +0900 (41f837f) @@ -32,12 +32,11 @@ module Droonga def initialize(loop, name, internal_name) @state = EngineState.new(loop, name, internal_name) @catalog = load_catalog - @live_nodes =****@catal*****_nodes + @state.catalog = @catalog @dispatcher = create_dispatcher @live_nodes_list_observer = FileObserver.new(loop, Path.live_nodes) @live_nodes_list_observer.on_change = lambda do - @live_nodes = load_live_nodes - @dispatcher.live_nodes = @live_nodes if @dispatcher + @state.live_nodes = load_live_nodes end end @@ -104,9 +103,7 @@ module Droonga end def create_dispatcher - dispatcher = Dispatcher.new(@state, @catalog) - dispatcher.live_nodes = @live_nodes - dispatcher + Dispatcher.new(@state, @catalog) end def output_last_processed_timestamp Modified: lib/droonga/engine_state.rb (+12 -0) =================================================================== --- lib/droonga/engine_state.rb 2014-06-25 17:54:32 +0900 (24d8658) +++ lib/droonga/engine_state.rb 2014-06-26 11:40:43 +0900 (ec12a44) @@ -32,6 +32,8 @@ module Droonga attr_reader :forwarder attr_reader :replier attr_accessor :on_finish + attr_accessor :catalog + attr_accessor :live_nodes def initialize(loop, name, internal_name) @loop = loop @name = name @@ -42,6 +44,8 @@ module Droonga @forwarder.resume @replier = Replier.new(@forwarder) @on_finish = nil + @catalog = nil + @live_nodes = nil end def start @@ -98,6 +102,14 @@ module Droonga not****@sessi*****? end + def all_nodes + @catalog.all_nodes + end + + def live_nodes + @live_nodes || @catalog.all_nodes + end + private def log_tag "engine_state" -------------- next part -------------- HTML����������������������������... 下载