store

package
v0.0.0-...-a7b6888 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = errors.New("not implemented")
	ErrNotFound       = errors.New("not found")
)

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID        string        `json:"id"`
	CreatedAt time.Time     `json:"created"`
	UpdatedAt time.Time     `json:"updated"`
	Name      string        `json:"name"`
	State     AlertState    `json:"state"`
	Severity  AlertSeverity `json:"severity"`
}

func (Alert) String

func (a Alert) String() string

type AlertSeverity

type AlertSeverity uint
const (
	SeverityCritical AlertSeverity = iota
	SeverityWarning
	SeverityInformational
)

func (AlertSeverity) Emoji

func (s AlertSeverity) Emoji() emoji.Emoji

func (*AlertSeverity) FromString

func (s *AlertSeverity) FromString(str string) error

func (AlertSeverity) MarshalText

func (s AlertSeverity) MarshalText() (data []byte, err error)

func (AlertSeverity) String

func (s AlertSeverity) String() string

func (*AlertSeverity) UnmarshalText

func (s *AlertSeverity) UnmarshalText(data []byte) (err error)

type AlertState

type AlertState uint
const (
	StateNew AlertState = iota
	StateOpen
	StateAcknowledged
	StateStale
	StateClosed
)

func (AlertState) Emoji

func (s AlertState) Emoji() emoji.Emoji

func (*AlertState) FromString

func (s *AlertState) FromString(str string) error

func (AlertState) MarshalText

func (s AlertState) MarshalText() (data []byte, err error)

func (AlertState) String

func (s AlertState) String() string

func (*AlertState) UnmarshalText

func (s *AlertState) UnmarshalText(data []byte) (err error)

type Config

type Config struct {
	Path string `yaml:"path"`
}

type ErrInvalidStateTransition

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

func (ErrInvalidStateTransition) Error

type Heartbeat

type Heartbeat struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created"`
	UpdatedAt time.Time `json:"updated"`
}

type Store

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

func Open

func Open(conf *Config, infoLog, dbgLog *log.Logger) (s *Store, err error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateAlert

func (s *Store) CreateAlert(alert *Alert) (*Alert, error)

func (*Store) CreateHeartbeat

func (s *Store) CreateHeartbeat(alert *Heartbeat) (*Heartbeat, error)

func (*Store) DeleteAlert

func (s *Store) DeleteAlert(id string) error

func (*Store) DeleteHeartbeat

func (s *Store) DeleteHeartbeat(id string) error

func (*Store) GetAlert

func (s *Store) GetAlert(id string) (*Alert, error)

func (*Store) GetHeartbeat

func (s *Store) GetHeartbeat(id string) (*Heartbeat, error)

func (*Store) ListAlerts

func (s *Store) ListAlerts(offset, limit int) ([]Alert, error)

func (*Store) ListHeartbeats

func (s *Store) ListHeartbeats(offset, limit int) ([]Heartbeat, error)

func (*Store) RefreshHeartbeat

func (s *Store) RefreshHeartbeat(id string) (*Heartbeat, error)

func (*Store) SetAlertState

func (s *Store) SetAlertState(id string, new AlertState) (*Alert, error)

Jump to

Keyboard shortcuts

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