consumer

package
v0.0.0-...-1c999d7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

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

func NewConsumer

func NewConsumer[T any](name string, logLevel ...zapcore.Level) *Consumer[T]

func (*Consumer[T]) AddOnClose

func (c *Consumer[T]) AddOnClose(funs ...func()) *Consumer[T]

func (*Consumer[T]) AddOnConsume

func (c *Consumer[T]) AddOnConsume(funs ...func(T)) *Consumer[T]

func (*Consumer[T]) Log

func (c *Consumer[T]) Log() *zap.SugaredLogger

func (*Consumer[T]) Name

func (c *Consumer[T]) Name() string

func (*Consumer[T]) Push

func (c *Consumer[T]) Push(inp T)

func (*Consumer[T]) Run

func (c *Consumer[T]) Run()

func (*Consumer[T]) Start

func (c *Consumer[T]) Start(wg ...*sync.WaitGroup)

func (*Consumer[T]) Stop

func (c *Consumer[T]) Stop()

type FIFOQueue

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

FIFOQueue implements variable size synchronized FIFO queue

func New

func New[T any]() *FIFOQueue[T]

func (*FIFOQueue[T]) Close

func (q *FIFOQueue[T]) Close()

Close closes FIFOQueue deferred until all elements are pull

func (*FIFOQueue[T]) CloseNow

func (q *FIFOQueue[T]) CloseNow()

CloseNow closes FIFOQueue immediately. The elements in the buffer are lost

func (*FIFOQueue[T]) Consume

func (q *FIFOQueue[T]) Consume(consumerFunctions ...func(elem T))

Consume reads all elements of the queue until it is closed

func (*FIFOQueue[T]) Len

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

Len returns number of elements in the queue. Non-deterministic

func (*FIFOQueue[T]) Push

func (q *FIFOQueue[T]) Push(elem T) bool

Push pushes element

Jump to

Keyboard shortcuts

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