worker

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: MIT Imports: 11 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) error

Types

type ITask

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

	GetError() error
	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) GetError added in v0.22.1

func (t *Task) GetError() error

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 WithDisableParallelism

func WithDisableParallelism(disable_parallelism worker_types.DebugDisableParallelism) TaskPoolOption

func WithName added in v0.22.2

func WithName(name string) 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