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