summaryrefslogtreecommitdiff
path: root/interfaces/events/worker_events.go
blob: 2bff18117c4ddbecd874098e1f251fa3a8d300b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package events

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

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

type W int64

func (ev W) String() string {
	switch ev {
	case EventWorkerError:
		return "EventWorkerError"
	case EventWorkerLog:
		return "EventWorkerLog"
	}
	return "Unknown event type"
}

// WorkerEvent wraps worker events.
type WorkerEvent struct {
	// Event id, see below.
	Event W

	// Worker triggered the event.
	Worker interface{}

	// Event specific payload.
	Payload interface{}
}