Documentation ¶
Index ¶
- type Config
- type Engine
- func (e *Engine[KEY, T, W]) AddFixedTasks(workerId int, tasks ...*Task[KEY, T]) error
- func (e *Engine[KEY, T, W]) AddTasks(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) AddWorker(num int)
- func (e *Engine[KEY, T, W]) Cancel()
- func (e *Engine[KEY, T, W]) Context() context.Context
- 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]) Run(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) RunSingleWorker(tasks ...*Task[KEY, T])
- func (e *Engine[KEY, T, W]) SpeedLimited(interval time.Duration)
- func (e *Engine[KEY, T, W]) Stop()
- func (e *Engine[KEY, T, W]) SyncRun(tasks ...*Task[KEY, T])
- type EngineStatistics
- type Task
- type TaskFunc
- type TaskMeta
- type Tasks
- type WorkStatistics
- type Worker
Constants ¶
This section is empty.
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]) AddFixedTasks ¶
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 ¶
type Task ¶
type Task[KEY comparable, T any] struct { TaskMeta[KEY] TaskFunc Props T // contains filtered or unexported fields }
type TaskMeta ¶
type TaskMeta[KEY comparable] struct { Key KEY Describe string Priority int // contains filtered or unexported fields }
func (*TaskMeta[KEY]) SetPriority ¶
type Tasks ¶
type Tasks[KEY comparable, T any] []*Task[KEY, T]
type WorkStatistics ¶
type WorkStatistics struct {
// contains filtered or unexported fields
}
WorkStatistics worker统计数据
type Worker ¶
type Worker[KEY comparable, T, W any] struct { Id uint Props W // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.