feat(alerting): add async state persister (#80763)

This commit is contained in:
Jean-Philippe Quéméner
2024-01-22 13:07:11 +01:00
committed by GitHub
parent a7e9408433
commit eb7e1216a1
7 changed files with 313 additions and 0 deletions

View File

@@ -53,6 +53,16 @@ func (f *FakeInstanceStore) DeleteAlertInstancesByRule(ctx context.Context, key
return nil
}
func (f *FakeInstanceStore) FullSync(ctx context.Context, instances []models.AlertInstance) error {
f.mtx.Lock()
defer f.mtx.Unlock()
f.RecordedOps = []any{}
for _, instance := range instances {
f.RecordedOps = append(f.RecordedOps, instance)
}
return nil
}
type FakeRuleReader struct{}
func (f *FakeRuleReader) ListAlertRules(_ context.Context, q *models.ListAlertRulesQuery) (models.RulesGroup, error) {