record

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package record handles persistence of certification records.

Index

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 NewStore

func NewStore(dir string) *Store

NewStore creates a new record store rooted at the given directory.

func NewStoreWithSnapshot added in v0.2.0

func NewStoreWithSnapshot(dir, snapshotPath string) *Store

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) Load

Load reads a certification record for the given unit.

func (*Store) LoadHistory

func (s *Store) LoadHistory(id domain.UnitID) ([]historyEntry, error)

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

func (s *Store) LoadSnapshot(path string) error

LoadSnapshot reads records from a snapshot file and populates the store by writing individual record files. Use this to restore state after clone.

func (*Store) Save

func (s *Store) Save(rec domain.CertificationRecord) error

Save writes a certification record to the store.

func (*Store) SaveSnapshot added in v0.2.0

func (s *Store) SaveSnapshot(path string, commit string) error

SaveSnapshot writes all current records to a single JSON snapshot file. Records are sorted by UnitID for deterministic output (clean git diffs).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL