Navigation Menu

Skip to content

Commit

Permalink
Validate partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Feb 12, 2014
1 parent 4265dc5 commit ba3b256
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/droonga/catalog/base.rb
Expand Up @@ -253,6 +253,21 @@ def validate_ring(ring, name)
validate_parameter_type(ring, name, Hash)

validate_positive_numeric_parameter(ring["weight"], "#{name}.weight")

validate_parameter_type(ring["partitions"],
"#{name}.partitions",
Hash)
ring["partitions"].each do |key, value|
validate_ring(value, "#{name}.partitions.#{key}")
end
end

def validate_partition(partition, name)
validate_parameter_type(partition, name, Array)

partition.each_with_index do |value, index|
validate_parameter_type(value, "#{name}[#{index}]", String)
end
end
end
end
Expand Down

0 comments on commit ba3b256

Please sign in to comment.