Class: Droonga::JobReceiver

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/droonga/job_receiver.rb

Instance Method Summary collapse

Constructor Details

#initialize(loop, socket_path, &callback) ⇒ JobReceiver

Returns a new instance of JobReceiver.



25
26
27
28
29
# File 'lib/droonga/job_receiver.rb', line 25

def initialize(loop, socket_path, &callback)
  @loop = loop
  @socket_path = socket_path
  @callback = callback
end

Instance Method Details

#shutdownObject



42
43
44
45
46
47
48
# File 'lib/droonga/job_receiver.rb', line 42

def shutdown
  logger.trace("shutdown: start")
  @receiver.close
  logger.trace("shutdown: socket watcher attached",
               :watcher => @receiver)
  logger.trace("shutdown: done")
end

#startObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/droonga/job_receiver.rb', line 31

def start
  logger.trace("start: start")
  @receiver = Coolio::UNIXSocket.connect(@socket_path)
  setup_receive_handler(@receiver)
  @loop.attach(@receiver)
  logger.trace("start: socket watcher attached",
               :watcher     => @receiver,
               :socket_path => @socket_path)
  logger.trace("start: done")
end