-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.go
More file actions
31 lines (23 loc) · 1.13 KB
/
callback.go
File metadata and controls
31 lines (23 loc) · 1.13 KB
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
package svcinit
import (
"context"
)
// TaskCallback is a callback for task events.
// err is only set for CallbackStepAfter.
type TaskCallback interface {
Callback(ctx context.Context, task Task, stage string, step Step, callbackStep CallbackStep, err error)
}
type TaskCallbackFunc func(ctx context.Context, task Task, stage string, step Step, callbackStep CallbackStep, err error)
func (f TaskCallbackFunc) Callback(ctx context.Context, task Task, stage string, step Step, callbackStep CallbackStep, err error) {
f(ctx, task, stage, step, callbackStep, err)
}
// ManagerCallback is a callback for manager events.
// A cause may be set in the context. Use CauseFromContext to check.
type ManagerCallback interface {
Callback(ctx context.Context, stage string, step Step, callbackStep CallbackStep)
}
type ManagerCallbackFunc func(ctx context.Context, stage string, step Step, callbackStep CallbackStep)
func (f ManagerCallbackFunc) Callback(ctx context.Context, stage string, step Step, callbackStep CallbackStep) {
f(ctx, stage, step, callbackStep)
}
type TaskErrorHandler func(ctx context.Context, task Task, step Step, err error) error