Class: Droonga::WorkerProcessAgent
- Inherits:
-
Object
- Object
- Droonga::WorkerProcessAgent
- Includes:
- Loggable, ProcessControlProtocol
- Defined in:
- lib/droonga/worker_process_agent.rb
Instance Method Summary collapse
-
#initialize(loop, input, output) ⇒ WorkerProcessAgent
constructor
A new instance of WorkerProcessAgent.
- #on_refresh_node_reference=(callback) ⇒ Object
- #on_refresh_self_reference=(callback) ⇒ Object
- #on_stop_gracefully=(callback) ⇒ Object
- #on_stop_immediately=(callback) ⇒ Object
- #ready ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(loop, input, output) ⇒ WorkerProcessAgent
Returns a new instance of WorkerProcessAgent.
27 28 29 30 31 |
# File 'lib/droonga/worker_process_agent.rb', line 27 def initialize(loop, input, output) @loop = loop create_input(input) create_output(output) end |
Instance Method Details
#on_refresh_node_reference=(callback) ⇒ Object
80 81 82 |
# File 'lib/droonga/worker_process_agent.rb', line 80 def on_refresh_node_reference=(callback) @on_refresh_node_reference = callback end |
#on_refresh_self_reference=(callback) ⇒ Object
76 77 78 |
# File 'lib/droonga/worker_process_agent.rb', line 76 def on_refresh_self_reference=(callback) @on_refresh_self_reference = callback end |
#on_stop_gracefully=(callback) ⇒ Object
68 69 70 |
# File 'lib/droonga/worker_process_agent.rb', line 68 def on_stop_gracefully=(callback) @on_stop_gracefully = callback end |
#on_stop_immediately=(callback) ⇒ Object
72 73 74 |
# File 'lib/droonga/worker_process_agent.rb', line 72 def on_stop_immediately=(callback) @on_stop_immediately = callback end |
#ready ⇒ Object
64 65 66 |
# File 'lib/droonga/worker_process_agent.rb', line 64 def ready @output.write(Messages::READY) end |
#start ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/droonga/worker_process_agent.rb', line 33 def start logger.trace("start: start") @loop.attach(@input) # logger.trace("start: new input watcher attached", # :watcher => @input) @loop.attach(@output) # logger.trace("start: new output watcher attached", # :watcher => @output) logger.trace("start: done") end |
#stop ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/droonga/worker_process_agent.rb', line 44 def stop logger.trace("stop: start") if @output @output, output = nil, @output output.write(Messages::FINISH) output.on_write_complete do output.close logger.trace("stop: output detached", :watcher => output) end end if @input @input, input = nil, @input input.close logger.trace("stop: input detached", :watcher => input) end logger.trace("stop: done") end |