Documentation ¶
Index ¶
- Variables
- type ArrayQueue
- type BlockedLinkQueue
- type BlockedQueue
- type Comparator
- type DefaultTaskQueue
- func (t *DefaultTaskQueue) Close()
- func (t *DefaultTaskQueue) SetParallelTaskNum(taskNum int)
- func (t *DefaultTaskQueue) Start()
- func (t *DefaultTaskQueue) SubmitPriorityTask(task PriorityTask) bool
- func (t *DefaultTaskQueue) SubmitTask(task Task) bool
- func (t *DefaultTaskQueue) TaskSize() int
- func (t *DefaultTaskQueue) Wait(timeOut time.Duration) error
- type PriorityBlockedQueue
- type PriorityTask
- type Task
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoElement the queue has no element ErrNoElement = errors.New("the queue has no element") // ErrWaitTimeOut .. ErrWaitTimeOut = errors.New("wait time out") // ErrNotComparator the element not implement the Comparator ErrNotComparator = errors.New("the element not implement the Comparator") )
Functions ¶
This section is empty.
Types ¶
type ArrayQueue ¶
type ArrayQueue struct {
// contains filtered or unexported fields
}
ArrayQueue ..
func (*ArrayQueue) Len ¶
func (p *ArrayQueue) Len() int
Len is the number of elements in the collection.
func (*ArrayQueue) Less ¶
func (p *ArrayQueue) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (*ArrayQueue) Pop ¶
func (p *ArrayQueue) Pop() interface{}
Pop remove and return element Len() - 1.
func (*ArrayQueue) Swap ¶
func (p *ArrayQueue) Swap(i, j int)
Swap swaps the elements with indexes i and j.
type BlockedLinkQueue ¶
type BlockedLinkQueue struct {
// contains filtered or unexported fields
}
BlockedLinkQueue 链表阻塞队列
func NewBlockedLinkQueue ¶
func NewBlockedLinkQueue() *BlockedLinkQueue
NewBlockedLinkQueue build the NewBlockedLinkQueue pointer
func (*BlockedLinkQueue) Len ¶
func (b *BlockedLinkQueue) Len() int
Len return the length of the queue
type BlockedQueue ¶
type BlockedQueue interface { Push(ctx context.Context, v interface{}) error Pop(waitTime time.Duration) (interface{}, error) Len() int }
BlockedQueue ..
type Comparator ¶
type Comparator interface {
Less(i interface{}) bool
}
Comparator like the java Comparator
type DefaultTaskQueue ¶
type DefaultTaskQueue struct {
// contains filtered or unexported fields
}
DefaultTaskQueue the common implement for the task queue
func NewDefaultPriorityTaskQueue ¶
func NewDefaultPriorityTaskQueue(taskNum int) *DefaultTaskQueue
NewDefaultPriorityTaskQueue ..
func NewDefaultTaskQueue ¶
func NewDefaultTaskQueue(taskNum int) *DefaultTaskQueue
NewDefaultTaskQueue ..
func (*DefaultTaskQueue) SetParallelTaskNum ¶
func (t *DefaultTaskQueue) SetParallelTaskNum(taskNum int)
SetParallelTaskNum ..
func (*DefaultTaskQueue) SubmitPriorityTask ¶
func (t *DefaultTaskQueue) SubmitPriorityTask(task PriorityTask) bool
SubmitPriorityTask ..
func (*DefaultTaskQueue) SubmitTask ¶
func (t *DefaultTaskQueue) SubmitTask(task Task) bool
SubmitTask ..
type PriorityBlockedQueue ¶
type PriorityBlockedQueue struct {
// contains filtered or unexported fields
}
PriorityBlockedQueue ..
func NewPriorityBlockedQueue ¶
func NewPriorityBlockedQueue() *PriorityBlockedQueue
NewPriorityBlockedQueue ..
func (*PriorityBlockedQueue) Len ¶
func (b *PriorityBlockedQueue) Len() int
Len return the length of the queue