Documentation ¶
Index ¶
- Constants
- func ReadResult(reader io.Reader) (payload []byte, err error)
- func WriteResult(writer io.Writer, result []byte) (n int, err error)
- type Client
- func (client Client) AddProcessGroup(name string) (result bool, err error)
- func (client Client) ClearAllProcessLogs(name string) (result bool, err error)
- func (client Client) ClearLog() (result bool, err error)
- func (client Client) ClearProcessLogs(name string) (result bool, err error)
- func (client Client) Close() error
- func (client Client) GetAllProcessInfo() (info []ProcessInfo, err error)
- func (client Client) GetIdentification() (id string, err error)
- func (client Client) GetPID() (pid int64, err error)
- func (client Client) GetProcessInfo(name string) (info ProcessInfo, err error)
- func (client Client) GetState() (state *SupervisorState, err error)
- func (client Client) GetSupervisorVersion() (version string, err error)
- func (client Client) ReadLog(offset int64, length int64) (log string, err error)
- func (client Client) ReadProcessStderrLog(name string, offset int64, length int64) (log string, err error)
- func (client Client) ReadProcessStdoutLog(name string, offset int64, length int64) (log string, err error)
- func (client Client) ReloadConfig() (info ReloadInfo, err error)
- func (client Client) RemoveProcessGroup(name string) (result bool, err error)
- func (client Client) Restart() (result bool, err error)
- func (client Client) SendProcessStdin(name string, chars string) (result bool, err error)
- func (client Client) SendRemoteCommEvent(typeKey string, data string) (result bool, err error)
- func (client Client) Shutdown() (result bool, err error)
- func (client Client) StartAllProcesses(wait bool) (info []ProcessStatus, err error)
- func (client Client) StartProcess(name string, wait bool) (result bool, err error)
- func (client Client) StartProcessGroup(name string, wait bool) (result bool, err error)
- func (client Client) StopAllProcesses(wait bool) (info []ProcessStatus, err error)
- func (client Client) StopProcess(name string, wait bool) (result bool, err error)
- func (client Client) StopProcessGroup(name string, wait bool) (result bool, err error)
- func (client Client) TailProcessStderrLog(name string, offset int64, length int64) (tail *ProcessTail, err error)
- func (client Client) TailProcessStdoutLog(name string, offset int64, length int64) (tail *ProcessTail, err error)
- type Event
- func (event Event) HeaderInt(key string) int
- func (event Event) MetaInt(key string) int
- func (event Event) Name() string
- func (event Event) Parent() string
- func (event Event) Pool() string
- func (event Event) PoolSerial() int
- func (event Event) Serial() int
- func (event Event) State() string
- func (event Event) String() string
- func (event Event) ToBytes() []byte
- func (event Event) Version() string
- type Listener
- type Monitor
- type Process
- type ProcessAddEvent
- type ProcessInfo
- type ProcessRemoveEvent
- type ProcessStateEvent
- type ProcessStatus
- type ProcessTail
- type ReloadInfo
- type Supervisor
- type SupervisorState
- type SupervisorStateEvent
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ReadResult ¶
ReadResult reads an event result and returns the payload.
Types ¶
type Client ¶
func (Client) AddProcessGroup ¶
AddProcessGroup adds a configured process group to Supervisor.
func (Client) ClearAllProcessLogs ¶
ClearAllProcessLogs clears all logs all processes.
func (Client) ClearProcessLogs ¶
ClearProcessLogs clears all logs for the named process.
func (Client) GetAllProcessInfo ¶
func (client Client) GetAllProcessInfo() (info []ProcessInfo, err error)
GetAllProcessInfo retrieves information for all Supervisor processes.
func (Client) GetIdentification ¶
GetIdentification returns the Supervisor ID string.
func (Client) GetProcessInfo ¶
func (client Client) GetProcessInfo(name string) (info ProcessInfo, err error)
GetProcessInfo retrieves information for a particular Supervisor process.
func (Client) GetState ¶
func (client Client) GetState() (state *SupervisorState, err error)
GetState returns the Supervisor process state.
func (Client) GetSupervisorVersion ¶
GetSupervisorVersion returns the Supervisor version we connect to.
func (Client) ReadProcessStderrLog ¶
func (client Client) ReadProcessStderrLog(name string, offset int64, length int64) (log string, err error)
ReadProcessStderrLog reads the stderr log for the named process.
func (Client) ReadProcessStdoutLog ¶
func (client Client) ReadProcessStdoutLog(name string, offset int64, length int64) (log string, err error)
ReadProcessStdoutLog reads the stdout log for the named process.
func (Client) ReloadConfig ¶
func (client Client) ReloadConfig() (info ReloadInfo, err error)
func (Client) RemoveProcessGroup ¶
RemoveProcessGroup removes a configured process group from Supervisor.
func (Client) SendProcessStdin ¶
SendProcessStdin send data to the stdin of a running process.
func (Client) SendRemoteCommEvent ¶
SendRemoteCommEvent sends an event to Supervisor processes listening to RemoveCommunicationEvents..
func (Client) StartAllProcesses ¶
func (client Client) StartAllProcesses(wait bool) (info []ProcessStatus, err error)
StartAllProcesses tells Supervisor to start all stopped processes.
func (Client) StartProcess ¶
StartProcess tells Supervisor to start the named process.
func (Client) StartProcessGroup ¶
StartProcessGroup tells Supervisor to start all stopped processes in the named group.
func (Client) StopAllProcesses ¶
func (client Client) StopAllProcesses(wait bool) (info []ProcessStatus, err error)
StopAllProcesses teslls Supervisor to stop all running processes.
func (Client) StopProcess ¶
StopProcess tells Supervisor to stop the named process.
func (Client) StopProcessGroup ¶
StopProcessGroup tells Supervisor to start all stopped processes in the named group.
func (Client) TailProcessStderrLog ¶
func (client Client) TailProcessStderrLog(name string, offset int64, length int64) (tail *ProcessTail, err error)
TailProcessStderrLog reads the stderr log for the named process.
func (Client) TailProcessStdoutLog ¶
func (client Client) TailProcessStdoutLog(name string, offset int64, length int64) (tail *ProcessTail, err error)
TailProcessStdoutLog reads the stdout log for the named process.
type Event ¶
Event represents a Supervisor event. An event consists of a header, metadata (meta) and an optional payload.
func ReadEvent ¶
ReadEvent waits for a Supervisor event and returns the parsed event. The err will be non-nil if an error occurred. This may include io.EOF which should preceed closing of the reader.
func (Event) HeaderInt ¶
HeaderInt returns the requested header value as an int or 0 if missing or broken.
func (Event) MetaInt ¶
MetaInt returns the requested meta value as an int or 0 if missing or broken.
func (Event) PoolSerial ¶
PoolSerial returns the serial of the event in the event pool where the event originated.
func (Event) State ¶
State determines the state of the process or supervisor instance based on the name.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
NewListener creates a new event listener with the given in and out streams. The listener will never close the streams.
func (Listener) Read ¶
Read waits for and returns an event from supervisor. An error is returned if the read fails. If EOF is encountered the error will be io.EOF.
func (Listener) Run ¶
Run starts the listener and sends recieved events over the provided channel. It will listen for events until EOF is recieved. This is a simple implementation that will send an OK result followed by a READY after every event is recieved and parsed. If parsing or reading fails for any reason then Run will exit with an error.
type Monitor ¶
type Monitor struct { Client Client Listener Listener Supervisor *Supervisor Processes map[string]*Process // contains filtered or unexported fields }
func NewMonitor ¶
func NewMonitor(url string, in io.Reader, out io.Writer, events chan interface{}) (mon Monitor, err error)
NewMonitor creates a new Supervisor monitor.
type ProcessAddEvent ¶
type ProcessAddEvent struct { Supervisor Supervisor Process Process }
ProcessAddEvent is emitted when a process is added to Supervisor.
type ProcessInfo ¶
type ProcessInfo struct { Name string Description string Group string Start int64 Stop int64 Now int64 State int64 StateName string SpawnErr string ExitStatus int64 Logfile string StdoutLogfile string StderrLogfile string PID int64 }
func (ProcessInfo) String ¶
func (info ProcessInfo) String() string
type ProcessRemoveEvent ¶
type ProcessRemoveEvent ProcessAddEvent
ProcessRemoveEvent is emitted when a process is removed from Supervisor.
type ProcessStateEvent ¶
type ProcessStateEvent struct { Supervisor Supervisor Process Process FromState string Tries int }
ProcessStateEvent is emitted when a process changes state.
type ProcessStatus ¶
func (ProcessStatus) String ¶
func (status ProcessStatus) String() string
type ProcessTail ¶
func (ProcessTail) String ¶
func (tail ProcessTail) String() string
type ReloadInfo ¶
type ReloadInfo struct {
Added, Changed, Removed []string
}
func (ReloadInfo) String ¶
func (info ReloadInfo) String() string
type Supervisor ¶
func NewSupervisor ¶
func NewSupervisor() *Supervisor
type SupervisorState ¶
func (SupervisorState) String ¶
func (state SupervisorState) String() string
type SupervisorStateEvent ¶
type SupervisorStateEvent struct { Supervisor Supervisor FromName string FromState string }
SupervisorStateEvent is emitted when the Supervisor instance changes state.