Class: Zeus::Server::ProcessTreeMonitor

Inherits:
Object
  • Object
show all
Includes:
ChildProcessApi
Defined in:
lib/zeus/server/process_tree_monitor.rb

Defined Under Namespace

Modules: ChildProcessApi

Constant Summary collapse

STARTING_MARKER =
"P"
FEATURE_MARKER =
"F"

Instance Method Summary collapse

Methods included from ChildProcessApi

#__CHILD__stage_has_feature, #__CHILD__stage_starting_with_pid

Constructor Details

#initialize(file_monitor, tree) ⇒ ProcessTreeMonitor

Returns a new instance of ProcessTreeMonitor.



12
13
14
15
16
17
# File 'lib/zeus/server/process_tree_monitor.rb', line 12

def initialize(file_monitor, tree)
  @root = tree
  @file_monitor = file_monitor

  @sock, @__CHILD__sock = open_socketpair
end

Instance Method Details

#close_child_socketObject



9
# File 'lib/zeus/server/process_tree_monitor.rb', line 9

def close_child_socket  ; @__CHILD__sock.close ; end

#close_parent_socketObject



10
# File 'lib/zeus/server/process_tree_monitor.rb', line 10

def close_parent_socket ; @sock.close ; end

#datasourceObject



7
# File 'lib/zeus/server/process_tree_monitor.rb', line 7

def datasource          ; @sock ; end

#kill_all_nodesObject



23
24
25
# File 'lib/zeus/server/process_tree_monitor.rb', line 23

def kill_all_nodes
  @root.kill!
end

#kill_nodes_with_feature(file) ⇒ Object



19
20
21
# File 'lib/zeus/server/process_tree_monitor.rb', line 19

def kill_nodes_with_feature(file)
  @root.kill_nodes_with_feature(file)
end

#on_datasource_eventObject



8
# File 'lib/zeus/server/process_tree_monitor.rb', line 8

def on_datasource_event ; handle_messages ; end