Kouhei Sutou
null+****@clear*****
Fri Nov 22 16:02:40 JST 2013
Kouhei Sutou 2013-11-22 16:02:40 +0900 (Fri, 22 Nov 2013) New Revision: aee56ac95c8e2d4c7a3282eb9b17db22e13159f3 https://github.com/droonga/fluent-plugin-droonga/commit/aee56ac95c8e2d4c7a3282eb9b17db22e13159f3 Message: Remove needless codes from Engine Now "proxy true" is needless in fulentd.conf. Modified files: lib/droonga/engine.rb lib/droonga/executor.rb lib/fluent/plugin/out_droonga.rb sample/cluster/fluentd.conf Modified: lib/droonga/engine.rb (+1 -43) =================================================================== --- lib/droonga/engine.rb 2013-11-22 15:56:53 +0900 (bbe8aae) +++ lib/droonga/engine.rb 2013-11-22 16:02:40 +0900 (ac38685) @@ -15,38 +15,21 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -require "serverengine" -require "msgpack" -require "cool.io" - -require "droonga/server" -require "droonga/worker" require "droonga/executor" module Droonga class Engine - DEFAULT_OPTIONS = { - :queue_name => "DroongaQueue", - :n_workers => 0, - } - def initialize(options={}) - @options = DEFAULT_OPTIONS.merge(options) + @options = options end def start - if @options[:database] && !@options[:database].empty? - Droonga::JobQueue.ensure_schema(@options[:database], - @options[:queue_name]) - end - start_supervisor if @options[:n_workers] > 0 @executor = Executor.new(@options) end def shutdown $log.trace("engine: shutdown: start") @executor.shutdown if @executor - shutdown_supervisor if @supervisor $log.trace("engine: shutdown: done") end @@ -54,30 +37,5 @@ module Droonga $log.trace("[#{Process.pid}] tag: <#{tag}> caller: <#{caller.first}>") @executor.dispatch(tag, time, record, synchronous) end - - private - def start_supervisor - @supervisor = ServerEngine::Supervisor.new(Server, Worker) do - force_options = { - :worker_type => "process", - :workers => @options[:n_workers], - :log_level => $log.level, - :server_process_name => "Server[#{@options[:database]}] #$0", - :worker_process_name => "Worker[#{@options[:database]}] #$0" - } - @options.merge(force_options) - end - @supervisor_thread = Thread.new do - @supervisor.main - end - end - - def shutdown_supervisor - $log.trace("supervisor: shutdown: start") - @supervisor.stop(true) - $log.trace("supervisor: shutdown: stopped") - @supervisor_thread.join - $log.trace("supervisor: shutdown: done") - end end end Modified: lib/droonga/executor.rb (+3 -3) =================================================================== --- lib/droonga/executor.rb 2013-11-22 15:56:53 +0900 (f8b79cc) +++ lib/droonga/executor.rb 2013-11-22 16:02:40 +0900 (2a71839) @@ -34,9 +34,9 @@ module Droonga @options = options @name = options[:name] @database_name = options[:database] - @queue_name = options[:queue_name] - @handler_names = options[:handlers] - @pool_size = options[:n_workers] + @queue_name = options[:queue_name] || "DroongaQueue" + @handler_names = options[:handlers] || [] + @pool_size = options[:n_workers] || 0 # load_handlers Droonga::Plugin.load_all prepare Modified: lib/fluent/plugin/out_droonga.rb (+1 -10) =================================================================== --- lib/fluent/plugin/out_droonga.rb 2013-11-22 15:56:53 +0900 (0551c69) +++ lib/fluent/plugin/out_droonga.rb 2013-11-22 16:02:40 +0900 (39285bd) @@ -22,22 +22,13 @@ module Fluent Plugin.register_output("droonga", self) config_param :name, :string, :default => "" - config_param :proxy, :bool, :default => false - config_param :n_workers, :integer, :default => 0 - config_param :database, :string, :default => "" - config_param :queue_name, :string, :default => "DroongaQueue" config_param :handlers, :default => [] do |value| value.split(/\s*,\s*/) end def start super - @engine = Droonga::Engine.new(:database => @database, - :queue_name => @queue_name, - :n_workers => @n_workers, - :handlers => @handlers, - :name => @name, - :standalone => !@proxy) + @engine = Droonga::Engine.new(:name => @name) @engine.start end Modified: sample/cluster/fluentd.conf (+0 -1) =================================================================== --- sample/cluster/fluentd.conf 2013-11-22 15:56:53 +0900 (e2ac82b) +++ sample/cluster/fluentd.conf 2013-11-22 16:02:40 +0900 (1e26357) @@ -5,7 +5,6 @@ <match droonga.message> name localhost:23003/droonga type droonga - proxy true </match> <match output.message> type stdout -------------- next part -------------- HTML����������������������������...Download