workermanager

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeOfExecutionEnum = struct {
	Async TypeOfExecution
	Sync  TypeOfExecution
}{Async: 0,
	Sync: 1}

Functions

func AddNewCronExecution

func AddNewCronExecution(wr Worker)

func CustomErrorInstance

func CustomErrorInstance() error

func MakeSchedulerAnchorPoint

func MakeSchedulerAnchorPoint()

func StopCronExecution

func StopCronExecution(wr *Worker, scheduler *gocron.Scheduler)

Types

type CronSchedulerConfig

type CronSchedulerConfig struct {
	IntervalInSeconds int
	TypeOfExecution   TypeOfExecution
}

type ExecutionException

type ExecutionException interface {
	RegisterMetricsCount(errorName string, count int64) error
}

type Instrumentation

type Instrumentation struct {
	FuncDispatcher func(ctx context.Context, data TaskParams) (TaskParams, error)
	NestedCallback func(ctx context.Context, data TaskParams) error
	TaskArguments  TaskParams
	FuncName       string
}

type TaskParams

type TaskParams struct {
	Params map[string]interface{}
}

func NewTaskParams

func NewTaskParams() TaskParams

func (*TaskParams) Clone

func (t *TaskParams) Clone() TaskParams

func (*TaskParams) GetBytesParam

func (t *TaskParams) GetBytesParam(key string) ([]byte, bool)

func (*TaskParams) GetComplexParam

func (t *TaskParams) GetComplexParam(key string) (*any, bool)

func (*TaskParams) GetFloatParam

func (t *TaskParams) GetFloatParam(key string) (float64, bool)

func (*TaskParams) GetIntParam

func (t *TaskParams) GetIntParam(key string) (int, bool)

func (*TaskParams) GetParams

func (t *TaskParams) GetParams() map[string]interface{}

func (*TaskParams) GetStringParam

func (t *TaskParams) GetStringParam(key string) (string, bool)

func (*TaskParams) SetBytesParam

func (t *TaskParams) SetBytesParam(key string, value []byte)

func (*TaskParams) SetComplexParam

func (t *TaskParams) SetComplexParam(key string, value *any)

func (*TaskParams) SetFloatParam

func (t *TaskParams) SetFloatParam(key string, value float64)

func (*TaskParams) SetIntParam

func (t *TaskParams) SetIntParam(key string, value int)

func (*TaskParams) SetStringParam

func (t *TaskParams) SetStringParam(key string, value string)

type TypeOfExecution

type TypeOfExecution int64

type Worker

type Worker struct {
	SourceContext       context.Context
	Instrumentation     Instrumentation
	Callback            func(ctx context.Context)
	ExecsPerTick        []int
	TickDuration        time.Duration
	CronSchedulerConfig CronSchedulerConfig
}

func (Worker) Run

func (wr Worker) Run()

type WorkerError

type WorkerError struct {
	// contains filtered or unexported fields
}

func WorkerErrorInstance

func WorkerErrorInstance(error string) *WorkerError

func (*WorkerError) Error

func (e *WorkerError) Error() string

func (WorkerError) ExecutionError

func (e WorkerError) ExecutionError(args []string) *error

func (WorkerError) ListenErrosHappned

func (w WorkerError) ListenErrosHappned()

func (*WorkerError) RegisterMetricsCount

func (e *WorkerError) RegisterMetricsCount(
	errorName string,
	count int64,
	errorTags []string,
)

Jump to

Keyboard shortcuts

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