Documentation
¶
Index ¶
- type SimpleQueue
- type StructQueue
- func (q *StructQueue[T]) Delete(index string, key ...any)
- func (q *StructQueue[T]) Init(config structr.QueueConfig[T])
- func (q *StructQueue[T]) Len() int
- func (q *StructQueue[T]) Pop() (value T, ok bool)
- func (q *StructQueue[T]) PopCtx(ctx context.Context) (value T, ok bool)
- func (q *StructQueue[T]) Push(values ...T)
- func (q *StructQueue[T]) Wait() <-chan struct{}
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]) 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.