[Groonga-commit] droonga/fluent-plugin-droonga at ff49614 [master] Remove collector and plan configurations from catalog.json

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 7 22:44:13 JST 2014


Kouhei Sutou	2014-02-07 22:44:13 +0900 (Fri, 07 Feb 2014)

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

  Message:
    Remove collector and plan configurations from catalog.json
    
    Because we don't provide plugin API for them. Nobody can write plugins
    for them. So we don't need to provide customization feature of them.
    
    We re-enable them after we provide plugin API for them.
    
    The following collectors and plans are used by default:
    
    planners: ["search", "crud", "groonga", "watch"]
    
    collectors: ["basic", "search"]

  Removed files:
    lib/droonga/collector_options.rb
    lib/droonga/planner_options.rb
    test/unit/collector/test_options.rb
    test/unit/planner/test_options.rb
  Modified files:
    lib/droonga/catalog/base.rb
    lib/droonga/collector.rb
    lib/droonga/dispatcher.rb
    lib/droonga/planner.rb
    sample/cluster/catalog.json
    test/command/config/default/catalog.json
    test/unit/catalog/test_version1.rb
    test/unit/fixtures/catalog/version1.json

  Modified: lib/droonga/catalog/base.rb (+0 -10)
===================================================================
--- lib/droonga/catalog/base.rb    2014-02-07 22:42:11 +0900 (1865758)
+++ lib/droonga/catalog/base.rb    2014-02-07 22:44:13 +0900 (4d599fc)
@@ -16,8 +16,6 @@
 require "digest/sha1"
 require "zlib"
 require "droonga/message_processing_error"
-require "droonga/collector_options"
-require "droonga/planner_options"
 
 module Droonga
   module Catalog
@@ -136,14 +134,6 @@ module Droonga
         end
       end
 
-      def collector_options
-        CollectorOptions.new(@data["collector"])
-      end
-
-      def planner_options
-        PlannerOptions.new(@data["planner"])
-      end
-
       private
       def compute_total_weight(dataset)
         dataset["ring"].reduce(0) do |result, zone|

  Modified: lib/droonga/collector.rb (+2 -3)
===================================================================
--- lib/droonga/collector.rb    2014-02-07 22:42:11 +0900 (9feb2c4)
+++ lib/droonga/collector.rb    2014-02-07 22:44:13 +0900 (d7bcb24)
@@ -20,9 +20,8 @@ module Droonga
   class Collector
     include LegacyPluggable
 
-    def initialize(options)
-      @options = options
-      load_plugins(@options.plugins)
+    def initialize(plugins)
+      load_plugins(plugins)
     end
 
     private

  Deleted: lib/droonga/collector_options.rb (+0 -26) 100644
===================================================================
--- lib/droonga/collector_options.rb    2014-02-07 22:42:11 +0900 (d6de95b)
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2014 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
-
-module Droonga
-  class CollectorOptions
-    def initialize(data)
-      @data = data || {}
-    end
-
-    def plugins
-      @data["plugins"] || []
-    end
-  end
-end

  Modified: lib/droonga/dispatcher.rb (+4 -2)
===================================================================
--- lib/droonga/dispatcher.rb    2014-02-07 22:42:11 +0900 (8b1542c)
+++ lib/droonga/dispatcher.rb    2014-02-07 22:44:13 +0900 (d2cc8ac)
@@ -62,8 +62,10 @@ module Droonga
       @farm = Farm.new(name, @loop, :dispatcher => self)
       @forwarder = Forwarder.new(@loop)
       @replier = Replier.new(@forwarder)
-      @planner = Planner.new(self, Droonga.catalog.planner_options)
-      @collector = Collector.new(Droonga.catalog.collector_options)
+      # TODO: make customizable
+      @planner = Planner.new(self, ["search", "crud", "groonga", "watch"])
+      # TODO: make customizable
+      @collector = Collector.new(["basic", "search"])
     end
 
     def start

  Modified: lib/droonga/planner.rb (+2 -4)
===================================================================
--- lib/droonga/planner.rb    2014-02-07 22:42:11 +0900 (f5947b2)
+++ lib/droonga/planner.rb    2014-02-07 22:44:13 +0900 (03d009e)
@@ -20,11 +20,9 @@ module Droonga
   class Planner
     include LegacyPluggable
 
-    def initialize(dispatcher, options={})
+    def initialize(dispatcher, plugins)
       @dispatcher = dispatcher
-      @plugins = []
-      @options = options
-      load_plugins(@options.plugins)
+      load_plugins(plugins)
     end
 
     private

  Deleted: lib/droonga/planner_options.rb (+0 -26) 100644
===================================================================
--- lib/droonga/planner_options.rb    2014-02-07 22:42:11 +0900 (597780b)
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2014 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
-
-module Droonga
-  class PlannerOptions
-    def initialize(data)
-      @data = data || {}
-    end
-
-    def plugins
-      @data["plugins"] || []
-    end
-  end
-end

  Modified: sample/cluster/catalog.json (+0 -6)
===================================================================
--- sample/cluster/catalog.json    2014-02-07 22:42:11 +0900 (6448075)
+++ sample/cluster/catalog.json    2014-02-07 22:44:13 +0900 (b509fc4)
@@ -37,11 +37,5 @@
         }
       }
     }
-  },
-  "collector": {
-    "plugins": ["basic", "search"]
-  },
-  "planner": {
-    "plugins": ["search", "crud", "groonga", "watch"]
   }
 }

  Modified: test/command/config/default/catalog.json (+0 -6)
===================================================================
--- test/command/config/default/catalog.json    2014-02-07 22:42:11 +0900 (0285fc8)
+++ test/command/config/default/catalog.json    2014-02-07 22:44:13 +0900 (f5995c2)
@@ -54,11 +54,5 @@
         }
       }
     }
-  },
-  "collector": {
-    "plugins": ["basic", "search"]
-  },
-  "planner": {
-    "plugins": ["search", "crud", "groonga", "watch"]
   }
 }

  Modified: test/unit/catalog/test_version1.rb (+0 -53)
===================================================================
--- test/unit/catalog/test_version1.rb    2014-02-07 22:42:11 +0900 (e2465c0)
+++ test/unit/catalog/test_version1.rb    2014-02-07 22:44:13 +0900 (5e52442)
@@ -164,57 +164,4 @@ class CatalogTest < Test::Unit::TestCase
       end
     end
   end
-
-  class CollectorOptionsTest < self
-    def options(data)
-      catalog = create_catalog(minimum_data.merge(data), "base-path")
-      catalog.collector_options
-    end
-
-    class PluginsTest < self
-      def plugins(data)
-        options(data).plugins
-      end
-
-      def test_nothing
-        assert_equal([], plugins({}))
-      end
-
-      def test_collector
-        data = {
-          "collector" => {
-            "plugins" => ["basic", "search"],
-          }
-        }
-        assert_equal(["basic", "search"], plugins(data))
-      end
-    end
-  end
-
-  class PlannerOptionsTest < self
-    def options(data)
-      catalog = create_catalog(minimum_data.merge(data), "base-path")
-      catalog.planner_options
-    end
-
-    class PluginsTest < self
-      def plugins(data)
-        options(data).plugins
-      end
-
-      def test_nothing
-        assert_equal([], plugins({}))
-      end
-
-      def test_planner
-        data = {
-          "planner" => {
-            "plugins" => ["search", "crud", "groonga", "watch"],
-          }
-        }
-        assert_equal(["search", "crud", "groonga", "watch"],
-                     plugins(data))
-      end
-    end
-  end
 end

  Deleted: test/unit/collector/test_options.rb (+0 -37) 100644
===================================================================
--- test/unit/collector/test_options.rb    2014-02-07 22:42:11 +0900 (6dbb935)
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2014 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/collector_options"
-
-class CollectorOptionsTest < Test::Unit::TestCase
-  def options(data)
-    Droonga::CollectorOptions.new(data)
-  end
-
-  class PluginsTest < self
-    def plugins(data)
-      options(data).plugins
-    end
-
-    def test_nothing
-      assert_equal([], plugins({}))
-    end
-
-    def test_have_values
-      assert_equal(["basic", "search"],
-                   plugins("plugins" => ["basic", "search"]))
-    end
-  end
-end

  Modified: test/unit/fixtures/catalog/version1.json (+0 -3)
===================================================================
--- test/unit/fixtures/catalog/version1.json    2014-02-07 22:42:11 +0900 (cd50fc5)
+++ test/unit/fixtures/catalog/version1.json    2014-02-07 22:44:13 +0900 (e7a2e37)
@@ -36,8 +36,5 @@
         }
       }
     }
-  },
-  "options": {
-    "plugins": ["for_global"]
   }
 }

  Deleted: test/unit/planner/test_options.rb (+0 -37) 100644
===================================================================
--- test/unit/planner/test_options.rb    2014-02-07 22:42:11 +0900 (c50e37a)
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2014 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/planner_options"
-
-class PlannerOptionsTest < Test::Unit::TestCase
-  def options(data)
-    Droonga::PlannerOptions.new(data)
-  end
-
-  class PluginsTest < self
-    def plugins(data)
-      options(data).plugins
-    end
-
-    def test_nothing
-      assert_equal([], plugins({}))
-    end
-
-    def test_have_values
-      assert_equal(["search", "crud", "groonga", "watch"],
-                   plugins("plugins" => ["search", "crud", "groonga", "watch"]))
-    end
-  end
-end
-------------- next part --------------
HTML����������������������������...
Download 



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