taskd

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPool      = "default"
	DefaultPoolSize  = 64
	DefaultQueueSize = 1024
)
View Source
const DaemonTypeTaskd boot.DaemonType = "taskd"

Variables

View Source
var (
	ErrStopping            = errors.New("stopping, reject")
	ErrTaskNotExists       = errors.New("task not exists")
	ErrTaskAlreadyExists   = errors.New("task already exists")
	ErrTaskAlreadyStopping = errors.New("task already stopping")
	ErrTaskAlreadyPausing  = errors.New("task already pausing")
	ErrTaskNotStarted      = errors.New("task not started")
	ErrTaskNotPaused       = errors.New("task not paused")
	ErrPoolNotExists       = errors.New("pool not exists")
)

Functions

This section is empty.

Types

type Cfg

type Cfg struct {
	Pools []*PoolCfg `json:"pools" yaml:"pools" env:"POOLS"`
}

func NewCfg

func NewCfg() *Cfg

type PoolCfg added in v0.1.25

type PoolCfg struct {
	Name      string `json:"name" yaml:"name" validate:"required"`
	Size      int    `json:"size" yaml:"size" validate:"required"`
	QueueSize int    `json:"queueSize" yaml:"queueSize" validate:"required"`
}

type Taskd

type Taskd interface {
	boot.Daemon
	SubmitTask(taskCfg *task.Cfg) (*task.Task, error)
	SubmitTaskAndWait(context.Context, *task.Cfg) (*task.Task, error)
	StopTask(taskID string) error
	PauseTask(taskID string) error
	ResumeTask(taskID string) (*task.Task, error)
	IsTaskExists(taskID string) bool
	IsTaskPending(taskID string) bool
	IsTaskRunning(taskID string) bool
	IsTaskPaused(taskID string) bool
	ListTasks() []*task.Task
	ListTasksCfg() []*task.Cfg
	ListTaskIDs() []string
	ListPendingTaskIDs() []string
	ListRunningTaskIDs() []string
	ListPausingTaskIDs() []string
	ListPausedTaskIDs() []string
	GetTaskCfg(taskID string) (*task.Cfg, error)
	OnTaskCreate(hooks ...task.Hook)
	OnTaskInit(hooks ...task.Hook)
	OnTaskSubmit(hooks ...task.Hook)
	OnTaskStart(hooks ...task.Hook)
	OnTaskPausing(hooks ...task.Hook)
	OnTaskPaused(hooks ...task.Hook)
	OnTaskDone(hooks ...task.Hook)
	OnTaskStepDone(hooks ...task.StepHook)
	OnTaskDeferStepDone(hooks ...task.StepHook)
}
var D Taskd = New()

func New

func New() Taskd

Jump to

Keyboard shortcuts

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