queue

package
v0.0.0-...-35d28e4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueFull = fmt.Errorf("queue closed due to size limit")

ErrQueueFull is returned by a Write operation when that Write causes the queue to reach its size limit.

Functions

This section is empty.

Types

type LimitQueue

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

LimitQueue accepts all messages into a queue for asynchronous consumption by a sink until an upper limit of messages is reached. When that limit is reached, the entire Queue is Closed. It is thread safe but the sink must be reliable or events will be dropped. If a size of 0 is provided, the LimitQueue is considered limitless.

func NewLimitQueue

func NewLimitQueue(dst events.Sink, limit uint64) *LimitQueue

NewLimitQueue returns a queue to the provided Sink dst.

func (*LimitQueue) Close

func (eq *LimitQueue) Close() error

Close shuts down the event queue, flushing all events

func (*LimitQueue) Full

func (eq *LimitQueue) Full() chan struct{}

Full returns a channel that is closed when the queue becomes full for the first time.

func (*LimitQueue) Len

func (eq *LimitQueue) Len() int

Len returns the number of items that are currently stored in the queue and not consumed by its sink.

func (*LimitQueue) String

func (eq *LimitQueue) String() string

func (*LimitQueue) Write

func (eq *LimitQueue) Write(event events.Event) error

Write accepts the events into the queue, only failing if the queue has been closed or has reached its size limit.

Jump to

Keyboard shortcuts

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