worker

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CodeSuccess worker_types.TaskStatusCode = 0
	CodeTimeout worker_types.TaskStatusCode = 1
	CodeFailure worker_types.TaskStatusCode = 2
)

Variables

This section is empty.

Functions

func LogusStatusCodes

func LogusStatusCodes(tasks []ITask) typelog.LogType

func RunTasksInTempPool

func RunTasksInTempPool(tasks []ITask, opts ...TaskPoolOption)

Types

type ITask

type ITask interface {
	RunTask(worker_id worker_types.WorkerID) error
	IsDone() bool

	GetStatusCode() worker_types.TaskStatusCode
	SetAsDone()
	// contains filtered or unexported methods
}

type Task

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

func NewTask

func NewTask(id worker_types.TaskID) *Task

func (*Task) GetID

func (t *Task) GetID() worker_types.TaskID

func (*Task) GetStatusCode

func (t *Task) GetStatusCode() worker_types.TaskStatusCode

func (*Task) IsDone

func (t *Task) IsDone() bool

func (*Task) SetAsDone

func (t *Task) SetAsDone()

type TaskPool

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

func NewTaskPool

func NewTaskPool(opts ...TaskPoolOption) *TaskPool

type TaskPoolOption

type TaskPoolOption func(r *TaskPool)

func WithAllowFailedTasks

func WithAllowFailedTasks() TaskPoolOption

func WithDisableParallelism

func WithDisableParallelism(disable_parallelism worker_types.DebugDisableParallelism) TaskPoolOption

func WithTaskObServer

func WithTaskObServer(task_observer func(task ITask)) TaskPoolOption

func WithTaskTimeout

func WithTaskTimeout(value worker_types.Seconds) TaskPoolOption

func WithWorkersAmount

func WithWorkersAmount(value int) TaskPoolOption

type TaskPoolPeristent

type TaskPoolPeristent struct {
	*TaskPool
	// contains filtered or unexported fields
}

func NewTaskPoolPersistent

func NewTaskPoolPersistent(opts ...TaskPoolOption) *TaskPoolPeristent

func (*TaskPoolPeristent) DelayTask

func (j *TaskPoolPeristent) DelayTask(task ITask)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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