Navigation Menu

Skip to content

Commit

Permalink
Make "write" parameter optional for "scatter" also
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 14, 2015
1 parent b686997 commit d9f33a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 3 additions & 6 deletions lib/droonga/distributed_command_planner.rb
Expand Up @@ -64,23 +64,20 @@ def scatter(record, options={})
"type" => "scatter",
"outputs" => [],
"replica" => options[:replica] || "all",
"post" => true
"post" => options[:write] || false,
}
end

def broadcast(options={})
processor = {
@processor = {
"command" => @source_message["type"],
"dataset" => @dataset.name,
"body" => options[:body] || @source_message["body"],
"type" => "broadcast",
"outputs" => [],
"replica" => options[:replica] || "random"
"post" => options[:write] || false,
}
if options[:write]
processor["post"] = true
end
@processor = processor
end

private
Expand Down
5 changes: 4 additions & 1 deletion lib/droonga/planner.rb
Expand Up @@ -33,7 +33,10 @@ def plan(message)
private
def scatter(message, record, options={})
planner = DistributedCommandPlanner.new(@dataset, message)
planner.scatter(record)
scatter_options = {
:write => options[:write],
}
planner.scatter(record, scatter_options)
planner.reduce(options[:reduce])
planner.plan
end
Expand Down

0 comments on commit d9f33a0

Please sign in to comment.