Documentation
¶
Overview ¶
Package record handles persistence of certification records.
Index ¶
- type Store
- func (s *Store) AppendHistory(rec domain.CertificationRecord) error
- func (s *Store) AppendRun(run domain.CertificationRun) error
- func (s *Store) ListAll() ([]domain.CertificationRecord, error)
- func (s *Store) Load(id domain.UnitID) (domain.CertificationRecord, error)
- func (s *Store) LoadHistory(id domain.UnitID) ([]historyEntry, error)
- func (s *Store) LoadRuns() ([]domain.CertificationRun, error)
- func (s *Store) LoadSnapshot(path string) error
- func (s *Store) Save(rec domain.CertificationRecord) error
- func (s *Store) SaveSnapshot(path string, commit string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages certification record files.
func NewStoreWithSnapshot ¶ added in v0.2.0
NewStoreWithSnapshot creates a record store with a snapshot fallback path. When ListAll finds no individual record files, it reads from the snapshot.
func (*Store) AppendHistory ¶
func (s *Store) AppendHistory(rec domain.CertificationRecord) error
AppendHistory appends a history entry for the given record. History is stored as a JSON-lines file alongside the record.
func (*Store) AppendRun ¶ added in v0.2.0
func (s *Store) AppendRun(run domain.CertificationRun) error
AppendRun appends a certification run record to the runs.jsonl file.
func (*Store) ListAll ¶
func (s *Store) ListAll() ([]domain.CertificationRecord, error)
ListAll returns all records in the store. If the records directory is empty or missing and a snapshot path is configured, it falls back to reading from the snapshot file.
func (*Store) LoadHistory ¶
LoadHistory returns all history entries for a unit.
func (*Store) LoadRuns ¶ added in v0.2.0
func (s *Store) LoadRuns() ([]domain.CertificationRun, error)
LoadRuns reads all certification runs from the runs.jsonl file.
func (*Store) LoadSnapshot ¶ added in v0.2.0
LoadSnapshot reads records from a snapshot file and populates the store by writing individual record files. Use this to restore state after clone.