Class: Droonga::GroongaCollector
- Inherits:
-
BasicCollector
- Object
- Plugin
- CollectorPlugin
- BasicCollector
- Droonga::GroongaCollector
- Defined in:
- lib/droonga/plugin/collector/groonga.rb
Constant Summary
Constants inherited from BasicCollector
Instance Attribute Summary
Attributes inherited from CollectorPlugin
#body, #component, #input_name, #output_names, #output_values, #task
Instance Method Summary collapse
- #collector_groonga_gather(result) ⇒ Object
- #collector_groonga_reduce(request) ⇒ Object
- #merge_groonga_header(left_header, right_header) ⇒ Object
- #merge_groonga_result(left_value, right_value) ⇒ Object
- #reduce(deal, left_value, right_value) ⇒ Object
Methods inherited from BasicCollector
#apply_output_range, #collector_gather, #collector_reduce, #compare, #merge, #normalize_operators, #sum, #unify_by_key!
Methods inherited from CollectorPlugin
Methods included from PluginRegisterable
#command, extended, #inherited, #method_name, #processable?, #repository
Methods inherited from Plugin
#initialize, #process, #processable?, #shutdown, #start
Constructor Details
This class inherits a constructor from Droonga::CollectorPlugin
Instance Method Details
#collector_groonga_gather(result) ⇒ Object
25 26 27 |
# File 'lib/droonga/plugin/collector/groonga.rb', line 25 def collector_groonga_gather(result) collector_gather(result) end |
#collector_groonga_reduce(request) ⇒ Object
30 31 32 |
# File 'lib/droonga/plugin/collector/groonga.rb', line 30 def collector_groonga_reduce(request) collector_reduce(request) end |
#merge_groonga_header(left_header, right_header) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/droonga/plugin/collector/groonga.rb', line 63 def merge_groonga_header(left_header, right_header) status = [left_header.shift, right_header.shift].min start_time = reduce({ "type" => "average" }, left_header.shift, right_header.shift) elapsed_time = reduce({ "type" => "average" }, left_header.shift, right_header.shift) #XXX we should merge error informations more smarter... error_information = reduce({ "type" => "sum", "limit" => UNLIMITED }, left_header, right_header) [status, start_time, elapsed_time] + error_information end |
#merge_groonga_result(left_value, right_value) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/droonga/plugin/collector/groonga.rb', line 50 def merge_groonga_result(left_value, right_value) result = [] result << merge_groonga_header(left_value.shift, right_value.shift) left_value.each_with_index do |left, index| right = right_value[index] result << reduce({ "type" => "and" }, left, right) end result end |
#reduce(deal, left_value, right_value) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/droonga/plugin/collector/groonga.rb', line 34 def reduce(deal, left_value, right_value) reduced_value = nil case deal["type"] when "groonga_result" #XXX how to merge multiple erros? #XXX how to mix regular results and erros? # reduced_value = merge_groonga_result(left_value, right_value) reduced_value = left_value || right_value else reduced_value = super end reduced_value end |