memory

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements both monitor.MonitorStore and monitor.AlertStore using mutex-protected slices.

func NewStore

func NewStore() *Store

NewStore creates a new in-memory monitor/alert store.

func (*Store) Delete

func (s *Store) Delete(_ context.Context, id string) error

Delete removes the monitor with the given ID.

func (*Store) Get

func (s *Store) Get(_ context.Context, id string) (*monitor.Monitor, error)

Get returns the monitor with the given ID, or ErrNotFound.

func (*Store) GetAlert

func (s *Store) GetAlert(_ context.Context, id string) (*monitor.AlertEvent, error)

GetAlert returns the alert event with the given ID, or ErrNotFound.

func (*Store) List

func (s *Store) List(_ context.Context, filter monitor.MonitorFilter) ([]monitor.Monitor, error)

List returns monitors matching the filter, newest first.

func (*Store) ListAlerts

func (s *Store) ListAlerts(_ context.Context, filter monitor.AlertFilter) ([]monitor.AlertEvent, error)

ListAlerts returns alert events matching the filter, newest first.

func (*Store) ListEnabled

func (s *Store) ListEnabled(_ context.Context) ([]monitor.Monitor, error)

ListEnabled returns all monitors with Enabled == true.

func (*Store) Save

func (s *Store) Save(_ context.Context, m *monitor.Monitor) error

Save appends or replaces the monitor. If m.ID is empty a UUID is generated.

func (*Store) SaveAlert

func (s *Store) SaveAlert(_ context.Context, a *monitor.AlertEvent) error

SaveAlert appends the alert event. If a.ID is empty a UUID is generated.

func (*Store) Update

func (s *Store) Update(_ context.Context, m *monitor.Monitor) error

Update finds the monitor by ID and replaces it entirely.

Jump to

Keyboard shortcuts

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