Class: Droonga::Processor
- Inherits:
-
Object
- Object
- Droonga::Processor
- Defined in:
- lib/droonga/processor.rb
Instance Method Summary collapse
-
#initialize(loop, message_pusher, options = {}) ⇒ Processor
constructor
A new instance of Processor.
- #process(message) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(loop, message_pusher, options = {}) ⇒ Processor
Returns a new instance of Processor.
22 23 24 25 26 27 |
# File 'lib/droonga/processor.rb', line 22 def initialize(loop, , ={}) @loop = loop = = @n_workers = [:n_workers] || 0 end |
Instance Method Details
#process(message) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/droonga/processor.rb', line 40 def process() $log.trace("#{log_tag}: process: start") command = ["type"] if @handler.processable?(command) $log.trace("#{log_tag}: process: handlable: #{command}") synchronous = @handler.prefer_synchronous?(command) if @n_workers.zero? or synchronous @handler.process() else .push() end else $log.trace("#{log_tag}: process: ignore #{command}") end $log.trace("#{log_tag}: process: done") end |
#shutdown ⇒ Object
34 35 36 37 38 |
# File 'lib/droonga/processor.rb', line 34 def shutdown $log.trace("#{log_tag}: shutdown: start") @handler.shutdown $log.trace("#{log_tag}: shutdown: done") end |
#start ⇒ Object
29 30 31 32 |
# File 'lib/droonga/processor.rb', line 29 def start @handler = Handler.new(@loop, ) @handler.start end |