Documentation ¶
Overview ¶
* @Author: cnzf1 * @Date: 2023-01-04 09:46:56 * @LastEditors: cnzf1 * @LastEditTime: 2023-03-28 19:35:53 * @Description:
* @Author: cnzf1 * @Date: 2023-01-04 10:16:05 * @LastEditors: cnzf1 * @LastEditTime: 2023-03-30 17:15:18 * @Description:
Index ¶
- type DelayQueue
- type FIFOQueue
- func (q *FIFOQueue) Add(item interface{})
- func (q *FIFOQueue) Done(item interface{})
- func (q *FIFOQueue) Get() (item interface{}, shutdown bool)
- func (q *FIFOQueue) Len() int
- func (q *FIFOQueue) ProcessingLen() int
- func (q *FIFOQueue) ShutDown()
- func (q *FIFOQueue) ShutDownWithDrain()
- func (q *FIFOQueue) ShuttingDown() bool
- type PriorityQueue
- type PriorityQueueItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DelayQueue ¶
DelayQueue is an unbounded blocking queue of *Delayed* elements, in which an element can only be taken when its delay has expired. The head of the queue is the *Delayed* element whose delay expired furthest in the past.
func NewDelayQueue ¶
func NewDelayQueue(size int) *DelayQueue
NewDelayQueue creates an instance of delayQueue with the specified size.
func (*DelayQueue) Offer ¶
func (dq *DelayQueue) Offer(elem lang.AnyType, expiration int64)
Offer inserts the element into the current queue.
func (*DelayQueue) Poll ¶
func (dq *DelayQueue) Poll(exitC chan lang.PlaceholderType, nowF func() int64)
Poll starts an infinite loop, in which it continually waits for an element to expire and then send the expired element to the channel C.
type FIFOQueue ¶
type FIFOQueue struct {
// contains filtered or unexported fields
}
func NewFIFOQueue ¶
func NewFIFOQueue() *FIFOQueue
func (*FIFOQueue) ProcessingLen ¶
func (*FIFOQueue) ShutDownWithDrain ¶
func (q *FIFOQueue) ShutDownWithDrain()
func (*FIFOQueue) ShuttingDown ¶
type PriorityQueue ¶
type PriorityQueue []*PriorityQueueItem
this is a priority queue as implemented by a min heap ie. the 0th element is the *lowest* value
func NewPriorityQueue ¶
func NewPriorityQueue(capacity int) PriorityQueue
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) PeekAndShift ¶
func (pq *PriorityQueue) PeekAndShift(max int64) (*PriorityQueueItem, int64)
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)