queue

package
v0.17.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleQueue

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

SimpleQueue provides a simple concurrency safe queue using generics and a memory pool of list elements to reduce overall memory usage.

func (*SimpleQueue[T]) Len

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

Len returns the current length of the queue.

func (*SimpleQueue[T]) Pop

func (q *SimpleQueue[T]) Pop() (value T, ok bool)

Pop will attempt to pop value from the queue.

func (*SimpleQueue[T]) PopCtx

func (q *SimpleQueue[T]) PopCtx(ctx context.Context) (value T, ok bool)

PopCtx will attempt to pop value from queue, else blocking on context.

func (*SimpleQueue[T]) Push

func (q *SimpleQueue[T]) Push(value T)

Push will push given value to the queue.

type StructQueue

type StructQueue[StructType any] struct {
	// contains filtered or unexported fields
}

StructQueue wraps a structr.Queue{} to provide simple index caching by name.

func (*StructQueue[T]) Delete

func (q *StructQueue[T]) Delete(index string, key ...any)

Delete pops (and drops!) all queued entries under index with key.

func (*StructQueue[T]) Init

func (q *StructQueue[T]) Init(config structr.QueueConfig[T])

Init initializes queue with structr.QueueConfig{}.

func (*StructQueue[T]) Len

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

Len: see structr.Queue{}.Len().

func (*StructQueue[T]) Pop

func (q *StructQueue[T]) Pop() (value T, ok bool)

Pop: see structr.Queue{}.PopFront().

func (*StructQueue[T]) PopCtx

func (q *StructQueue[T]) PopCtx(ctx context.Context) (value T, ok bool)

PopCtx: see structr.QueueCtx{}.PopFront().

func (*StructQueue[T]) Push

func (q *StructQueue[T]) Push(values ...T)

Push: see structr.Queue.PushBack().

func (*StructQueue[T]) Wait

func (q *StructQueue[T]) Wait() <-chan struct{}

Wait returns current wait channel, which may be blocked on to awaken when new value pushed to queue.

Jump to

Keyboard shortcuts

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