Class: GroongaDelta::LocalDelta::CommandProcessor
- Inherits:
-
Groonga::Client::CommandProcessor
- Object
- Groonga::Client::CommandProcessor
- GroongaDelta::LocalDelta::CommandProcessor
- Defined in:
- lib/groonga-delta/local-delta.rb
Instance Method Summary collapse
-
#initialize(config, *args) ⇒ CommandProcessor
constructor
A new instance of CommandProcessor.
- #process_response(response, command) ⇒ Object
Constructor Details
#initialize(config, *args) ⇒ CommandProcessor
Returns a new instance of CommandProcessor.
72 73 74 75 |
# File 'lib/groonga-delta/local-delta.rb', line 72 def initialize(config, *args) @config = config super(*args) end |
Instance Method Details
#process_response(response, command) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/groonga-delta/local-delta.rb', line 77 def process_response(response, command) = "" case command.command_name when "load" command.arguments.delete(:values) if response.success? = "#{response.n_loaded_records}: " else load_response = Groonga::Client::Response::Load.new(command, response.header, response.body) = "#{load_response.n_loaded_records}: " end end if response.success? @config.logger.info("Processed: " + "#{response.elapsed_time}: " + "#{command.command_name}: " + + "#{command.to_command_format}") else = "Failed to process: " + "#{response.return_code}: " + "#{response.elapsed_time}: " + "#{response.}: " + "#{command.command_name}: " + + "#{command.to_command_format}" case @config.on_error when "ignore" when "warning" @config.logger.warn() when "error" raise ExecutionError, end end end |