postgres

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL implementation of the Sentinel composite store using grove ORM with Go-based migrations.

Index

Constants

This section is empty.

Variables

View Source
var Migrations = migrate.NewGroup("sentinel")

Migrations is the grove migration group for the Sentinel store. It can be registered with the grove extension for orchestrated migration management (locking, version tracking, rollback support).

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a PostgreSQL implementation of the composite Sentinel store.

func New

func New(db *grove.DB) *Store

New creates a new PostgreSQL store.

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

func (s *Store) CancelRun(ctx context.Context, runID id.EvalRunID, at time.Time) (bool, error)

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) CountCases

func (s *Store) CountCases(ctx context.Context, suiteID id.SuiteID) (int64, error)

func (*Store) CreateCase

func (s *Store) CreateCase(ctx context.Context, tc *testcase.Case) error

func (*Store) CreateCaseBatch

func (s *Store) CreateCaseBatch(ctx context.Context, cases []*testcase.Case) error

func (*Store) CreateEvaluationPlan

func (s *Store) CreateEvaluationPlan(ctx context.Context, p *evalplan.Plan) error

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

func (s *Store) CreateRecordedJob(ctx context.Context, j *recorded.Job) (*recorded.Job, error)

CreateRecordedJob persists a request once per exact scope and idempotency key.

func (*Store) CreateResult

func (s *Store) CreateResult(ctx context.Context, result *evalrun.Result) error

func (*Store) CreateResultBatch

func (s *Store) CreateResultBatch(ctx context.Context, results []*evalrun.Result) error

func (*Store) CreateRun

func (s *Store) CreateRun(ctx context.Context, run *evalrun.Run) error

func (*Store) CreateSuite

func (s *Store) CreateSuite(ctx context.Context, su *suite.Suite) error

func (*Store) DeleteBaseline

func (s *Store) DeleteBaseline(ctx context.Context, baselineID id.BaselineID) error

func (*Store) DeleteCase

func (s *Store) DeleteCase(ctx context.Context, caseID id.CaseID) error

func (*Store) DeleteSuite

func (s *Store) DeleteSuite(ctx context.Context, suiteID id.SuiteID) error

DeleteSuite deletes a suite and everything that belongs to it. Postgres cascades on its own; the explicit deletes keep every backend behaving the same by construction.

func (*Store) FinalizeRun

func (s *Store) FinalizeRun(ctx context.Context, runID id.EvalRunID, f *evalrun.Finalization) (evalrun.RunState, error)

func (*Store) GetBaseline

func (s *Store) GetBaseline(ctx context.Context, baselineID id.BaselineID) (*baseline.Baseline, error)

func (*Store) GetCase

func (s *Store) GetCase(ctx context.Context, caseID id.CaseID) (*testcase.Case, error)

func (*Store) GetCurrentPromptVersion

func (s *Store) GetCurrentPromptVersion(ctx context.Context, suiteID id.SuiteID) (*promptversion.PromptVersion, error)

func (*Store) GetEvaluationPlan

func (s *Store) GetEvaluationPlan(ctx context.Context, planID id.ID) (*evalplan.Plan, error)

GetEvaluationPlan requires exact app and tenant identity.

func (*Store) GetLatestBaseline

func (s *Store) GetLatestBaseline(ctx context.Context, suiteID id.SuiteID) (*baseline.Baseline, error)

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

func (s *Store) GetRecordedJob(ctx context.Context, jobID id.ID) (*recorded.Job, error)

GetRecordedJob reads only the exact app and tenant's evidence.

func (*Store) GetResultStats

func (s *Store) GetResultStats(ctx context.Context, runID id.EvalRunID) (*evalrun.ResultStats, error)

func (*Store) GetRun

func (s *Store) GetRun(ctx context.Context, runID id.EvalRunID) (*evalrun.Run, error)

func (*Store) GetSuite

func (s *Store) GetSuite(ctx context.Context, suiteID id.SuiteID) (*suite.Suite, error)

func (*Store) GetSuiteByName

func (s *Store) GetSuiteByName(ctx context.Context, appID, name string) (*suite.Suite, error)

func (*Store) ImportCases

func (s *Store) ImportCases(_ context.Context, _ id.SuiteID, _ string, _ []byte) (int64, error)

func (*Store) ListBaselines

func (s *Store) ListBaselines(ctx context.Context, suiteID id.SuiteID) ([]*baseline.Baseline, error)

func (*Store) ListCases

func (s *Store) ListCases(ctx context.Context, suiteID id.SuiteID) ([]*testcase.Case, error)

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 (s *Store) ListResults(ctx context.Context, runID id.EvalRunID) ([]*evalrun.Result, error)

func (*Store) ListRuns

func (s *Store) ListRuns(ctx context.Context, filter *evalrun.ListFilter) ([]*evalrun.Run, error)

func (*Store) ListRunsBySuite

func (s *Store) ListRunsBySuite(ctx context.Context, suiteID id.SuiteID) ([]*evalrun.Run, error)

func (*Store) ListSuites

func (s *Store) ListSuites(ctx context.Context, filter *suite.ListFilter) ([]*suite.Suite, error)

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate runs programmatic migrations via the grove orchestrator.

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping verifies the database connection.

func (*Store) RecordedPersistent

func (s *Store) RecordedPersistent(ctx context.Context) (bool, error)

RecordedPersistent requires a reachable persistent backend.

func (*Store) SaveBaseline

func (s *Store) SaveBaseline(ctx context.Context, b *baseline.Baseline) error

func (*Store) SetCurrentPromptVersion

func (s *Store) SetCurrentPromptVersion(ctx context.Context, suiteID id.SuiteID, pvID id.PromptVersionID) error

func (*Store) UpdateCase

func (s *Store) UpdateCase(ctx context.Context, tc *testcase.Case) error

func (*Store) UpdateRecordedJob

func (s *Store) UpdateRecordedJob(ctx context.Context, expected int64, j *recorded.Job) error

UpdateRecordedJob atomically compares the revision before a fenced checkpoint.

func (*Store) UpdateRun

func (s *Store) UpdateRun(ctx context.Context, run *evalrun.Run) error

func (*Store) UpdateSuite

func (s *Store) UpdateSuite(ctx context.Context, su *suite.Suite) error

Jump to

Keyboard shortcuts

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