events

package
v2.0.0-alpha29 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type E

type E int64
const (
	// EventWorkerError triggered after WorkerProcess. Except payload to be error.
	EventWorkerError E = iota + 200

	// EventWorkerLog triggered on every write to WorkerProcess StdErr pipe (batched). Except payload to be []byte string.
	EventWorkerLog
)

EventWorkerKill thrown after WorkerProcess is being forcefully killed.

func (E) String

func (ev E) String() string

type EventListener

type EventListener func(event interface{})

Event listener listens for the events produced by worker, worker pool or other service.

type Handler

type Handler interface {
	NumListeners() int
	AddListener(listener EventListener)
	Push(e interface{})
}

type P

type P int64
const (
	// EventWorkerConstruct thrown when new worker is spawned.
	EventWorkerConstruct P = iota + 7800

	// EventWorkerDestruct thrown after worker destruction.
	EventWorkerDestruct

	// EventPoolError caused on pool wide errors.
	EventPoolError

	// EventSupervisorError triggered when supervisor can not complete work.
	EventSupervisorError

	// EventNoFreeWorkers triggered when there are no free workers in the stack and timeout for worker allocate elapsed
	EventNoFreeWorkers

	// todo: EventMaxMemory caused when worker consumes more memory than allowed.
	EventMaxMemory

	// todo: EventTTL thrown when worker is removed due TTL being reached. Context is rr.WorkerError
	EventTTL

	// todo: EventIdleTTL triggered when worker spends too much time at rest.
	EventIdleTTL

	// todo: EventExecTTL triggered when worker spends too much time doing the task (max_execution_time).
	EventExecTTL
)

func (P) String

func (ev P) String() string

type PoolEvent

type PoolEvent struct {
	// Event type, see below.
	Event P

	// Payload depends on event type, typically it's worker or error.
	Payload interface{}
}

PoolEvent triggered by pool on different events. Pool as also trigger WorkerEvent in case of log.

type WorkerEvent

type WorkerEvent struct {
	// Event id, see below.
	Event E

	// Worker triggered the event.
	Worker interface{}

	// Event specific payload.
	Payload interface{}
}

WorkerEvent wraps worker events.

Jump to

Keyboard shortcuts

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