Documentation
¶
Index ¶
- func All(ctx context.Context, funcs ...Func) error
- func CancelOnFirstError(ctx context.Context, funcs ...Func) error
- func CancelOnFirstErrorWait(ctx context.Context, funcs ...Func) error
- func CancelOnFirstFinish(ctx context.Context, funcs ...Func) error
- func CancelOnFirstFinishWait(ctx context.Context, funcs ...Func) error
- func NewErrorList(errs ...error) error
- func NewErrorListByChan(ch <-chan error) error
- func NewMetrics(registerer prometheus.Registerer, namespace string, subsystem string, fn Func) func(ctx context.Context) error
- func Run(ctx context.Context, funcs ...Func) <-chan error
- func Sequential(ctx context.Context, funcs ...Func) (err error)
- func SkipErrors(fn Func) func(context.Context) error
- func SkipErrorsAndReport(fn Func, hasCaptureErrorAndWait HasCaptureErrorAndWait, tags map[string]string) func(context.Context) error
- type AddFire
- type Backoff
- type ConcurrentRunner
- type Done
- type Fire
- type Func
- type HasCaptureErrorAndWait
- type MultiTrigger
- type ParallelSkipper
- type Runnable
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CancelOnFirstError ¶
CancelOnFirstError executes all given functions. When a function encounters an error all remaining functions will be canceled.
func CancelOnFirstErrorWait ¶
CancelOnFirstErrorWait executes all given functions. When a function encounters an error all remaining functions will be canceled.
func CancelOnFirstFinish ¶
CancelOnFirstFinish executes all given functions. After the first function finishes, any remaining functions will be canceled.
func CancelOnFirstFinishWait ¶
CancelOnFirstFinishWait executes all given functions. After the first function finishes, any remaining functions will be canceled.
func NewErrorList ¶
NewErrorList create a ErrorList with the given errors.
func NewErrorListByChan ¶
NewErrorListByChan create a ErrorList with the given error channel.
func NewMetrics ¶
func NewMetrics( registerer prometheus.Registerer, namespace string, subsystem string, fn Func, ) func(ctx context.Context) error
NewMetrics create prometheus metrics for the given Func.
func Sequential ¶
Sequential run every given function.
func SkipErrors ¶
SkipErrors runs the given Func and returns always nil.
func SkipErrorsAndReport ¶
func SkipErrorsAndReport( fn Func, hasCaptureErrorAndWait HasCaptureErrorAndWait, tags map[string]string, ) func(context.Context) error
SkipErrorsAndReport runs the given Func, report errors to sentry and returns always nil.
Types ¶
type AddFire ¶
type AddFire interface {
// Add returns a new fire for trigger
Add() Fire
}
AddFire allow add a new trigger
type Backoff ¶
type Backoff struct {
Delay time.Duration `json:"delay"`
Retries int `json:"retries"`
IsRetryAble func(error) bool `json:"-"`
}
Backoff settings for retry
type ConcurrentRunner ¶
type ConcurrentRunner interface {
Add(ctx context.Context, fn Func)
Run(ctx context.Context) error
io.Closer
}
ConcurrentRunner allow run N tasks concurrent
func NewConcurrentRunner ¶
func NewConcurrentRunner(maxConcurrent int) ConcurrentRunner
NewConcurrentRunner returns ConcurrentRunner with the given concurrent limit
type Done ¶
type Done interface {
// Done chan gets a element if trigger was fired
Done() <-chan struct{}
}
Done check for a trigger
type Fire ¶
type Fire interface {
// Fire trigger als Dons ch to get a element
Fire()
}
Fire a trigger
type Func ¶
Func interface for all run utils.
type HasCaptureErrorAndWait ¶
type HasCaptureErrorAndWait interface {
CaptureErrorAndWait(err error, tags map[string]string, interfaces ...raven.Interface) string
}
HasCaptureErrorAndWait is compatibel with sentry.Client
type MultiTrigger ¶
MultiTrigger combines Done and AddFire
type ParallelSkipper ¶
ParallelSkipper prevent execution of the given function at the same time.
func NewParallelSkipper ¶
func NewParallelSkipper() ParallelSkipper
NewParallelSkipper return a new instance of ParallelSkipper.