queue

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delay

func Delay(z int)

Types

type EsQueue

type EsQueue struct {
	// contains filtered or unexported fields
}

lock free queue

func NewEsQueue

func NewEsQueue(capaciity uint32) *EsQueue

func (*EsQueue) Capaciity

func (q *EsQueue) Capaciity() uint32

func (*EsQueue) Get

func (q *EsQueue) Get() (val interface{}, ok bool, quantity uint32)

get queue functions

func (*EsQueue) Gets

func (q *EsQueue) Gets(values []interface{}) (gets, quantity uint32)

gets queue functions

func (*EsQueue) Put

func (q *EsQueue) Put(val interface{}) (ok bool, quantity uint32)

put queue functions

func (*EsQueue) Puts

func (q *EsQueue) Puts(values []interface{}) (puts, quantity uint32)

puts queue functions

func (*EsQueue) Quantity

func (q *EsQueue) Quantity() uint32

func (*EsQueue) String

func (q *EsQueue) String() string

type Item

type Item interface {
	Less(Item) bool
}

type ListQueue

type ListQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewListQueue

func NewListQueue[T any](size int) *ListQueue[T]

type Node

type Node[T any] struct {
	// contains filtered or unexported fields
}

func (*Node[T]) Next

func (n *Node[T]) Next() *Node[T]

func (*Node[T]) Previous

func (n *Node[T]) Previous() *Node[T]

func (*Node[T]) Set

func (n *Node[T]) Set(value interface{})

func (*Node[T]) Value

func (n *Node[T]) Value() interface{}

type Queue

type Queue[T any] interface {
	// 获取当前链表长度。
	Len() int
	// 获取当前链表容量。
	Capacity() int
	// 获取当前链表头结点。
	Front() *Node[T]
	// 获取当前链表尾结点。
	Rear() *Node[T]
	// 入列。
	Enqueue(value T) bool
	// 出列。
	Dequeue() T
}

type RingQueue

type RingQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewRingQueue

func NewRingQueue[T any](capacity int) *RingQueue[T]

func (*RingQueue[T]) Capacity

func (q *RingQueue[T]) Capacity() int

func (*RingQueue[T]) Dequeue

func (q *RingQueue[T]) Dequeue() T

func (*RingQueue[T]) Enqueue

func (q *RingQueue[T]) Enqueue(value T) bool

func (*RingQueue[T]) Front

func (q *RingQueue[T]) Front() T

func (*RingQueue[T]) IsFull

func (q *RingQueue[T]) IsFull() bool

IsFull checks if the ring buffer is full

func (*RingQueue[T]) Length

func (q *RingQueue[T]) Length() int

func (*RingQueue[T]) LookAll

func (q *RingQueue[T]) LookAll() []interface{}

LookAll reads all elements from ring buffer this method doesn't consume all elements

func (*RingQueue[T]) Tail

func (q *RingQueue[T]) Tail() T

type TinyQueue

type TinyQueue struct {
	// contains filtered or unexported fields
}

func New

func New(data []Item) *TinyQueue

func (*TinyQueue) Len

func (q *TinyQueue) Len() int

func (*TinyQueue) Peek

func (q *TinyQueue) Peek() Item

func (*TinyQueue) Pop

func (q *TinyQueue) Pop() Item

func (*TinyQueue) Push

func (q *TinyQueue) Push(item Item)

Jump to

Keyboard shortcuts

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