[Groonga-commit] droonga/fluent-plugin-droonga at 4265dc5 [master] Validate datasets recursively

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Feb 12 15:37:37 JST 2014


YUKI Hiroshi	2014-02-12 15:37:37 +0900 (Wed, 12 Feb 2014)

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

  Message:
    Validate datasets recursively

  Modified files:
    lib/droonga/catalog/base.rb

  Modified: lib/droonga/catalog/base.rb (+7 -2)
===================================================================
--- lib/droonga/catalog/base.rb    2014-02-12 15:35:35 +0900 (b9bad0a)
+++ lib/droonga/catalog/base.rb    2014-02-12 15:37:37 +0900 (f68e940)
@@ -64,13 +64,11 @@ module Droonga
         validate_datasets
 
         @data["datasets"].each do |name, dataset|
-          validate_dataset(dataset, "datasets.#{name}")
           number_of_partitions = dataset["number_of_partitions"]
           next if number_of_partitions < 2
           total_weight = compute_total_weight(dataset)
           continuum = []
           dataset["ring"].each do |key, value|
-            validate_ring(value, "datasets.ring.#{key}")
             points = number_of_partitions * 160 * value["weight"] / total_weight
             points.times do |point|
               hash = Digest::SHA1.hexdigest("#{key}:#{point}")
@@ -223,6 +221,10 @@ module Droonga
 
         raise MissingRequiredParameter.new("datasets", @path) unless datasets
         validate_parameter_type(datasets, "datasets", Hash)
+
+        datasets.each do |name, dataset|
+          validate_dataset(dataset, "datasets.#{name}")
+        end
       end
 
       def validate_dataset(dataset, name)
@@ -238,6 +240,9 @@ module Droonga
         validate_parameter_type(dataset["ring"],
                                 "#{name}.ring",
                                 Hash)
+        dataset["ring"].each do |key, value|
+          validate_ring(value, "#{name}.ring.#{key}")
+        end
 
         validate_parameter_type(dataset["plugins"],
                                 "#{name}.plugins",
-------------- next part --------------
HTML����������������������������...
Download 



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