Documentation ¶
Index ¶
- Variables
- type Alerts
- func (a *Alerts) Delete(fp model.Fingerprint) error
- func (a *Alerts) Empty() bool
- func (a *Alerts) Get(fp model.Fingerprint) (*types.Alert, error)
- func (a *Alerts) List() []*types.Alert
- func (a *Alerts) Run(ctx context.Context, interval time.Duration)
- func (a *Alerts) Set(alert *types.Alert) error
- func (a *Alerts) SetGCCallback(cb func([]*types.Alert))
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("alert not found")
ErrNotFound is returned if a Store cannot find the Alert.
Functions ¶
This section is empty.
Types ¶
type Alerts ¶
Alerts provides lock-coordinated to an in-memory map of alerts, keyed by their fingerprint. Resolved alerts are removed from the map based on gcInterval. An optional callback can be set which receives a slice of all resolved alerts that have been removed.
func (*Alerts) Delete ¶
func (a *Alerts) Delete(fp model.Fingerprint) error
Delete removes the Alert with the matching fingerprint from the store.
func (*Alerts) Get ¶
Get returns the Alert with the matching fingerprint, or an error if it is not found.
func (*Alerts) Run ¶
Run starts the GC loop. The interval must be greater than zero; if not, the function will panic.
func (*Alerts) SetGCCallback ¶
SetGCCallback sets a GC callback to be executed after each GC.
Click to show internal directories.
Click to hide internal directories.