Class: Droonga::ProcessSupervisor

Inherits:
Object
  • Object
show all
Includes:
ProcessControlProtocol
Defined in:
lib/droonga/process_supervisor.rb

Instance Method Summary collapse

Constructor Details

#initialize(loop, input, output) ⇒ ProcessSupervisor

Returns a new instance of ProcessSupervisor.



25
26
27
28
29
30
31
# File 'lib/droonga/process_supervisor.rb', line 25

def initialize(loop, input, output)
  @loop = loop
  @input = create_input(input)
  @output = create_output(output)
  @on_ready = nil
  @on_finish = nil
end

Instance Method Details

#on_finish=(callback) ⇒ Object



55
56
57
# File 'lib/droonga/process_supervisor.rb', line 55

def on_finish=(callback)
  @on_finish = callback
end

#on_ready=(callback) ⇒ Object



51
52
53
# File 'lib/droonga/process_supervisor.rb', line 51

def on_ready=(callback)
  @on_ready = callback
end

#startObject



33
34
35
36
# File 'lib/droonga/process_supervisor.rb', line 33

def start
  @loop.attach(@input)
  @loop.attach(@output)
end

#stopObject



38
39
40
41
# File 'lib/droonga/process_supervisor.rb', line 38

def stop
  @input.close
  @output.close
end

#stop_gracefullyObject



43
44
45
# File 'lib/droonga/process_supervisor.rb', line 43

def stop_gracefully
  @output.write(Messages::STOP_GRACEFUL)
end

#stop_immediatelyObject



47
48
49
# File 'lib/droonga/process_supervisor.rb', line 47

def stop_immediately
  @output.write(Messages::STOP_IMMEDIATELY)
end