queue

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayQueue

type DelayQueue struct {
	C chan lang.AnyType
	// contains filtered or unexported fields
}

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) Add

func (q *FIFOQueue) Add(item interface{})

func (*FIFOQueue) Done

func (q *FIFOQueue) Done(item interface{})

func (*FIFOQueue) Get

func (q *FIFOQueue) Get() (item interface{}, shutdown bool)

func (*FIFOQueue) Len

func (q *FIFOQueue) Len() int

func (*FIFOQueue) ProcessingLen

func (q *FIFOQueue) ProcessingLen() int

func (*FIFOQueue) ShutDown

func (q *FIFOQueue) ShutDown()

func (*FIFOQueue) ShutDownWithDrain

func (q *FIFOQueue) ShutDownWithDrain()

func (*FIFOQueue) ShuttingDown

func (q *FIFOQueue) ShuttingDown() bool

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)

type PriorityQueueItem

type PriorityQueueItem struct {
	Value    lang.AnyType
	Priority int64
	Index    int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL