Documentation ¶
Index ¶
- Variables
- func IsErrNotFound(err error) bool
- type AlertStore
- func (a *AlertStore) AcknowledgeAndSetMultiple(extendedAlertList []*client.ExtendedAlert, acknowledgedBy string) error
- func (a *AlertStore) Count() int
- func (a *AlertStore) Delete(fp model.Fingerprint) error
- func (a *AlertStore) Get(fp model.Fingerprint) (*client.ExtendedAlert, error)
- func (a *AlertStore) GetFromFingerPrintString(fpString string) (*client.ExtendedAlert, error)
- func (a *AlertStore) List() []*client.ExtendedAlert
- func (a *AlertStore) Run(wg *sync.WaitGroup, stopCh <-chan struct{})
- func (a *AlertStore) Set(extendedAlert *client.ExtendedAlert) error
- func (a *AlertStore) Snapshot() error
- func (a *AlertStore) UpdateAlertEndsAt(extendedAlert *client.ExtendedAlert) error
- type FilePersister
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is exactly that. ErrNotFound = errors.New("alert not found") )
Functions ¶
func IsErrNotFound ¶
IsErrNotFound checks whether the error is an ErrNotFound.
Types ¶
type AlertStore ¶
type AlertStore struct {
// contains filtered or unexported fields
}
AlertStore ...
func NewAlertStore ¶
func NewAlertStore(cfg config.Config, recheckInterval time.Duration, persister *FilePersister, logger log.Logger) *AlertStore
NewAlertStore creates a new AlertStore.
func (*AlertStore) AcknowledgeAndSetMultiple ¶
func (a *AlertStore) AcknowledgeAndSetMultiple(extendedAlertList []*client.ExtendedAlert, acknowledgedBy string) error
AcknowledgeAndSetMultiple acknowledges and adds multiple alerts to the AlertStore. If alert already present in AlertStore, additional acknowledgers will be appended.
func (*AlertStore) Count ¶
func (a *AlertStore) Count() int
Count returns the number of items in the AlertStore.
func (*AlertStore) Delete ¶
func (a *AlertStore) Delete(fp model.Fingerprint) error
Delete removes an item from the AlertStore.
func (*AlertStore) Get ¶
func (a *AlertStore) Get(fp model.Fingerprint) (*client.ExtendedAlert, error)
Get returns an alert for a given Fingerprint or an error.
func (*AlertStore) GetFromFingerPrintString ¶
func (a *AlertStore) GetFromFingerPrintString(fpString string) (*client.ExtendedAlert, error)
GetFromFingerPrintString returns an alert for a given Fingerprint or an error.
func (*AlertStore) List ¶
func (a *AlertStore) List() []*client.ExtendedAlert
List returns a list of alerts in the AlertStore.
func (*AlertStore) Run ¶
func (a *AlertStore) Run(wg *sync.WaitGroup, stopCh <-chan struct{})
Run runs the AlertStore.
func (*AlertStore) Set ¶
func (a *AlertStore) Set(extendedAlert *client.ExtendedAlert) error
Set adds an alert to the AlertStore.
func (*AlertStore) Snapshot ¶
func (a *AlertStore) Snapshot() error
Snapshot creates a snapshot of the current store
func (*AlertStore) UpdateAlertEndsAt ¶
func (a *AlertStore) UpdateAlertEndsAt(extendedAlert *client.ExtendedAlert) error
UpdateAlertEndsAt updates the EndsAt field of an alert in the AlertStore.
type FilePersister ¶
type FilePersister struct {
// contains filtered or unexported fields
}
FilePersister is used to save/load an AlertStore to/from a file.
func NewFilePersister ¶
func NewFilePersister(filePath string, logger log.Logger) (*FilePersister, error)
NewFilePersister returns a new FilePersister.
func (*FilePersister) Load ¶
func (p *FilePersister) Load() (map[model.Fingerprint]*client.ExtendedAlert, error)
Load attempts to load a store from a file.
func (*FilePersister) Store ¶
func (p *FilePersister) Store(store map[model.Fingerprint]*client.ExtendedAlert) (int64, error)
Store attempts to save a store to a file.