summaryrefslogtreecommitdiff
path: root/interfaces/events/worker_events.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-17 03:16:55 +0300
committerValery Piashchynski <[email protected]>2020-12-17 03:16:55 +0300
commit40cfd9f6b44dfe987bfbf010bf67b32abdc64208 (patch)
tree10e3c3cd0805619ac30533078eb7d2585877a1b3 /interfaces/events/worker_events.go
parent9d5fe4f6a98b30fd73be8259f84fa595ac994a71 (diff)
Now better
Diffstat (limited to 'interfaces/events/worker_events.go')
-rw-r--r--interfaces/events/worker_events.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/interfaces/events/worker_events.go b/interfaces/events/worker_events.go
new file mode 100644
index 00000000..497f0a06
--- /dev/null
+++ b/interfaces/events/worker_events.go
@@ -0,0 +1,34 @@
+package events
+
+// EventWorkerKill thrown after WorkerProcess is being forcefully killed.
+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
+)
+
+type E int64
+
+func (ev E) 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 E
+
+ // Worker triggered the event.
+ Worker interface{}
+
+ // Event specific payload.
+ Payload interface{}
+}