YUKI Hiroshi
null+****@clear*****
Fri Apr 10 12:17:37 JST 2015
YUKI Hiroshi 2015-04-10 12:17:37 +0900 (Fri, 10 Apr 2015) New Revision: c9024ea408a5eb8e011ba0cc10e5fff75c9df614 https://github.com/droonga/drndump/commit/c9024ea408a5eb8e011ba0cc10e5fff75c9df614 Message: Don't store Loop by Dumper itself. It is just for the client. Modified files: lib/drndump/command.rb lib/drndump/dumper.rb Modified: lib/drndump/command.rb (+2 -2) =================================================================== --- lib/drndump/command.rb 2015-04-10 12:14:38 +0900 (bf8382c) +++ lib/drndump/command.rb 2015-04-10 12:17:37 +0900 (c726cf4) @@ -105,12 +105,12 @@ module Drndump end def dump - @dumper = Dumper.new(@loop, - :host => @host, + @dumper = Dumper.new(:host => @host, :port => @port, :tag => @tag, :receiver_host => @receiver_host, :receiver_port => @receiver_port) + @dumper.run(:loop => @loop) @loop.run @dumper.error_message end Modified: lib/drndump/dumper.rb (+4 -9) =================================================================== --- lib/drndump/dumper.rb 2015-04-10 12:14:38 +0900 (432adec) +++ lib/drndump/dumper.rb 2015-04-10 12:17:37 +0900 (3782027) @@ -26,9 +26,7 @@ module Drndump class Dumper attr_reader :error_message - def initialize(loop, params) - @loop = loop - + def initialize(params) @host = params[:host] || "localhost" @port = params[:port] || 10031 @tag = params[:tag] || "droonga" @@ -36,13 +34,10 @@ module Drndump @receiver_host = params[:receiver_host] || Socket.gethostname @receiver_port = params[:receiver_port] || 0 - - prepare end - private - def prepare - client = Droonga::Client.new(client_options) + def run(loop) + client = Droonga::Client.new(client_options.merge(:loop => loop)) @error_message = nil n_dumpers = 0 @@ -85,6 +80,7 @@ module Drndump end end + private def client_options { :host => @host, @@ -94,7 +90,6 @@ module Drndump :receiver_host => @receiver_host, :receiver_port => @receiver_port, :backend => :coolio, - :loop => @loop, } end -------------- next part -------------- HTML����������������������������... 下载