kioradb

package
v0.0.0-...-8ca999e Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInMemoryDB

func NewInMemoryDB() *inMemoryDB

func QueryAlertStats

func QueryAlertStats(ctx context.Context, db DB, q query.AlertStatsQuery) ([]query.StatsResult, error)

Types

type BoltDB

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

BoltDB is a DB implementation that stores data in a BoltDB database.

func NewBoltDB

func NewBoltDB(path string, logger zerolog.Logger) (*BoltDB, error)

NewBoltDB creates a new BoltDB database at the given path.

func (*BoltDB) Close

func (b *BoltDB) Close() error

func (*BoltDB) QueryAlerts

func (b *BoltDB) QueryAlerts(ctx context.Context, query query.AlertQuery) []model.Alert

func (*BoltDB) QuerySilences

func (b *BoltDB) QuerySilences(ctx context.Context, query query.SilenceQuery) []model.Silence

QuerySilences queries the database for silences matching the given query.

func (*BoltDB) StoreAlerts

func (b *BoltDB) StoreAlerts(ctx context.Context, alerts ...model.Alert) error

func (*BoltDB) StoreSilences

func (b *BoltDB) StoreSilences(ctx context.Context, silences ...model.Silence) error

type DB

type DB interface {
	// StoreAlerts stores the given alerts in the database, updating any existing alerts with the same labels.
	StoreAlerts(ctx context.Context, alerts ...model.Alert) error

	// QueryAlerts queries the database for alerts matching the given query.
	QueryAlerts(ctx context.Context, query query.AlertQuery) []model.Alert

	// StoreSilences stores the given silences in the database, updating any existing silences with the same ID.
	StoreSilences(ctx context.Context, silences ...model.Silence) error

	// QuerySilences queries the database for silences matching the given query.
	QuerySilences(ctx context.Context, query query.SilenceQuery) []model.Silence

	Close() error
}

DB defines an interface that is able to process alerts, silences etc and store them (for some definition of store).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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