Module: RubySupervisor::GlobalAPI
- Included in:
- Client
- Defined in:
- lib/ruby-supervisor/api/global.rb
Constant Summary collapse
- STATE_TO_STR =
returned by get_state
{ 2 => :fatal, 1 => :running, 0 => :restarting, -1 => :shutdown }.freeze
Instance Method Summary collapse
-
#api_version ⇒ String
Return the API Version.
-
#clear_log ⇒ Object
Clear the supervisor logs.
-
#clear_processes_logs ⇒ Object
Clear logs for all processes.
-
#identification ⇒ String
(also: #identifier)
Return supervisor identifying string.
-
#pid ⇒ Integer
Return supervisor pid.
-
#processes ⇒ Array
Return informations for all defined processes.
-
#read_log(offset, length) ⇒ String
Read a chunk of the supervisor logs.
-
#restart ⇒ Object
Restart the supervisor process.
-
#send_remote_comm_event(type, data) ⇒ Object
Send an event that will be received by event listener subprocesses subscribing to the RemoteCommunicationEvent.
-
#shutdown ⇒ Object
Shutdown the supervisor process.
-
#start_processes(wait = true) ⇒ Object
Start all processes.
-
#state ⇒ Symbol
Return supervisor current state.
-
#stop_processes(wait = true) ⇒ Object
Stop all processes.
-
#version ⇒ String
Return supervisor version.
Instance Method Details
#api_version ⇒ String
Return the API Version.
23 24 25 |
# File 'lib/ruby-supervisor/api/global.rb', line 23 def api_version request('getAPIVersion') end |
#clear_log ⇒ Object
Clear the supervisor logs.
118 119 120 |
# File 'lib/ruby-supervisor/api/global.rb', line 118 def clear_log request('clearLog') end |
#clear_processes_logs ⇒ Object
Clear logs for all processes.
99 100 101 |
# File 'lib/ruby-supervisor/api/global.rb', line 99 def clear_processes_logs request('clearAllProcessesLogs') end |
#identification ⇒ String Also known as: identifier
Return supervisor identifying string. Aliased as identifier.
42 43 44 |
# File 'lib/ruby-supervisor/api/global.rb', line 42 def identification request('getIdentification') end |
#pid ⇒ Integer
Return supervisor pid.
52 53 54 |
# File 'lib/ruby-supervisor/api/global.rb', line 52 def pid request('getPID') end |
#processes ⇒ Array
Return informations for all defined processes.
72 73 74 |
# File 'lib/ruby-supervisor/api/global.rb', line 72 def processes request('getAllProcessInfo') end |
#read_log(offset, length) ⇒ String
Read a chunk of the supervisor logs.
111 112 113 |
# File 'lib/ruby-supervisor/api/global.rb', line 111 def read_log(offset, length) request('readLog', offset, length) end |
#restart ⇒ Object
Restart the supervisor process.
125 126 127 |
# File 'lib/ruby-supervisor/api/global.rb', line 125 def restart request('restart') end |
#send_remote_comm_event(type, data) ⇒ Object
Send an event that will be received by event listener subprocesses subscribing to the RemoteCommunicationEvent
140 141 142 |
# File 'lib/ruby-supervisor/api/global.rb', line 140 def send_remote_comm_event(type, data) request('sendRemoteCommEvent', type, data) end |
#shutdown ⇒ Object
Shutdown the supervisor process.
132 133 134 |
# File 'lib/ruby-supervisor/api/global.rb', line 132 def shutdown request('shutdown') end |
#start_processes(wait = true) ⇒ Object
Start all processes.
82 83 84 |
# File 'lib/ruby-supervisor/api/global.rb', line 82 def start_processes(wait = true) request('startAllProcesses', wait) end |
#state ⇒ Symbol
Return supervisor current state.
61 62 63 64 |
# File 'lib/ruby-supervisor/api/global.rb', line 61 def state ret = request('getState') STATE_TO_STR[ ret['statecode'] ] end |
#stop_processes(wait = true) ⇒ Object
Stop all processes.
92 93 94 |
# File 'lib/ruby-supervisor/api/global.rb', line 92 def stop_processes(wait = true) request('stopAllProcesses', wait) end |
#version ⇒ String
Return supervisor version.
32 33 34 |
# File 'lib/ruby-supervisor/api/global.rb', line 32 def version request('getSupervisorVersion') end |