events

package module
v0.0.0-...-1584cb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// EventSysVersion the event system version
	EventSysVersion = "3.0"

	// ProcCommonBeginStr the process communication begin
	ProcCommonBeginStr = "<!--XSUPERVISOR:BEGIN-->"

	// ProcCommonEndStr the process communication end
	ProcCommonEndStr = "<!--XSUPERVISOR:END-->"
)

Variables

This section is empty.

Functions

func EmitEvent

func EmitEvent(event Event)

EmitEvent emits event to default event listener manager

func RegisterEventListener

func RegisterEventListener(eventListenerName string,
	events []string,
	listener *EventListener)

RegisterEventListener registers event listener to accept the emitted events

Types

type BaseEvent

type BaseEvent struct {
	// contains filtered or unexported fields
}

BaseEvent the base event, all other events should inherit this BaseEvent to implement the Event interface

func (*BaseEvent) GetSerial

func (be *BaseEvent) GetSerial() uint64

GetSerial returns serial number of event

func (*BaseEvent) GetType

func (be *BaseEvent) GetType() string

GetType returns type of given event

type Event

type Event interface {
	GetSerial() uint64
	GetType() string
	GetBody() string
}

Event the event interface definition

type EventListener

type EventListener struct {
	// contains filtered or unexported fields
}

EventListener the event listener object

func NewEventListener

func NewEventListener(pool string,
	server string,
	stdin io.Reader,
	stdout io.Writer,
	bufferSize int) *EventListener

NewEventListener creates NewEventListener object

func UnregisterEventListener

func UnregisterEventListener(eventListenerName string) *EventListener

UnregisterEventListener unregisters event listener by its name

func (*EventListener) HandleEvent

func (el *EventListener) HandleEvent(event Event)

HandleEvent handles emitted event

type EventListenerManager

type EventListenerManager struct {
	// contains filtered or unexported fields
}

EventListenerManager manage the event listeners

func NewEventListenerManager

func NewEventListenerManager() *EventListenerManager

NewEventListenerManager creates EventListenerManager object

func (*EventListenerManager) EmitEvent

func (em *EventListenerManager) EmitEvent(event Event)

EmitEvent emits event to all listeners managed by this manager

type EventPoolSerial

type EventPoolSerial struct {
	sync.Mutex
	// contains filtered or unexported fields
}

EventPoolSerial manage the event serial generation

func NewEventPoolSerial

func NewEventPoolSerial() *EventPoolSerial

NewEventPoolSerial creates new EventPoolSerial object

type ProcCommEvent

type ProcCommEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

ProcCommEvent process communication event definition

func NewProcCommEvent

func NewProcCommEvent(eventType string,
	procName string,
	groupName string,
	pid int,
	data string) *ProcCommEvent

NewProcCommEvent creates new ProcCommEvent object

func (*ProcCommEvent) GetBody

func (p *ProcCommEvent) GetBody() string

GetBody returns process communication event' body

type ProcCommEventCapture

type ProcCommEventCapture struct {
	// contains filtered or unexported fields
}

ProcCommEventCapture process communication event capture

func NewProcCommEventCapture

func NewProcCommEventCapture(reader io.Reader,
	captureMaxBytes int,
	stdType string,
	procName string,
	groupName string) *ProcCommEventCapture

NewProcCommEventCapture creates new ProcCommEventCapture object

func (*ProcCommEventCapture) SetPid

func (pec *ProcCommEventCapture) SetPid(pid int)

SetPid sets pid of the program

type ProcessGroupEvent

type ProcessGroupEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

ProcessGroupEvent the process group event definition

func CreateProcessGroupAddedEvent

func CreateProcessGroupAddedEvent(groupName string) *ProcessGroupEvent

CreateProcessGroupAddedEvent emits create process group added event

func CreateProcessGroupRemovedEvent

func CreateProcessGroupRemovedEvent(groupName string) *ProcessGroupEvent

CreateProcessGroupRemovedEvent emits create process group removed event

func (*ProcessGroupEvent) GetBody

func (pe *ProcessGroupEvent) GetBody() string

GetBody returns body of process group event

type ProcessLogEvent

type ProcessLogEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

ProcessLogEvent process log event definition

func CreateProcessLogStderrEvent

func CreateProcessLogStderrEvent(processName string,
	groupName string,
	pid int,
	data string) *ProcessLogEvent

CreateProcessLogStderrEvent emits create process stderr log event

func CreateProcessLogStdoutEvent

func CreateProcessLogStdoutEvent(processName string,
	groupName string,
	pid int,
	data string) *ProcessLogEvent

CreateProcessLogStdoutEvent emits create process stdout log event

func (*ProcessLogEvent) GetBody

func (pe *ProcessLogEvent) GetBody() string

GetBody returns body of process log event

type ProcessStateEvent

type ProcessStateEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

ProcessStateEvent process state event definition

func CreateProcessBackoffEvent

func CreateProcessBackoffEvent(process string,
	group string,
	fromState string,
	tries int) *ProcessStateEvent

CreateProcessBackoffEvent emits create process backoff event

func CreateProcessExitedEvent

func CreateProcessExitedEvent(process string,
	group string,
	fromState string,
	expected int,
	pid int) *ProcessStateEvent

CreateProcessExitedEvent emits create process exited event

func CreateProcessFatalEvent

func CreateProcessFatalEvent(process string,
	group string,
	fromState string) *ProcessStateEvent

CreateProcessFatalEvent emits create process fatal error event

func CreateProcessRunningEvent

func CreateProcessRunningEvent(process string,
	group string,
	fromState string,
	pid int) *ProcessStateEvent

CreateProcessRunningEvent emits create process running event

func CreateProcessStartingEvent

func CreateProcessStartingEvent(process string,
	group string,
	fromState string,
	tries int) *ProcessStateEvent

CreateProcessStartingEvent emits create process starting event

func CreateProcessStoppedEvent

func CreateProcessStoppedEvent(process string,
	group string,
	fromState string,
	pid int) *ProcessStateEvent

CreateProcessStoppedEvent emits create process stopped event

func CreateProcessStoppingEvent

func CreateProcessStoppingEvent(process string,
	group string,
	fromState string,
	pid int) *ProcessStateEvent

CreateProcessStoppingEvent emits create process stopping event

func CreateProcessUnknownEvent

func CreateProcessUnknownEvent(process string,
	group string,
	fromState string) *ProcessStateEvent

CreateProcessUnknownEvent emits create process state unknown event

func (*ProcessStateEvent) GetBody

func (pse *ProcessStateEvent) GetBody() string

GetBody returns body of process state event

type RemoteCommunicationEvent

type RemoteCommunicationEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

RemoteCommunicationEvent remote communication event definition

func NewRemoteCommunicationEvent

func NewRemoteCommunicationEvent(typ string, data string) *RemoteCommunicationEvent

NewRemoteCommunicationEvent creates new RemoteCommunicationEvent object

func (*RemoteCommunicationEvent) GetBody

func (r *RemoteCommunicationEvent) GetBody() string

GetBody returns event' body

type SupervisorStateChangeEvent

type SupervisorStateChangeEvent struct {
	BaseEvent
}

SupervisorStateChangeEvent supervisor state change event

func CreateSupervisorStateChangeRunning

func CreateSupervisorStateChangeRunning() *SupervisorStateChangeEvent

CreateSupervisorStateChangeRunning creates SupervisorStateChangeEvent object

func (*SupervisorStateChangeEvent) GetBody

func (s *SupervisorStateChangeEvent) GetBody() string

GetBody returns body of supervisor state change event

type TickEvent

type TickEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

TickEvent the tick event definition

func NewTickEvent

func NewTickEvent(tickType string, when int64) *TickEvent

NewTickEvent creates new periodical TickEvent object

func (*TickEvent) GetBody

func (te *TickEvent) GetBody() string

GetBody returns TickEvent' body

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL