()
| 84 | } |
| 85 | |
| 86 | func (s *SessionFiles) flushIndex() error { |
| 87 | out := struct { |
| 88 | Sessions []SessionRecord `json:"sessions"` |
| 89 | }{Sessions: s.index} |
| 90 | data, err := json.MarshalIndent(out, "", " ") |
| 91 | if err != nil { |
| 92 | return err |
| 93 | } |
| 94 | return os.WriteFile(filepath.Join(s.root, "index.json"), data, 0o644) |
| 95 | } |
| 96 | |
| 97 | // Save appends an entry to the in-progress session draft. Nothing reaches |
| 98 | // disk until Close — drafts are cheap, and per-Save file writes during a |