Class: Droonga::Slice
Instance Method Summary collapse
-
#initialize(loop, options = {}) ⇒ Slice
constructor
A new instance of Slice.
- #process(message) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(loop, options = {}) ⇒ Slice
Returns a new instance of Slice.
29 30 31 32 33 34 35 36 |
# File 'lib/droonga/slice.rb', line 29 def initialize(loop, ={}) = @n_workers = [:n_workers] || 0 @loop = loop @job_pusher = JobPusher.new(@loop, [:database]) @processor = Processor.new(@loop, @job_pusher, ) @supervisor = nil end |
Instance Method Details
#process(message) ⇒ Object
53 54 55 56 57 |
# File 'lib/droonga/slice.rb', line 53 def process() logger.trace("process: start") @processor.process() logger.trace("process: done") end |
#shutdown ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/droonga/slice.rb', line 45 def shutdown logger.trace("shutdown: start") shutdown_supervisor if @supervisor @job_pusher.shutdown @processor.shutdown logger.trace("shutdown: done") end |
#start ⇒ Object
38 39 40 41 42 43 |
# File 'lib/droonga/slice.rb', line 38 def start ensure_database @processor.start @job_pusher.start start_supervisor if @n_workers > 0 end |