Class: Droonga::Partition

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/partition.rb

Instance Method Summary collapse

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={})
  @options = 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(message)
  $log.trace("partition: process: start")
  @processor.process(message)
  $log.trace("partition: process: done")
end

#shutdownObject



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

#startObject



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