taskd

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPoolSize  = 5
	DefaultQueueSize = 1024
)
View Source
const DaemonTypeTaskd boot.DaemonType = "taskd"

Variables

View Source
var (
	ErrStopping          = errors.New("stopping, reject")
	ErrTaskAlreadyExists = errors.New("task already exists")
)

Functions

func HasTask

func HasTask(taskID string) bool

func Submit

func Submit(cfg *task.Cfg) (*task.Task, error)

func SubmitAndWait

func SubmitAndWait(cfg *task.Cfg) (*task.Task, error)

func TrySubmit

func TrySubmit(cfg *task.Cfg) (*task.Task, bool, error)

Types

type Cfg

type Cfg struct {
	PoolSize  int `env:"TASK_POOL_SIZE"  flag-long:"task-pool-size"  yaml:"poolSize"  flag-description:"max number of workers in task pool"`
	QueueSize int `env:"TASK_QUEUE_SIZE" flag-long:"task-queue-size" yaml:"queueSize" flag-description:"max size of buffered task queue"`
}

func NewCfg

func NewCfg() *Cfg

type Taskd

type Taskd struct {
	runner.Runner
	*Cfg
	// contains filtered or unexported fields
}

func New

func New() *Taskd

func (*Taskd) GetCfg

func (td *Taskd) GetCfg() interface{}

func (*Taskd) HasTask

func (td *Taskd) HasTask(taskID string) bool

func (*Taskd) Init

func (td *Taskd) Init() error

func (*Taskd) Start

func (td *Taskd) Start() error

func (*Taskd) Stop

func (td *Taskd) Stop() error

func (*Taskd) Submit

func (td *Taskd) Submit(taskCfg *task.Cfg) (*task.Task, error)

func (*Taskd) SubmitAndWait

func (td *Taskd) SubmitAndWait(taskCfg *task.Cfg) (*task.Task, error)

func (*Taskd) TrySubmit

func (td *Taskd) TrySubmit(taskCfg *task.Cfg) (*task.Task, bool, error)

func (*Taskd) Type

func (td *Taskd) Type() interface{}

Jump to

Keyboard shortcuts

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