Class: Droonga::Planner
- Inherits:
-
Object
- Object
- Droonga::Planner
- Includes:
- ErrorMessages, Loggable
- Defined in:
- lib/droonga/planner.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collector_class ⇒ Object
writeonly
Sets the attribute collector_class.
-
#single_operation ⇒ Object
writeonly
Sets the attribute single_operation.
-
#use_all_replicas ⇒ Object
writeonly
Sets the attribute use_all_replicas.
-
#write ⇒ Object
writeonly
Sets the attribute write.
Instance Method Summary collapse
-
#initialize(dataset) ⇒ Planner
constructor
A new instance of Planner.
-
#plan(message, params = {}) ⇒ Object
Constructor Details
#initialize(dataset) ⇒ Planner
Returns a new instance of Planner.
27 28 29 30 31 32 33 |
# File 'lib/droonga/planner.rb', line 27 def initialize(dataset) @dataset = dataset @write = false @single_operation = false @use_all_replicas = false @collector_class = nil end |
Instance Attribute Details
#collector_class=(value) ⇒ Object (writeonly)
Sets the attribute collector_class
25 26 27 |
# File 'lib/droonga/planner.rb', line 25 def collector_class=(value) @collector_class = value end |
#single_operation=(value) ⇒ Object (writeonly)
Sets the attribute single_operation
25 26 27 |
# File 'lib/droonga/planner.rb', line 25 def single_operation=(value) @single_operation = value end |
#use_all_replicas=(value) ⇒ Object (writeonly)
Sets the attribute use_all_replicas
25 26 27 |
# File 'lib/droonga/planner.rb', line 25 def use_all_replicas=(value) @use_all_replicas = value end |
#write=(value) ⇒ Object (writeonly)
Sets the attribute write
25 26 27 |
# File 'lib/droonga/planner.rb', line 25 def write=(value) @write = value end |
Instance Method Details
#plan(message, params = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/droonga/planner.rb', line 35 def plan(, params={}) = { :record => params[:record], } #TODO: We don't have to reduce results of the message when # the message doesn't have "replyTo" information, because: # # * Currently the "super step" mecahnism is not # implemented yet. # * So, reduced results won't be forwarded to other # handlers directly. Results will be forwarded to # the sender as the "response". # * So, if "replyTo" information is not given, the # reduced result will have no receiver. # # However, in the future after the "super step" mechanism # is introduced, reduced results can be required even if # the request message have no "replyTo" information. # Then we must update this logic. if @collector_class and ["replyTo"] reduce_key = "result" [:reduce] = { reduce_key => @collector_class.operator, } end if [:record] or single_operation? scatter(, ) else broadcast(, ) end end |