[Groonga-commit] groonga/fluent-plugin-droonga at 8f2ff6d [master] Add handler_proxy.rb

Back to archive index

Daijiro MORI null+****@clear*****
Wed Aug 14 10:32:22 JST 2013


Daijiro MORI	2013-08-14 10:32:22 +0900 (Wed, 14 Aug 2013)

  New Revision: 8f2ff6dee4b98eb0c775174a2a0a97ff6dbcd7f4
  https://github.com/groonga/fluent-plugin-droonga/commit/8f2ff6dee4b98eb0c775174a2a0a97ff6dbcd7f4

  Message:
    Add handler_proxy.rb

  Added files:
    lib/droonga/plugin/handler_proxy.rb
  Modified files:
    lib/droonga/worker.rb
    lib/fluent/plugin/out_droonga.rb

  Added: lib/droonga/plugin/handler_proxy.rb (+36 -0) 100644
===================================================================
--- /dev/null
+++ lib/droonga/plugin/handler_proxy.rb    2013-08-14 10:32:22 +0900 (5ca24de)
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013 droonga project
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# 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 "droonga/handler"
+require "droonga/proxy"
+
+module Droonga
+  class ProxyHandler < Droonga::Handler
+    Droonga::HandlerPlugin.register("proxy", self)
+
+    def initialize(*arguments)
+      super
+      @proxy = Droonga::Proxy.new(@worker, @worker.name)
+    end
+
+    command :proxy
+
+    def proxy(request, *arguments)
+      @proxy.handle(request)
+    end
+  end
+end

  Modified: lib/droonga/worker.rb (+2 -1)
===================================================================
--- lib/droonga/worker.rb    2013-08-14 10:26:04 +0900 (7dae90e)
+++ lib/droonga/worker.rb    2013-08-14 10:32:22 +0900 (3020f62)
@@ -26,12 +26,13 @@ require "droonga/catalog"
 
 module Droonga
   class Worker
-    attr_reader :context, :envelope
+    attr_reader :context, :envelope, :name
 
     def initialize(options={})
       @pool = []
       @handlers = []
       @outputs = {}
+      @name = options[:name]
       @database_name = options[:database] || "droonga/db"
       @queue_name = options[:queue_name] || "DroongaQueue"
       Droonga::JobQueue.ensure_schema(@database_name, @queue_name)

  Modified: lib/fluent/plugin/out_droonga.rb (+3 -1)
===================================================================
--- lib/fluent/plugin/out_droonga.rb    2013-08-14 10:26:04 +0900 (89bb95a)
+++ lib/fluent/plugin/out_droonga.rb    2013-08-14 10:32:22 +0900 (5b985a1)
@@ -21,6 +21,7 @@ module Fluent
   class DroongaOutput < Output
     Plugin.register_output("droonga", self)
 
+    config_param :name, :string, :default => ""
     config_param :n_workers, :integer, :default => 1
     config_param :database, :string, :default => "droonga/db"
     config_param :queue_name, :string, :default => "DroongaQueue"
@@ -33,7 +34,8 @@ module Fluent
       @worker = Droonga::Worker.new(:database => @database,
                                     :queue_name => @queue_name,
                                     :pool_size => @n_workers,
-                                    :handlers => @handlers)
+                                    :handlers => @handlers,
+                                    :name => @name)
     end
 
     def shutdown
-------------- next part --------------
HTML����������������������������...
Download 



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