mem

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 61

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertStoreCallback added in v0.23.0

type AlertStoreCallback interface {
	// PreStore is called before alert is stored into the store. If this method returns error,
	// alert is not stored.
	// Existing flag indicates whether alert has existed before (and is only updated) or not.
	// If alert has existed before, then alert passed to PreStore is result of merging existing alert with new alert.
	PreStore(alert *types.Alert, existing bool) error

	// PostStore is called after alert has been put into store.
	PostStore(alert *types.Alert, existing bool)

	// PostDelete is called after alert has been removed from the store due to alert garbage collection.
	PostDelete(alert *types.Alert)
}

type Alerts

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

Alerts gives access to a set of alerts. All methods are goroutine-safe.

func NewAlerts

func NewAlerts(ctx context.Context, m types.AlertMarker, intervalGC time.Duration, alertCallback AlertStoreCallback, l *slog.Logger, r prometheus.Registerer) (*Alerts, error)

NewAlerts returns a new alert provider.

func (*Alerts) Close

func (a *Alerts) Close()

Close the alert provider.

func (*Alerts) Get

func (a *Alerts) Get(fp model.Fingerprint) (*types.Alert, error)

Get returns the alert for a given fingerprint.

func (*Alerts) GetPending

func (a *Alerts) GetPending() provider.AlertIterator

GetPending returns an iterator over all the alerts that have pending notifications.

func (*Alerts) Put

func (a *Alerts) Put(ctx context.Context, alerts ...*types.Alert) error

Put adds the given alert to the set.

func (*Alerts) SlurpAndSubscribe added in v0.30.0

func (a *Alerts) SlurpAndSubscribe(name string) ([]*types.Alert, provider.AlertIterator)

func (*Alerts) Subscribe

func (a *Alerts) Subscribe(name string) provider.AlertIterator

Subscribe returns an iterator over active alerts that have not been resolved and successfully notified about. They are not guaranteed to be in chronological order.

Jump to

Keyboard shortcuts

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