Class: Droonga::ProcessSupervisor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Deferrable

#wait_until_ready

Constructor Details

#initialize(loop, input, output) ⇒ ProcessSupervisor

Returns a new instance of ProcessSupervisor.



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

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

Instance Attribute Details

#on_finish=(value) ⇒ Object

Sets the attribute on_finish

Parameters:

  • value

    the value to set the attribute on_finish to.



29
30
31
# File 'lib/droonga/process_supervisor.rb', line 29

def on_finish=(value)
  @on_finish = value
end

Instance Method Details

#refresh_node_referenceObject



73
74
75
76
77
# File 'lib/droonga/process_supervisor.rb', line 73

def refresh_node_reference
  logger.trace("refresh_node_reference: start")
  @output.write(Messages::REFRESH_NODE_REFERENCE)
  logger.trace("refresh_node_reference: done")
end

#refresh_self_referenceObject



67
68
69
70
71
# File 'lib/droonga/process_supervisor.rb', line 67

def refresh_self_reference
  logger.trace("refresh_self_reference: start")
  @output.write(Messages::REFRESH_SELF_REFERENCE)
  logger.trace("refresh_self_reference: done")
end

#startObject



37
38
39
40
41
42
43
44
# File 'lib/droonga/process_supervisor.rb', line 37

def start
  @loop.attach(@input)
  logger.trace("start: input watcher attached",
               :watcher => @input)
  @loop.attach(@output)
  logger.trace("start: output watcher attached",
               :watcher => @output)
end

#stopObject



46
47
48
49
50
51
52
53
# File 'lib/droonga/process_supervisor.rb', line 46

def stop
  @input.close
  logger.trace("stop: input watcher detached",
               :watcher => @input)
  @output.close
  logger.trace("stop: output watcher detached",
               :watcher => @output)
end

#stop_gracefullyObject



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

def stop_gracefully
  logger.trace("stop_gracefully: start")
  @output.write(Messages::STOP_GRACEFUL)
  logger.trace("stop_gracefully: done")
end

#stop_immediatelyObject



61
62
63
64
65
# File 'lib/droonga/process_supervisor.rb', line 61

def stop_immediately
  logger.trace("stop_immediately: start")
  @output.write(Messages::STOP_IMMEDIATELY)
  logger.trace("stop_immediately: done")
end