[Groonga-commit] droonga/fluent-plugin-droonga at 5158e40 [master] collector: remove needless "collector_" prefix from collector commands

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Feb 12 12:37:07 JST 2014


Kouhei Sutou	2014-02-12 12:37:07 +0900 (Wed, 12 Feb 2014)

  New Revision: 5158e40968f1bbd00a3f24d0fc55f8f1936db14b
  https://github.com/droonga/fluent-plugin-droonga/commit/5158e40968f1bbd00a3f24d0fc55f8f1936db14b

  Message:
    collector: remove needless "collector_" prefix from collector commands

  Modified files:
    lib/droonga/plugin/collector/basic.rb
    lib/droonga/plugin/collector/search.rb
    lib/droonga/session.rb
    test/unit/plugin/collector/test_basic.rb
    test/unit/plugin/collector/test_search.rb

  Modified: lib/droonga/plugin/collector/basic.rb (+4 -4)
===================================================================
--- lib/droonga/plugin/collector/basic.rb    2014-02-12 12:34:19 +0900 (df072f0)
+++ lib/droonga/plugin/collector/basic.rb    2014-02-12 12:37:07 +0900 (0b2c9ef)
@@ -23,8 +23,8 @@ module Droonga
 
     UNLIMITED = -1
 
-    command :collector_gather
-    def collector_gather(result)
+    command :gather
+    def gather(result)
       output = body ? body[input_name] : input_name
       if output.is_a?(Hash)
         output = output["output"]
@@ -32,8 +32,8 @@ module Droonga
       emit(output, result)
     end
 
-    command :collector_reduce
-    def collector_reduce(request)
+    command :reduce
+    def reduce(request)
       body[input_name].each do |output, deal|
         left_value = output_values[output]
         right_value = request

  Modified: lib/droonga/plugin/collector/search.rb (+4 -4)
===================================================================
--- lib/droonga/plugin/collector/search.rb    2014-02-12 12:34:19 +0900 (ca57541)
+++ lib/droonga/plugin/collector/search.rb    2014-02-12 12:37:07 +0900 (439515c)
@@ -21,8 +21,8 @@ module Droonga
   class SearchCollector < BasicCollector
     repository.register("search", self)
 
-    command :collector_search_gather
-    def collector_search_gather(result)
+    command :search_gather
+    def search_gather(result)
       output = body ? body[input_name] : input_name
       if output.is_a?(Hash)
         elements = output["elements"]
@@ -71,8 +71,8 @@ module Droonga
       items
     end
 
-    command :collector_search_reduce
-    def collector_search_reduce(request)
+    command :search_reduce
+    def search_reduce(request)
       #XXX This is just a workaround. Errors should be handled by the framework itself.
       if input_name == "errors"
         return collector_reduce(request)

  Modified: lib/droonga/session.rb (+1 -2)
===================================================================
--- lib/droonga/session.rb    2014-02-12 12:34:19 +0900 (f84870a)
+++ lib/droonga/session.rb    2014-02-12 12:37:07 +0900 (c1ffb4b)
@@ -49,8 +49,7 @@ module Droonga
       tasks.each do |task|
         task["n_of_inputs"] += 1
         step = task["step"]
-        type = step["type"]
-        command = "collector_" + type
+        command = step["type"]
         n_of_expects = step["n_of_expects"]
         message = {
           "task"=>task,

  Modified: test/unit/plugin/collector/test_basic.rb (+2 -2)
===================================================================
--- test/unit/plugin/collector/test_basic.rb    2014-02-12 12:34:19 +0900 (3bbf97f)
+++ test/unit/plugin/collector/test_basic.rb    2014-02-12 12:37:07 +0900 (d454e28)
@@ -69,7 +69,7 @@ class BasicCollectorTest < Test::Unit::TestCase
         "name" => data[:mapping],
         "descendants" => nil,
       }
-      @plugin.process("collector_gather", request)
+      @plugin.process("gather", request)
       assert_equal(data[:expected], @outputs.last)
     end
 
@@ -98,7 +98,7 @@ class BasicCollectorTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @plugin.process("collector_reduce", request)
+      @plugin.process("reduce", request)
       assert_equal([
                      output_name,
                      [0, 1, 2, 3, 4, 5],

  Modified: test/unit/plugin/collector/test_search.rb (+6 -6)
===================================================================
--- test/unit/plugin/collector/test_search.rb    2014-02-12 12:34:19 +0900 (92117a3)
+++ test/unit/plugin/collector/test_search.rb    2014-02-12 12:37:07 +0900 (1b184d9)
@@ -318,7 +318,7 @@ class SearchCollectorTest < Test::Unit::TestCase
         "name" => data[:mapping],
         "descendants" => nil,
       }
-      @plugin.process("collector_search_gather", request)
+      @plugin.process("search_gather", request)
       output_name = data[:mapping]
       output_name = output_name["output"] if output_name.is_a?(Hash)
       assert_equal([output_name, data[:expected]], @outputs.last)
@@ -385,7 +385,7 @@ class SearchCollectorTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @plugin.process("collector_search_reduce", request)
+      @plugin.process("search_reduce", request)
       assert_equal([
                      output_name,
                      {
@@ -470,7 +470,7 @@ class SearchCollectorTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @plugin.process("collector_search_reduce", request)
+      @plugin.process("search_reduce", request)
       assert_equal([
                      output_name,
                      {
@@ -551,7 +551,7 @@ class SearchCollectorTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @plugin.process("collector_search_reduce", request)
+      @plugin.process("search_reduce", request)
       assert_equal([
                      output_name,
                      {
@@ -635,7 +635,7 @@ class SearchCollectorTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @plugin.process("collector_search_reduce", request)
+      @plugin.process("search_reduce", request)
       assert_equal([
                      output_name,
                      {
@@ -749,7 +749,7 @@ class SearchCollectorTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @plugin.process("collector_search_reduce", request)
+      @plugin.process("search_reduce", request)
       assert_equal([
                      output_name,
                      {
-------------- next part --------------
HTML����������������������������...
Download 



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