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.
342 343 344 345 |
# File 'lib/groonga-delta/local-delta.rb', line 342 def initialize(config, *args) @config = config super(*args) end |
Instance Method Details
#process_response(response, command) ⇒ Object
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/groonga-delta/local-delta.rb', line 347 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 |