Documentation ¶
Index ¶
- Constants
- type AddTask
- type Config
- type Engine
- func (e *Engine[KEY]) AddFixedTasks(workerId int, generation int, tasks ...*Task[KEY]) error
- func (e *Engine[KEY]) AddOptionTasks(ctx context.Context, priority int, tasks ...*Task[KEY])
- func (e *Engine[KEY]) AddTasks(tasks ...*Task[KEY])
- func (e *Engine[KEY]) AddWorker(num int)
- func (e *Engine[KEY]) AsyncAddOptionTasks(ctx context.Context, priority int, tasks ...*Task[KEY])
- func (e *Engine[KEY]) AsyncAddTasks(tasks ...*Task[KEY])
- func (e *Engine[KEY]) Context() context.Context
- func (e *Engine[KEY]) ErrHandler(errHandler func(task *Task[KEY])) *Engine[KEY]
- func (e *Engine[KEY]) ErrHandlerRetryTimes(times int) *Engine[KEY]
- func (e *Engine[KEY]) ErrHandlerUtilSuccess() *Engine[KEY]
- func (e *Engine[KEY]) ErrHandlerWriteToFile(path string) *Engine[KEY]
- func (e *Engine[KEY]) ExecTask(worker *Worker[KEY], task *Task[KEY])
- func (e *Engine[KEY]) KindGroupRandSpeedLimit(minInterval, maxInterval time.Duration, kinds ...Kind) *Engine[KEY]
- func (e *Engine[KEY]) KindGroupSpeedLimit(interval time.Duration, kinds ...Kind) *Engine[KEY]
- func (e *Engine[KEY]) KindLimiter(kind Kind, r rate.Limit, b int) *Engine[KEY]
- func (e *Engine[KEY]) KindRandSpeedLimit(kind Kind, minInterval, maxInterval time.Duration) *Engine[KEY]
- func (e *Engine[KEY]) KindSpeedLimit(kind Kind, interval time.Duration) *Engine[KEY]
- func (e *Engine[KEY]) Limiter(r rate.Limit, b int) *Engine[KEY]
- func (e *Engine[KEY]) MonitorInterval(interval time.Duration)
- func (e *Engine[KEY]) NewFixedWorker(interval time.Duration) int
- func (e *Engine[KEY]) RandSpeedLimited(minInterval, maxInterval time.Duration) *Engine[KEY]
- func (e *Engine[KEY]) Run(tasks ...*Task[KEY])
- func (e *Engine[KEY]) RunSingleWorker(tasks ...*Task[KEY])
- func (e *Engine[KEY]) SkipKind(kinds ...Kind) *Engine[KEY]
- func (e *Engine[KEY]) SpeedLimited(interval time.Duration) *Engine[KEY]
- func (e *Engine[KEY]) Stop()
- func (e *Engine[KEY]) StopAfter(interval time.Duration) *Engine[KEY]
- func (e *Engine[KEY]) StopCallBack(callBack func()) *Engine[KEY]
- func (e *Engine[KEY]) TaskSource(taskSource func(addTask *Engine[KEY]))
- type EngineStatistics
- type ErrHandle
- type Key
- type Kind
- type KindHandler
- type Task
- func (t *Task[KEY]) Compare(t2 *Task[KEY]) int
- func (t *Task[KEY]) ErrLog()
- func (t *Task[KEY]) Errs() []error
- func (t *Task[KEY]) Id() uint64
- func (t *Task[KEY]) SetContext(ctx context.Context) *Task[KEY]
- func (t *Task[KEY]) SetDescribe(describe string) *Task[KEY]
- func (t *Task[KEY]) SetKey(key KEY) *Task[KEY]
- func (t *Task[KEY]) SetKind(k Kind) *Task[KEY]
- func (t *Task[KEY]) SetPriority(priority int) *Task[KEY]
- type TaskFunc
- type TaskInterface
- type TaskStatistics
- type Tasks
- type Type
- type Worker
Constants ¶
View Source
const (
KindNormal = iota
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine[KEY Key] struct { EngineStatistics // contains filtered or unexported fields }
func NewEngineWithContext ¶
func (*Engine[KEY]) AddFixedTasks ¶
func (*Engine[KEY]) AddOptionTasks ¶
func (*Engine[KEY]) AsyncAddOptionTasks ¶
func (*Engine[KEY]) AsyncAddTasks ¶
func (*Engine[KEY]) ErrHandler ¶
func (*Engine[KEY]) ErrHandlerRetryTimes ¶
func (*Engine[KEY]) ErrHandlerUtilSuccess ¶
func (*Engine[KEY]) ErrHandlerWriteToFile ¶
func (*Engine[KEY]) KindGroupRandSpeedLimit ¶
func (*Engine[KEY]) KindGroupSpeedLimit ¶
多个kind共用一个timer
func (*Engine[KEY]) KindLimiter ¶
func (*Engine[KEY]) KindRandSpeedLimit ¶
func (*Engine[KEY]) KindSpeedLimit ¶
func (*Engine[KEY]) MonitorInterval ¶
func (*Engine[KEY]) NewFixedWorker ¶
func (*Engine[KEY]) RandSpeedLimited ¶
func (*Engine[KEY]) RunSingleWorker ¶
func (*Engine[KEY]) SpeedLimited ¶
func (*Engine[KEY]) StopCallBack ¶
func (*Engine[KEY]) TaskSource ¶
TaskSource,参数为添加任务的函数,直到该函数运行结束,任务引擎才会检测任务是否结束
type EngineStatistics ¶
type EngineStatistics struct {
// contains filtered or unexported fields
}
EngineStatistics 基本引擎统计数据
type KindHandler ¶
type Task ¶
type Task[KEY Key] struct { context.Context Kind Kind Key KEY Priority int Describe string TaskStatistics TaskFunc[KEY] // contains filtered or unexported fields }
func (*Task[KEY]) SetDescribe ¶
func (*Task[KEY]) SetPriority ¶
type TaskInterface ¶
type TaskStatistics ¶
Click to show internal directories.
Click to hide internal directories.