Documentation
¶
Overview ¶
Package store provides SQLite-backed persistence for workflow run data.
Index ¶
- func DefaultPath() (string, error)
- type Store
- func (s *Store) Close() error
- func (s *Store) IncompleteRunIDs() ([]int64, error)
- func (s *Store) LoadRunDetail(runID int64) (*model.RunDetail, error)
- func (s *Store) LoadRunDetails(workflowID int64, since time.Time) ([]model.RunDetail, error)
- func (s *Store) LoadRunDetailsByIDs(ids []int64) ([]model.RunDetail, error)
- func (s *Store) RunsSince(workflowID int64, since time.Time) ([]model.WorkflowRun, error)
- func (s *Store) SaveRunDetail(d *model.RunDetail) error
- func (s *Store) SaveRunDetails(details []model.RunDetail) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath returns the default database path (~/.cache/ci-snitch/data.db).
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists and queries workflow run data in SQLite.
func Open ¶
Open opens or creates a SQLite database at the given path.
busy_timeout and foreign_keys are per-connection settings, and database/sql pools connections — a `PRAGMA` via db.Exec would bind to a single pooled connection while concurrent workflow hydration opens others without it (SQLITE_BUSY on parallel saves, unenforced foreign keys). DSN _pragma parameters make the driver apply them to every connection it opens. busy_timeout comes first so the journal_mode switch itself retries under contention; WAL allows concurrent reads during parallel workflow writes.
func (*Store) IncompleteRunIDs ¶
IncompleteRunIDs returns IDs of runs that are not yet completed.
func (*Store) LoadRunDetail ¶
LoadRunDetail loads a fully hydrated run detail from the store. A missing run is an error identifiable as sql.ErrNoRows.
func (*Store) LoadRunDetails ¶
LoadRunDetails loads all completed run details for a workflow since the given time.
func (*Store) LoadRunDetailsByIDs ¶ added in v0.26.0
LoadRunDetailsByIDs hydrates the given runs in three queries per chunk (runs, jobs, steps) instead of 1 + N + N×jobs individual lookups — a 500-run cached scan previously issued ~1500 queries.
func (*Store) SaveRunDetail ¶
SaveRunDetail persists a run and its jobs and steps. Uses INSERT OR REPLACE so re-fetched runs (e.g. previously in-progress) are updated.