events

package module
v0.0.0-...-7111dfa Latest Latest
Warning

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

Go to latest
Published: Dec 2, 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 emit an event to default event listener manager

func RegisterEventListener

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

RegisterEventListener register the 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 get the serial of the event

func (*BaseEvent) GetType

func (be *BaseEvent) GetType() string

GetType get the event type

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 create a NewEventListener object

func UnregisterEventListener

func UnregisterEventListener(eventListenerName string) *EventListener

UnregisterEventListener unregister the listener by its name

func (*EventListener) HandleEvent

func (el *EventListener) HandleEvent(event Event)

HandleEvent handle the emitted event

type EventListenerManager

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

EventListenerManager manage the event listeners

func NewEventListenerManager

func NewEventListenerManager() *EventListenerManager

NewEventListenerManager create an EventListenerManager object

func (*EventListenerManager) EmitEvent

func (em *EventListenerManager) EmitEvent(event Event)

EmitEvent emit an event to all the 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 create a 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 create a new ProcCommEvent object

func (*ProcCommEvent) GetBody

func (p *ProcCommEvent) GetBody() string

GetBody get the 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 create a new ProcCommEventCapture object

func (*ProcCommEventCapture) SetPid

func (pec *ProcCommEventCapture) SetPid(pid int)

SetPid set the 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 create process group added event

func CreateProcessGroupRemovedEvent

func CreateProcessGroupRemovedEvent(groupName string) *ProcessGroupEvent

CreateProcessGroupRemovedEvent create process group removed event

func (*ProcessGroupEvent) GetBody

func (pe *ProcessGroupEvent) GetBody() string

GetBody get the 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 create process stderr log event

func CreateProcessLogStdoutEvent

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

CreateProcessLogStdoutEvent create process stdout log event

func (*ProcessLogEvent) GetBody

func (pe *ProcessLogEvent) GetBody() string

GetBody get the 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 create process backoff event

func CreateProcessExitedEvent

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

CreateProcessExitedEvent create process exited event

func CreateProcessFatalEvent

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

CreateProcessFatalEvent create process fatal error event

func CreateProcessRunningEvent

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

CreateProcessRunningEvent create a process running event

func CreateProcessStartingEvent

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

CreateProcessStartingEvent create a process starting event

func CreateProcessStoppedEvent

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

CreateProcessStoppedEvent create process stopped event

func CreateProcessStoppingEvent

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

CreateProcessStoppingEvent create process stopping event

func CreateProcessUnknownEvent

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

CreateProcessUnknownEvent create process state unknown event

func (*ProcessStateEvent) GetBody

func (pse *ProcessStateEvent) GetBody() string

GetBody get the 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 create a new RemoteCommunicationEvent object

func (*RemoteCommunicationEvent) GetBody

func (r *RemoteCommunicationEvent) GetBody() string

GetBody get the event body

type SupervisorStateChangeEvent

type SupervisorStateChangeEvent struct {
	BaseEvent
}

SupervisorStateChangeEvent supervisor state change event

func CreateSupervisorStateChangeRunning

func CreateSupervisorStateChangeRunning() *SupervisorStateChangeEvent

CreateSupervisorStateChangeRunning create a SupervisorStateChangeEvent object

func (*SupervisorStateChangeEvent) GetBody

func (s *SupervisorStateChangeEvent) GetBody() string

GetBody get the 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 create a new periodical TickEvent object

func (*TickEvent) GetBody

func (te *TickEvent) GetBody() string

GetBody get the TickEvent body

Jump to

Keyboard shortcuts

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