Class: Droonga::ProcessSupervisor
- Inherits:
-
Object
- Object
- Droonga::ProcessSupervisor
- Includes:
- ProcessControlProtocol
- Defined in:
- lib/droonga/process_supervisor.rb
Instance Method Summary collapse
-
#initialize(loop, input, output) ⇒ ProcessSupervisor
constructor
A new instance of ProcessSupervisor.
- #on_finish=(callback) ⇒ Object
- #on_ready=(callback) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #stop_gracefully ⇒ Object
- #stop_immediately ⇒ Object
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 |
#start ⇒ Object
33 34 35 36 |
# File 'lib/droonga/process_supervisor.rb', line 33 def start @loop.attach(@input) @loop.attach(@output) end |
#stop ⇒ Object
38 39 40 41 |
# File 'lib/droonga/process_supervisor.rb', line 38 def stop @input.close @output.close end |
#stop_gracefully ⇒ Object
43 44 45 |
# File 'lib/droonga/process_supervisor.rb', line 43 def stop_gracefully @output.write(Messages::STOP_GRACEFUL) end |
#stop_immediately ⇒ Object
47 48 49 |
# File 'lib/droonga/process_supervisor.rb', line 47 def stop_immediately @output.write(Messages::STOP_IMMEDIATELY) end |