feat(go): expose retained incident views

This commit is contained in:
Luna 2026-07-22 03:12:34 -07:00
parent eff31b3a82
commit 6355fb403d
No known key found for this signature in database
6 changed files with 166 additions and 7 deletions

View file

@ -55,6 +55,22 @@ type Stats struct {
LastAlert *string
}
// LoadReport reads one retained snapshot for read-only incident views.
func LoadReport(path string) (Report, error) {
raw, err := os.ReadFile(path)
if err != nil {
return Report{}, err
}
var report Report
if err := json.Unmarshal(raw, &report); err != nil {
return Report{}, err
}
if report.Schema != Schema {
return Report{}, fmt.Errorf("unexpected snapshot schema %q", report.Schema)
}
return report, nil
}
type Store struct {
Dir string
ProcRoot string