Documentation
¶
Overview ¶
Package sqlite provides a SQLite implementation of the Sentinel composite store using grove ORM with the sqlitedriver. Suitable for local development and single-node testing.
Index ¶
- Variables
- type Store
- func (s *Store) AdvanceRecordedCursor(ctx context.Context, req recorded.CursorAdvance) (*recorded.SourceCursor, error)
- func (s *Store) CancelRun(ctx context.Context, runID id.EvalRunID, at time.Time) (bool, error)
- func (s *Store) Close() error
- func (s *Store) CountCases(ctx context.Context, suiteID id.SuiteID) (int64, error)
- func (s *Store) CreateCase(ctx context.Context, tc *testcase.Case) error
- func (s *Store) CreateCaseBatch(ctx context.Context, cases []*testcase.Case) error
- func (s *Store) CreateEvaluationPlan(ctx context.Context, p *evalplan.Plan) error
- func (s *Store) CreatePromptVersion(ctx context.Context, pv *promptversion.PromptVersion) error
- func (s *Store) CreateRecordedJob(ctx context.Context, j *recorded.Job) (*recorded.Job, error)
- func (s *Store) CreateResult(ctx context.Context, result *evalrun.Result) error
- func (s *Store) CreateResultBatch(ctx context.Context, results []*evalrun.Result) error
- func (s *Store) CreateRun(ctx context.Context, run *evalrun.Run) error
- func (s *Store) CreateSuite(ctx context.Context, su *suite.Suite) error
- func (s *Store) DeleteBaseline(ctx context.Context, baselineID id.BaselineID) error
- func (s *Store) DeleteCase(ctx context.Context, caseID id.CaseID) error
- func (s *Store) DeleteSuite(ctx context.Context, suiteID id.SuiteID) error
- func (s *Store) FinalizeRun(ctx context.Context, runID id.EvalRunID, f *evalrun.Finalization) (evalrun.RunState, error)
- func (s *Store) GetBaseline(ctx context.Context, baselineID id.BaselineID) (*baseline.Baseline, error)
- func (s *Store) GetCase(ctx context.Context, caseID id.CaseID) (*testcase.Case, error)
- func (s *Store) GetCurrentPromptVersion(ctx context.Context, suiteID id.SuiteID) (*promptversion.PromptVersion, error)
- func (s *Store) GetEvaluationPlan(ctx context.Context, planID id.ID) (*evalplan.Plan, error)
- func (s *Store) GetLatestBaseline(ctx context.Context, suiteID id.SuiteID) (*baseline.Baseline, error)
- func (s *Store) GetPromptVersion(ctx context.Context, pvID id.PromptVersionID) (*promptversion.PromptVersion, error)
- func (s *Store) GetRecordedCursor(ctx context.Context, binding string) (*recorded.SourceCursor, error)
- func (s *Store) GetRecordedJob(ctx context.Context, jobID id.ID) (*recorded.Job, error)
- func (s *Store) GetResultStats(ctx context.Context, runID id.EvalRunID) (*evalrun.ResultStats, error)
- func (s *Store) GetRun(ctx context.Context, runID id.EvalRunID) (*evalrun.Run, error)
- func (s *Store) GetSuite(ctx context.Context, suiteID id.SuiteID) (*suite.Suite, error)
- func (s *Store) GetSuiteByName(ctx context.Context, appID, name string) (*suite.Suite, error)
- func (s *Store) ImportCases(_ context.Context, _ id.SuiteID, _ string, _ []byte) (int64, error)
- func (s *Store) ListBaselines(ctx context.Context, suiteID id.SuiteID) ([]*baseline.Baseline, error)
- func (s *Store) ListCases(ctx context.Context, suiteID id.SuiteID) ([]*testcase.Case, error)
- func (s *Store) ListPromptVersions(ctx context.Context, suiteID id.SuiteID) ([]*promptversion.PromptVersion, error)
- func (s *Store) ListRecordedJobs(ctx context.Context, query recorded.Query) ([]*recorded.Job, error)
- func (s *Store) ListResults(ctx context.Context, runID id.EvalRunID) ([]*evalrun.Result, error)
- func (s *Store) ListRuns(ctx context.Context, filter *evalrun.ListFilter) ([]*evalrun.Run, error)
- func (s *Store) ListRunsBySuite(ctx context.Context, suiteID id.SuiteID) ([]*evalrun.Run, error)
- func (s *Store) ListSuites(ctx context.Context, filter *suite.ListFilter) ([]*suite.Suite, error)
- func (s *Store) Migrate(ctx context.Context) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) RecordedPersistent(ctx context.Context) (bool, error)
- func (s *Store) SaveBaseline(ctx context.Context, b *baseline.Baseline) error
- func (s *Store) SetCurrentPromptVersion(ctx context.Context, suiteID id.SuiteID, pvID id.PromptVersionID) error
- func (s *Store) UpdateCase(ctx context.Context, tc *testcase.Case) error
- func (s *Store) UpdateRecordedJob(ctx context.Context, expected int64, j *recorded.Job) error
- func (s *Store) UpdateRun(ctx context.Context, run *evalrun.Run) error
- func (s *Store) UpdateSuite(ctx context.Context, su *suite.Suite) error
Constants ¶
This section is empty.
Variables ¶
var Migrations = migrate.NewGroup("sentinel")
Migrations is the grove migration group for the Sentinel SQLite store.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a SQLite implementation of the composite Sentinel store.
SQLite allows one writer at a time, and grove's driver pools connections without a busy timeout, so two writes on separate connections fail at once with SQLITE_BUSY. Store therefore serialises its own writes: one Store value never issues two concurrent writes, while reads stay concurrent. The mutex covers one process only. When several processes share one sqlite file, open it with a busy timeout on the DSN as well, for example "file:sentinel.db?_pragma=busy_timeout(5000)", so a writer waits for the other process instead of failing.
func (*Store) AdvanceRecordedCursor ¶
func (s *Store) AdvanceRecordedCursor(ctx context.Context, req recorded.CursorAdvance) (*recorded.SourceCursor, error)
AdvanceRecordedCursor requires a persisted job and an atomic cursor revision.
func (*Store) CountCases ¶
func (*Store) CreateCaseBatch ¶
func (*Store) CreateEvaluationPlan ¶
CreateEvaluationPlan inserts immutable content. Updates are intentionally absent.
func (*Store) CreatePromptVersion ¶
func (s *Store) CreatePromptVersion(ctx context.Context, pv *promptversion.PromptVersion) error
func (*Store) CreateRecordedJob ¶
CreateRecordedJob persists a request once per exact scope and idempotency key.
func (*Store) CreateResult ¶
func (*Store) CreateResultBatch ¶
func (*Store) DeleteBaseline ¶
func (*Store) DeleteSuite ¶
DeleteSuite deletes a suite and everything that belongs to it. SQLite's ON DELETE CASCADE fires only on connections that ran PRAGMA foreign_keys, which grove sets on one pooled connection, so the children are deleted explicitly.
func (*Store) FinalizeRun ¶
func (*Store) GetBaseline ¶
func (*Store) GetCurrentPromptVersion ¶
func (s *Store) GetCurrentPromptVersion(ctx context.Context, suiteID id.SuiteID) (*promptversion.PromptVersion, error)
func (*Store) GetEvaluationPlan ¶
GetEvaluationPlan requires exact app and tenant identity.
func (*Store) GetLatestBaseline ¶
func (*Store) GetPromptVersion ¶
func (s *Store) GetPromptVersion(ctx context.Context, pvID id.PromptVersionID) (*promptversion.PromptVersion, error)
func (*Store) GetRecordedCursor ¶
func (s *Store) GetRecordedCursor(ctx context.Context, binding string) (*recorded.SourceCursor, error)
GetRecordedCursor reads only the exact app/tenant binding acknowledgment.
func (*Store) GetRecordedJob ¶
GetRecordedJob reads only the exact app and tenant's evidence.
func (*Store) GetResultStats ¶
func (*Store) GetSuiteByName ¶
func (*Store) ImportCases ¶
func (*Store) ListBaselines ¶
func (*Store) ListPromptVersions ¶
func (s *Store) ListPromptVersions(ctx context.Context, suiteID id.SuiteID) ([]*promptversion.PromptVersion, error)
func (*Store) ListRecordedJobs ¶
func (s *Store) ListRecordedJobs(ctx context.Context, query recorded.Query) ([]*recorded.Job, error)
ListRecordedJobs returns a stable ID page within the exact scope.
func (*Store) ListResults ¶
func (*Store) ListRunsBySuite ¶
func (*Store) ListSuites ¶
func (*Store) RecordedPersistent ¶
RecordedPersistent checks the active main database, excluding memory and temporary databases whose PRAGMA file name is empty.
func (*Store) SaveBaseline ¶
func (*Store) SetCurrentPromptVersion ¶
func (*Store) UpdateRecordedJob ¶
UpdateRecordedJob atomically compares the revision before a fenced checkpoint.