queue

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 4 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[T any] struct {
	// contains filtered or unexported fields
}

lock free queue

func NewEsQueue

func NewEsQueue[T any](capacity uint32) *EsQueue[T]

func (*EsQueue[T]) Capaciity

func (q *EsQueue[T]) Capaciity() uint32

func (*EsQueue[T]) Get

func (q *EsQueue[T]) Get() (val T, ok bool, quantity uint32)

get queue functions

func (*EsQueue[T]) Gets

func (q *EsQueue[T]) Gets(values []T) (gets, quantity uint32)

gets queue functions

func (*EsQueue[T]) Put

func (q *EsQueue[T]) Put(val T) (ok bool, quantity uint32)

put queue functions

func (*EsQueue[T]) Puts

func (q *EsQueue[T]) Puts(values []T) (puts, quantity uint32)

puts queue functions

func (*EsQueue[T]) Quantity

func (q *EsQueue[T]) Quantity() uint32

func (*EsQueue[T]) String

func (q *EsQueue[T]) String() string

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, bool)

func (*RingQueue[T]) Enqueue

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

func (*RingQueue[T]) Front

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

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() []T

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

func (*RingQueue[T]) Tail

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

type TinyQueue

type TinyQueue[T cmp.CompareLess[T]] struct {
	// contains filtered or unexported fields
}

func New

func New[T cmp.CompareLess[T]](data []T) *TinyQueue[T]

func (*TinyQueue[T]) Len

func (q *TinyQueue[T]) Len() int

func (*TinyQueue[T]) Peek

func (q *TinyQueue[T]) Peek() (T, bool)

func (*TinyQueue[T]) Pop

func (q *TinyQueue[T]) Pop() (T, bool)

func (*TinyQueue[T]) Push

func (q *TinyQueue[T]) Push(item T)

Jump to

Keyboard shortcuts

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