queue

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: GPL-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 AlertQueue

type AlertQueue struct {
	*Queue[*store.MonitorAlert]
}

AlertQueue is a concrete queue type for MonitorAlerts.

func NewAlertQueue

func NewAlertQueue(log *logrus.Logger, worker func(context.Context, *store.MonitorAlert) (bool, error), metrics *Metrics) *AlertQueue

NewAlertQueue creates a new alert queue.

type Metrics

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

func NewMetrics

func NewMetrics(namespace string) *Metrics

type Queue

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

Queue is a generic queue for processing items.

func NewQueue

func NewQueue[T any](log *logrus.Logger, worker func(context.Context, T) (bool, error), metrics *Metrics) *Queue[T]

NewQueue creates a new queue.

func (*Queue[T]) Enqueue

func (q *Queue[T]) Enqueue(item T)

func (*Queue[T]) SetWorker

func (q *Queue[T]) SetWorker(worker func(context.Context, T) (bool, error))

SetWorker sets the worker function for processing items.

func (*Queue[T]) Start

func (q *Queue[T]) Start(ctx context.Context)

func (*Queue[T]) Stop

func (q *Queue[T]) Stop(ctx context.Context)

Stop stops the queue processor.

type Queuer

type Queuer interface {
	Start(ctx context.Context)
	Stop(ctx context.Context)
}

Queuer defines the interface for queue operations.

Jump to

Keyboard shortcuts

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