Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue interface { // Logger 设置logger Logger(logger log.Log) // ConsumeFixed 设置消费函数,函数必须为:funcType ConsumeFixed(f funcType) Queue // ConsumeFlexible 设置消费函数,推荐此方法, 参数可以为空,无返回值 // 添加任务,函数格式必须为: // taskfunc(param ...interface{}) // 或自定义参数 // taskfunc(i int, s string, arr []int) ConsumeFlexible(f any) Queue // AddMsg 添加消息, 数据必须与注册的消费者参数一致 AddMsg(param ...any) Queue // IsFinished 判断是否全部消费 IsFinished() bool // Destruction 销毁队列 Destruction() // WaitFinish 等待任务完成通知 WaitFinish() }
Queue 无序任务队列
type SortedQueue ¶
type SortedQueue interface { // Logger 设置logger Logger(logger log.Log) // ConsumeFixed 设置消费函数,函数必须为:funcType ConsumeFixed(f funcType) SortedQueue // ConsumeFlexible 设置消费函数,推荐此方法, 参数可以为空,无返回值 // 添加任务,函数格式必须为: // taskfunc(param ...interface{}) // 或自定义参数 // taskfunc(i int, s string, arr []int) ConsumeFlexible(f any) SortedQueue // AddMsg 添加消息, 数据必须与注册的消费者参数一致 AddMsg(param ...any) SortedQueue // IsFinished 判断是否全部消费 IsFinished() bool // Destruction 销毁队列 Destruction() // WaitFinish 等待任务完成通知 WaitFinish() }
SortedQueue 顺序任务队列,执行顺序与添加顺序一致
func NewSortedQueue ¶
func NewSortedQueue(ctx context.Context, queueLen int) SortedQueue
Click to show internal directories.
Click to hide internal directories.