Documentation ¶
Index ¶
- Constants
- type Config
- type Engine
- func (e *Engine[KEY, T, W]) AddFixedTask(workerId int, generation int, task *Task[KEY, T]) error
- func (e *Engine[KEY, T, W]) AddNoPriorityTask(task *Task[KEY, T])
- func (e *Engine[KEY, T, W]) AddNoPriorityTasks(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) AddTask(generation int, task *Task[KEY, T])
- func (e *Engine[KEY, T, W]) AddTasks(generation int, tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) AddWorker(num int)
- func (e *Engine[KEY, T, W]) AsyncAddTask(generation int, tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) Cancel()
- func (e *Engine[KEY, T, W]) Context() context.Context
- func (e *Engine[KEY, T, W]) ErrHandler(errHandler func(task *Task[KEY, T])) *Engine[KEY, T, W]
- func (e *Engine[KEY, T, W]) ErrHandlerUtilSuccess() *Engine[KEY, T, W]
- func (e *Engine[KEY, T, W]) ExecTask(ctx context.Context, task *Task[KEY, T])
- func (e *Engine[KEY, T, W]) KindGroupTimer(interval time.Duration, kinds ...Kind) *Engine[KEY, T, W]
- func (e *Engine[KEY, T, W]) Limiter(kind Kind, r rate.Limit, b int) *Engine[KEY, T, W]
- func (e *Engine[KEY, T, W]) MonitorInterval(interval time.Duration)
- func (e *Engine[KEY, T, W]) NewFixedWorker(interval time.Duration) int
- func (e *Engine[KEY, T, W]) RandSpeedLimited(start, stop time.Duration)
- func (e *Engine[KEY, T, W]) ReRun(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) Run(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) RunSingleWorker(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) SkipKind(kinds ...Kind) *Engine[KEY, T, W]
- func (e *Engine[KEY, T, W]) SpeedLimited(interval time.Duration)
- func (e *Engine[KEY, T, W]) Stop()
- func (e *Engine[KEY, T, W]) StopAfter(interval time.Duration) *Engine[KEY, T, W]
- func (e *Engine[KEY, T, W]) TaskSourceChannel(source <-chan *Task[KEY, T])
- func (e *Engine[KEY, T, W]) TaskSourceFunc(task func(*Engine[KEY, T, W]))
- func (e *Engine[KEY, T, W]) Timer(kind Kind, interval time.Duration) *Engine[KEY, T, W]
- type EngineStatistics
- type ErrHandle
- type Kind
- type KindHandler
- type Task
- type TaskFunc
- type TaskMeta
- type TaskStatistics
- type Tasks
- type WorkStatistics
- type Worker
Constants ¶
View Source
const (
KindNormal = iota
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config[KEY comparable, T, W any] struct { WorkerCount uint }
type Engine ¶
type Engine[KEY comparable, T, W any] struct { EngineStatistics // contains filtered or unexported fields }
func NewEngineWithContext ¶
func (*Engine[KEY, T, W]) AddFixedTask ¶
func (*Engine[KEY, T, W]) AddNoPriorityTask ¶
func (*Engine[KEY, T, W]) AddNoPriorityTasks ¶
func (*Engine[KEY, T, W]) AsyncAddTask ¶
func (*Engine[KEY, T, W]) ErrHandler ¶
func (*Engine[KEY, T, W]) ErrHandlerUtilSuccess ¶
func (*Engine[KEY, T, W]) KindGroupTimer ¶
func (e *Engine[KEY, T, W]) KindGroupTimer(interval time.Duration, kinds ...Kind) *Engine[KEY, T, W]
多个kind共用一个timer
func (*Engine[KEY, T, W]) MonitorInterval ¶
func (*Engine[KEY, T, W]) NewFixedWorker ¶
func (*Engine[KEY, T, W]) RandSpeedLimited ¶
func (*Engine[KEY, T, W]) RunSingleWorker ¶
func (*Engine[KEY, T, W]) SpeedLimited ¶
func (*Engine[KEY, T, W]) TaskSourceChannel ¶
TaskSourceChannel 任务源,参数是一个channel,channel关闭时,代表任务源停止发送任务
func (*Engine[KEY, T, W]) TaskSourceFunc ¶
TaskSourceFunc,参数为添加任务的函数,直到该函数运行结束,任务引擎才会检测任务是否结束
type EngineStatistics ¶
type EngineStatistics struct { WorkStatistics // contains filtered or unexported fields }
EngineStatistics 基本引擎统计数据
type KindHandler ¶
type Task ¶
type Task[KEY comparable, P any] struct { TaskMeta[KEY] TaskFunc[KEY, P] Props P // contains filtered or unexported fields }
type TaskMeta ¶
type TaskMeta[KEY comparable] struct { Key KEY Describe string Priority int Kind Kind TaskStatistics // contains filtered or unexported fields }
TODO
func (*TaskMeta[KEY]) SetPriority ¶
type TaskStatistics ¶
type TaskStatistics struct {
// contains filtered or unexported fields
}
type Tasks ¶
type Tasks[KEY comparable, P any] []*Task[KEY, P]
type WorkStatistics ¶
type WorkStatistics struct {
// contains filtered or unexported fields
}
WorkStatistics worker统计数据
Click to show internal directories.
Click to hide internal directories.