Documentation
¶
Overview ¶
Package store provides PostgreSQL-backed data persistence using pgx and sqlc.
Index ¶
- Constants
- Variables
- func CurrentSchemaVersion(ctx context.Context, pool *pgxpool.Pool) (int32, error)
- func RunMigrations(ctx context.Context, pool *pgxpool.Pool) error
- type ActiveRepoRunError
- type ApiToken
- type ArtifactBundle
- type BootstrapToken
- type CancelActiveJobsByRunAttemptParams
- type CompleteBootstrapEnrollmentParams
- type ConfigBundleMap
- type ConfigEnv
- type ConfigIn
- type CountJobsPageParams
- type CountRunsByWaveStatusRow
- type CreateArtifactBundleParams
- type CreateDiffParams
- type CreateEventParams
- type CreateGitSpecSnapshotParams
- type CreateJobParams
- type CreateLogParams
- type CreateMigParams
- type CreateMigRepoParams
- type CreateNodeDaemonLogParams
- type CreateNodeParams
- type CreateSpecBundleParams
- type CreateSpecParams
- type CreateWaveParams
- type CreateWaveWithRunsParams
- type DBTX
- type DeleteGlobalEnvParams
- type Diff
- type Event
- type GetAPITokenByIDRow
- type GetBootstrapTokenRow
- type GetGitSpecSnapshotParams
- type GetGlobalEnvParams
- type GetLatestRunByMigAndRepoStatusParams
- type GetLatestRunByMigAndRepoStatusRow
- type GetMigRepoByURLParams
- type GetRunSnapshotMetadataRow
- type HasRunningJobForRunNodeParams
- type InsertAPITokenParams
- type InsertBootstrapTokenParams
- type Job
- type JobMetric
- type JobPlan
- type ListAPITokensRow
- type ListArtifactBundlesByRunAndJobParams
- type ListDistinctReposRow
- type ListEventsByRunSinceParams
- type ListJobsByRunAttemptParams
- type ListJobsPageParams
- type ListJobsPageRow
- type ListLogsByRunSinceParams
- type ListMigsParams
- type ListNodeDaemonLogsParams
- type ListRunSBOMRowsByJobTypeParams
- type ListRunSBOMRowsByJobTypeRow
- type ListRunsForRepoParams
- type ListRunsForRepoRow
- type ListRunsParams
- type ListRunsWithMetadataParams
- type ListRunsWithMetadataRow
- type ListRunsWithURLByWaveRow
- type ListSpecBundlesParams
- type ListSpecsParams
- type ListStaleRunningJobsRow
- type Log
- type Mig
- type MigRepo
- type Node
- type NodeDaemonLog
- type NodeDiagnostic
- type NodeMetric
- type PgStore
- func (s *PgStore) CancelRun(ctx context.Context, runID types.RunID) error
- func (s *PgStore) CancelWave(ctx context.Context, waveID types.WaveID) error
- func (s *PgStore) ClaimJob(ctx context.Context, nodeID types.NodeID) (Job, error)
- func (s *PgStore) Close()
- func (s *PgStore) CompleteBootstrapEnrollment(ctx context.Context, arg CompleteBootstrapEnrollmentParams) error
- func (s *PgStore) CreateDiff(ctx context.Context, arg CreateDiffParams) (Diff, error)
- func (s *PgStore) CreateGitSpecSnapshot(ctx context.Context, arg CreateGitSpecSnapshotParams) (Spec, error)
- func (s *PgStore) CreateJob(ctx context.Context, arg CreateJobParams) (Job, error)
- func (s *PgStore) CreateSpec(ctx context.Context, arg CreateSpecParams) (Spec, error)
- func (s *PgStore) CreateWaveWithRuns(ctx context.Context, arg CreateWaveWithRunsParams) (Wave, []RunMaterialization, error)
- func (s *PgStore) Pool() *pgxpool.Pool
- func (s *PgStore) RestartRun(ctx context.Context, arg RestartRunParams) (Run, error)
- func (s *PgStore) UnclaimJob(ctx context.Context, arg UnclaimJobParams) error
- func (s *PgStore) UpdateJobCompletionWithMeta(ctx context.Context, arg UpdateJobCompletionWithMetaParams) error
- func (s *PgStore) UpdateJobMeta(ctx context.Context, arg UpdateJobMetaParams) error
- func (s *PgStore) UpdateWaveCompletion(ctx context.Context, arg UpdateWaveCompletionParams) error
- func (s *PgStore) UpsertNodeDiagnostic(ctx context.Context, arg UpsertNodeDiagnosticParams) (NodeDiagnostic, error)
- func (s *PgStore) WithJobExecution(ctx context.Context, jobID types.JobID, resumeCount int, ...) error
- type Querier
- type Queries
- func (q *Queries) ArchiveMig(ctx context.Context, id types.MigID) error
- func (q *Queries) CancelActiveJobsByRun(ctx context.Context, runID types.RunID) (int64, error)
- func (q *Queries) CancelActiveJobsByRunAttempt(ctx context.Context, arg CancelActiveJobsByRunAttemptParams) (int64, error)
- func (q *Queries) CancelActiveRunsByWave(ctx context.Context, waveID types.WaveID) (int64, error)
- func (q *Queries) CheckAPITokenRevoked(ctx context.Context, tokenID string) (pgtype.Timestamptz, error)
- func (q *Queries) CheckBootstrapTokenRevoked(ctx context.Context, tokenID string) (pgtype.Timestamptz, error)
- func (q *Queries) ClaimJob(ctx context.Context, nodeID types.NodeID) (Job, error)
- func (q *Queries) CountJobsPage(ctx context.Context, arg CountJobsPageParams) (int64, error)
- func (q *Queries) CountRunsByWaveStatus(ctx context.Context, waveID types.WaveID) ([]CountRunsByWaveStatusRow, error)
- func (q *Queries) CountStaleNodesWithRunningJobs(ctx context.Context, lastHeartbeat pgtype.Timestamptz) (int64, error)
- func (q *Queries) CreateArtifactBundle(ctx context.Context, arg CreateArtifactBundleParams) (ArtifactBundle, error)
- func (q *Queries) CreateDiff(ctx context.Context, arg CreateDiffParams) (Diff, error)
- func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) (Event, error)
- func (q *Queries) CreateGitSpecSnapshot(ctx context.Context, arg CreateGitSpecSnapshotParams) (Spec, error)
- func (q *Queries) CreateJob(ctx context.Context, arg CreateJobParams) (Job, error)
- func (q *Queries) CreateLog(ctx context.Context, arg CreateLogParams) (Log, error)
- func (q *Queries) CreateMig(ctx context.Context, arg CreateMigParams) (Mig, error)
- func (q *Queries) CreateMigRepo(ctx context.Context, arg CreateMigRepoParams) (MigRepo, error)
- func (q *Queries) CreateNode(ctx context.Context, arg CreateNodeParams) (Node, error)
- func (q *Queries) CreateNodeDaemonLog(ctx context.Context, arg CreateNodeDaemonLogParams) (NodeDaemonLog, error)
- func (q *Queries) CreateSpec(ctx context.Context, arg CreateSpecParams) (Spec, error)
- func (q *Queries) CreateSpecBundle(ctx context.Context, arg CreateSpecBundleParams) (SpecBundle, error)
- func (q *Queries) CreateWave(ctx context.Context, arg CreateWaveParams) (Wave, error)
- func (q *Queries) DeleteArtifactBundle(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) DeleteDiff(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) DeleteExpiredArtifactBundles(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
- func (q *Queries) DeleteExpiredDiffs(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
- func (q *Queries) DeleteExpiredEvents(ctx context.Context, time pgtype.Timestamptz) (int64, error)
- func (q *Queries) DeleteExpiredLogs(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
- func (q *Queries) DeleteGlobalEnv(ctx context.Context, arg DeleteGlobalEnvParams) error
- func (q *Queries) DeleteJob(ctx context.Context, id types.JobID) error
- func (q *Queries) DeleteLog(ctx context.Context, id int64) error
- func (q *Queries) DeleteMig(ctx context.Context, id types.MigID) error
- func (q *Queries) DeleteMigRepo(ctx context.Context, id types.MigRepoID) error
- func (q *Queries) DeleteNode(ctx context.Context, id types.NodeID) error
- func (q *Queries) DeleteRun(ctx context.Context, id types.RunID) error
- func (q *Queries) DeleteSBOMRowsByJob(ctx context.Context, jobID types.JobID) error
- func (q *Queries) DeleteSpecBundle(ctx context.Context, id string) error
- func (q *Queries) GetAPITokenByID(ctx context.Context, tokenID string) (GetAPITokenByIDRow, error)
- func (q *Queries) GetArtifactBundle(ctx context.Context, id pgtype.UUID) (ArtifactBundle, error)
- func (q *Queries) GetBootstrapToken(ctx context.Context, tokenID string) (GetBootstrapTokenRow, error)
- func (q *Queries) GetGitSpecSnapshot(ctx context.Context, arg GetGitSpecSnapshotParams) (Spec, error)
- func (q *Queries) GetGlobalEnv(ctx context.Context, arg GetGlobalEnvParams) (ConfigEnv, error)
- func (q *Queries) GetJob(ctx context.Context, id types.JobID) (Job, error)
- func (q *Queries) GetLatestDiffByJob(ctx context.Context, jobID *types.JobID) (Diff, error)
- func (q *Queries) GetLatestRunByMigAndRepoStatus(ctx context.Context, arg GetLatestRunByMigAndRepoStatusParams) (GetLatestRunByMigAndRepoStatusRow, error)
- func (q *Queries) GetMig(ctx context.Context, id types.MigID) (Mig, error)
- func (q *Queries) GetMigByName(ctx context.Context, name string) (Mig, error)
- func (q *Queries) GetMigRepo(ctx context.Context, id types.MigRepoID) (MigRepo, error)
- func (q *Queries) GetMigRepoByURL(ctx context.Context, arg GetMigRepoByURLParams) (MigRepo, error)
- func (q *Queries) GetNode(ctx context.Context, id types.NodeID) (Node, error)
- func (q *Queries) GetRepo(ctx context.Context, id types.RepoID) (Repo, error)
- func (q *Queries) GetRun(ctx context.Context, id types.RunID) (Run, error)
- func (q *Queries) GetRunForUpdate(ctx context.Context, id types.RunID) (Run, error)
- func (q *Queries) GetRunSnapshotMetadata(ctx context.Context, id types.RunID) (GetRunSnapshotMetadataRow, error)
- func (q *Queries) GetSpec(ctx context.Context, id types.SpecID) (Spec, error)
- func (q *Queries) GetSpecBundle(ctx context.Context, id string) (SpecBundle, error)
- func (q *Queries) GetSpecBundleByCID(ctx context.Context, cid string) (SpecBundle, error)
- func (q *Queries) GetWave(ctx context.Context, id types.WaveID) (Wave, error)
- func (q *Queries) HasMigRepoHistory(ctx context.Context, repoID types.RepoID) (bool, error)
- func (q *Queries) HasRunningJobForRunNode(ctx context.Context, arg HasRunningJobForRunNodeParams) (bool, error)
- func (q *Queries) InsertAPIToken(ctx context.Context, arg InsertAPITokenParams) error
- func (q *Queries) InsertBootstrapToken(ctx context.Context, arg InsertBootstrapTokenParams) error
- func (q *Queries) ListAPITokens(ctx context.Context) ([]ListAPITokensRow, error)
- func (q *Queries) ListArtifactBundlePartitions(ctx context.Context) ([]string, error)
- func (q *Queries) ListArtifactBundlesByCID(ctx context.Context, cid *string) ([]ArtifactBundle, error)
- func (q *Queries) ListArtifactBundlesByRunAndJob(ctx context.Context, arg ListArtifactBundlesByRunAndJobParams) ([]ArtifactBundle, error)
- func (q *Queries) ListConfigBundleMap(ctx context.Context) ([]ConfigBundleMap, error)
- func (q *Queries) ListConfigIn(ctx context.Context) ([]ConfigIn, error)
- func (q *Queries) ListDiffsByRun(ctx context.Context, runID types.RunID) ([]Diff, error)
- func (q *Queries) ListDistinctRepos(ctx context.Context, filter string) ([]ListDistinctReposRow, error)
- func (q *Queries) ListEventPartitions(ctx context.Context) ([]string, error)
- func (q *Queries) ListEventsByRun(ctx context.Context, runID types.RunID) ([]Event, error)
- func (q *Queries) ListEventsByRunSince(ctx context.Context, arg ListEventsByRunSinceParams) ([]Event, error)
- func (q *Queries) ListFailedRepoIDsByMig(ctx context.Context, migID types.MigID) ([]types.RepoID, error)
- func (q *Queries) ListGlobalEnv(ctx context.Context) ([]ConfigEnv, error)
- func (q *Queries) ListJobsByRun(ctx context.Context, runID types.RunID) ([]Job, error)
- func (q *Queries) ListJobsByRunAttempt(ctx context.Context, arg ListJobsByRunAttemptParams) ([]Job, error)
- func (q *Queries) ListJobsPage(ctx context.Context, arg ListJobsPageParams) ([]ListJobsPageRow, error)
- func (q *Queries) ListLogPartitions(ctx context.Context) ([]string, error)
- func (q *Queries) ListLogsByRun(ctx context.Context, runID types.RunID) ([]Log, error)
- func (q *Queries) ListLogsByRunSince(ctx context.Context, arg ListLogsByRunSinceParams) ([]Log, error)
- func (q *Queries) ListMigReposByMig(ctx context.Context, migID types.MigID) ([]MigRepo, error)
- func (q *Queries) ListMigs(ctx context.Context, arg ListMigsParams) ([]Mig, error)
- func (q *Queries) ListNodeDaemonLogs(ctx context.Context, arg ListNodeDaemonLogsParams) ([]NodeDaemonLog, error)
- func (q *Queries) ListNodeDiagnostics(ctx context.Context, nodeID types.NodeID) ([]NodeDiagnostic, error)
- func (q *Queries) ListNodeMetricsPartitions(ctx context.Context) ([]string, error)
- func (q *Queries) ListNodes(ctx context.Context) ([]Node, error)
- func (q *Queries) ListRunSBOMRowsByJobType(ctx context.Context, arg ListRunSBOMRowsByJobTypeParams) ([]ListRunSBOMRowsByJobTypeRow, error)
- func (q *Queries) ListRuns(ctx context.Context, arg ListRunsParams) ([]Run, error)
- func (q *Queries) ListRunsByWave(ctx context.Context, waveID types.WaveID) ([]Run, error)
- func (q *Queries) ListRunsForRepo(ctx context.Context, arg ListRunsForRepoParams) ([]ListRunsForRepoRow, error)
- func (q *Queries) ListRunsWithMetadata(ctx context.Context, arg ListRunsWithMetadataParams) ([]ListRunsWithMetadataRow, error)
- func (q *Queries) ListRunsWithURLByWave(ctx context.Context, waveID types.WaveID) ([]ListRunsWithURLByWaveRow, error)
- func (q *Queries) ListSpecBundles(ctx context.Context, arg ListSpecBundlesParams) ([]SpecBundle, error)
- func (q *Queries) ListSpecBundlesUnreferencedBefore(ctx context.Context, lastRefAt pgtype.Timestamptz) ([]SpecBundle, error)
- func (q *Queries) ListSpecs(ctx context.Context, arg ListSpecsParams) ([]Spec, error)
- func (q *Queries) ListStaleRunningJobs(ctx context.Context, lastHeartbeat pgtype.Timestamptz) ([]ListStaleRunningJobsRow, error)
- func (q *Queries) PromoteJobByIDIfUnblocked(ctx context.Context, id types.JobID) (Job, error)
- func (q *Queries) RevokeAPIToken(ctx context.Context, tokenID string) error
- func (q *Queries) TrimNodeDaemonLogs(ctx context.Context, arg TrimNodeDaemonLogsParams) error
- func (q *Queries) UnarchiveMig(ctx context.Context, id types.MigID) error
- func (q *Queries) UnclaimJob(ctx context.Context, arg UnclaimJobParams) error
- func (q *Queries) UpdateAPITokenLastUsed(ctx context.Context, tokenID string) error
- func (q *Queries) UpdateJobCompletion(ctx context.Context, arg UpdateJobCompletionParams) error
- func (q *Queries) UpdateJobCompletionWithMeta(ctx context.Context, arg UpdateJobCompletionWithMetaParams) error
- func (q *Queries) UpdateJobImageName(ctx context.Context, arg UpdateJobImageNameParams) error
- func (q *Queries) UpdateJobMeta(ctx context.Context, arg UpdateJobMetaParams) error
- func (q *Queries) UpdateJobReport(ctx context.Context, arg UpdateJobReportParams) (int64, error)
- func (q *Queries) UpdateJobStatus(ctx context.Context, arg UpdateJobStatusParams) error
- func (q *Queries) UpdateMigSpec(ctx context.Context, arg UpdateMigSpecParams) error
- func (q *Queries) UpdateNodeCertMetadata(ctx context.Context, arg UpdateNodeCertMetadataParams) error
- func (q *Queries) UpdateNodeDrained(ctx context.Context, arg UpdateNodeDrainedParams) error
- func (q *Queries) UpdateNodeHeartbeat(ctx context.Context, arg UpdateNodeHeartbeatParams) error
- func (q *Queries) UpdateRunError(ctx context.Context, arg UpdateRunErrorParams) error
- func (q *Queries) UpdateRunStatus(ctx context.Context, arg UpdateRunStatusParams) error
- func (q *Queries) UpdateSpecBundleLastRefAt(ctx context.Context, id string) error
- func (q *Queries) UpdateWaveCompletion(ctx context.Context, arg UpdateWaveCompletionParams) error
- func (q *Queries) UpdateWaveStatus(ctx context.Context, arg UpdateWaveStatusParams) error
- func (q *Queries) UpsertGlobalEnv(ctx context.Context, arg UpsertGlobalEnvParams) error
- func (q *Queries) UpsertJobMetric(ctx context.Context, arg UpsertJobMetricParams) error
- func (q *Queries) UpsertMigRepo(ctx context.Context, arg UpsertMigRepoParams) (MigRepo, error)
- func (q *Queries) UpsertNodeDiagnostic(ctx context.Context, arg UpsertNodeDiagnosticParams) (NodeDiagnostic, error)
- func (q *Queries) UpsertSBOMRow(ctx context.Context, arg UpsertSBOMRowParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Repo
- type RestartRunParams
- type Run
- type RunMaterialization
- type RunPlan
- type RunsTiming
- type Sbom
- type Spec
- type SpecBundle
- type Store
- type TrimNodeDaemonLogsParams
- type UnclaimJobParams
- type UpdateJobCompletionParams
- type UpdateJobCompletionWithMetaParams
- type UpdateJobImageNameParams
- type UpdateJobMetaParams
- type UpdateJobReportParams
- type UpdateJobStatusParams
- type UpdateMigSpecParams
- type UpdateNodeCertMetadataParams
- type UpdateNodeDrainedParams
- type UpdateNodeHeartbeatParams
- type UpdateRunErrorParams
- type UpdateRunStatusParams
- type UpdateWaveCompletionParams
- type UpdateWaveStatusParams
- type UpsertGlobalEnvParams
- type UpsertJobMetricParams
- type UpsertMigRepoParams
- type UpsertNodeDiagnosticParams
- type UpsertSBOMRowParams
- type Wave
Constants ¶
const ( // TargetSchemaVersion is the highest embedded Tern migration version. TargetSchemaVersion int32 = 10 )
Variables ¶
var ErrBootstrapNodeExists = errors.New("store: bootstrap node already exists")
ErrBootstrapNodeExists is returned when bootstrap completion targets an already-enrolled node ID.
var ErrBootstrapTokenInvalid = errors.New("store: bootstrap token invalid")
ErrBootstrapTokenInvalid is returned when a bootstrap token is missing, revoked, already consumed, or bound to a different node.
var ErrEmptyNodeID = errors.New("store: ClaimJob requires non-empty nodeID")
ErrEmptyNodeID is returned when ClaimJob is called with an empty NodeID.
var ErrInvalidJSON = errors.New("store: invalid JSON for JSONB column")
ErrInvalidJSON is returned when a JSONB column receives invalid JSON bytes.
var ErrJobExecutionStale = errors.New("store: request belongs to an earlier execution")
var ErrRunRestartActive = errors.New("store: only terminal runs can be restarted")
ErrRunRestartActive is returned when a non-terminal run is restarted.
var ErrRunRestartWaveCancelled = errors.New("store: cannot restart a run in a cancelled wave")
ErrRunRestartWaveCancelled is returned when the owning wave was cancelled.
var ErrRunResumeInvalid = errors.New("store: run has no resumable failed job chain")
var ErrUnsupportedSchema = errors.New("store: unsupported database schema for Tern adoption")
ErrUnsupportedSchema is returned when an existing database cannot be safely baselined into the Tern migration chain.
Functions ¶
func CurrentSchemaVersion ¶
CurrentSchemaVersion returns the applied Tern schema version.
Types ¶
type ActiveRepoRunError ¶
ActiveRepoRunError identifies the run that prevents another launch or restart.
func (*ActiveRepoRunError) Error ¶
func (e *ActiveRepoRunError) Error() string
type ApiToken ¶
type ApiToken struct {
ID pgtype.UUID `json:"id"`
TokenHash string `json:"token_hash"`
TokenID string `json:"token_id"`
Role string `json:"role"`
Username *string `json:"username"`
Description *string `json:"description"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
LastUsedAt pgtype.Timestamptz `json:"last_used_at"`
RevokedAt pgtype.Timestamptz `json:"revoked_at"`
CreatedBy *string `json:"created_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type ArtifactBundle ¶
type ArtifactBundle struct {
ID pgtype.UUID `json:"id"`
RunID types.RunID `json:"run_id"`
JobID *types.JobID `json:"job_id"`
Name *string `json:"name"`
BundleSize int64 `json:"bundle_size"`
ObjectKey *string `json:"object_key"`
Cid *string `json:"cid"`
Digest *string `json:"digest"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type BootstrapToken ¶
type BootstrapToken struct {
ID pgtype.UUID `json:"id"`
TokenHash string `json:"token_hash"`
TokenID string `json:"token_id"`
NodeID *types.NodeID `json:"node_id"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
UsedAt pgtype.Timestamptz `json:"used_at"`
CertIssuedAt pgtype.Timestamptz `json:"cert_issued_at"`
RevokedAt pgtype.Timestamptz `json:"revoked_at"`
IssuedBy *string `json:"issued_by"`
}
type CompleteBootstrapEnrollmentParams ¶
type CompleteBootstrapEnrollmentParams struct {
TokenID string
NodeID types.NodeID
CertSerial string
CertFingerprint string
CertNotBefore time.Time
CertNotAfter time.Time
}
CompleteBootstrapEnrollmentParams contains the certificate metadata recorded when a one-time bootstrap token successfully enrolls a new node.
type ConfigBundleMap ¶
type ConfigBundleMap struct {
Hash string `json:"hash"`
BundleID string `json:"bundle_id"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type ConfigIn ¶
type ConfigIn struct {
Entry string `json:"entry"`
Dst string `json:"dst"`
Section string `json:"section"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type CountJobsPageParams ¶
type CreateDiffParams ¶
type CreateEventParams ¶
type CreateGitSpecSnapshotParams ¶
type CreateGitSpecSnapshotParams struct {
ID types.SpecID `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Source []byte `json:"source"`
Sha string `json:"sha"`
SourceCommittedAt pgtype.Timestamptz `json:"source_committed_at"`
Spec []byte `json:"spec"`
CreatedBy *string `json:"created_by"`
}
type CreateJobParams ¶
type CreateJobParams struct {
ID types.JobID `json:"id"`
RunID types.RunID `json:"run_id"`
RepoID types.RepoID `json:"repo_id"`
RepoBaseRef string `json:"repo_base_ref"`
Attempt int32 `json:"attempt"`
Status types.JobStatus `json:"status"`
JobType types.JobType `json:"job_type"`
JobImage string `json:"job_image"`
NextID *types.JobID `json:"next_id"`
Name string `json:"name"`
Meta []byte `json:"meta"`
RepoShaIn string `json:"repo_sha_in"`
}
type CreateLogParams ¶
type CreateMigParams ¶
type CreateMigRepoParams ¶
type CreateNodeParams ¶
type CreateSpecBundleParams ¶
type CreateSpecParams ¶
type CreateWaveParams ¶
type CreateWaveWithRunsParams ¶
type CreateWaveWithRunsParams struct {
Wave CreateWaveParams
Runs []RunPlan
}
CreateWaveWithRunsParams contains the complete durable materialization for one launch.
type DeleteGlobalEnvParams ¶
type GetAPITokenByIDRow ¶
type GetAPITokenByIDRow struct {
TokenID string `json:"token_id"`
Role string `json:"role"`
Username *string `json:"username"`
Description *string `json:"description"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
LastUsedAt pgtype.Timestamptz `json:"last_used_at"`
RevokedAt pgtype.Timestamptz `json:"revoked_at"`
CreatedBy *string `json:"created_by"`
}
type GetBootstrapTokenRow ¶
type GetBootstrapTokenRow struct {
NodeID *types.NodeID `json:"node_id"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
UsedAt pgtype.Timestamptz `json:"used_at"`
CertIssuedAt pgtype.Timestamptz `json:"cert_issued_at"`
RevokedAt pgtype.Timestamptz `json:"revoked_at"`
}
type GetGlobalEnvParams ¶
type GetMigRepoByURLParams ¶
type InsertAPITokenParams ¶
type InsertAPITokenParams struct {
TokenHash string `json:"token_hash"`
TokenID string `json:"token_id"`
Role string `json:"role"`
Username *string `json:"username"`
Description *string `json:"description"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
CreatedBy *string `json:"created_by"`
}
type InsertBootstrapTokenParams ¶
type InsertBootstrapTokenParams struct {
TokenHash string `json:"token_hash"`
TokenID string `json:"token_id"`
NodeID *types.NodeID `json:"node_id"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
IssuedBy *string `json:"issued_by"`
}
type Job ¶
type Job struct {
ID types.JobID `json:"id"`
RunID types.RunID `json:"run_id"`
RepoID types.RepoID `json:"repo_id"`
RepoBaseRef string `json:"repo_base_ref"`
Attempt int32 `json:"attempt"`
Status types.JobStatus `json:"status"`
JobType types.JobType `json:"job_type"`
JobImage string `json:"job_image"`
NextID *types.JobID `json:"next_id"`
Name string `json:"name"`
NodeID *types.NodeID `json:"node_id"`
ExitCode *int32 `json:"exit_code"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
DurationMs int64 `json:"duration_ms"`
RepoShaIn string `json:"repo_sha_in"`
RepoShaOut string `json:"repo_sha_out"`
RepoShaIn8 string `json:"repo_sha_in8"`
RepoShaOut8 string `json:"repo_sha_out8"`
Meta []byte `json:"meta"`
}
type JobMetric ¶
type JobMetric struct {
ID int64 `json:"id"`
NodeID types.NodeID `json:"node_id"`
JobID types.JobID `json:"job_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
CpuConsumedNs int64 `json:"cpu_consumed_ns"`
DiskConsumedBytes int64 `json:"disk_consumed_bytes"`
MemConsumedBytes int64 `json:"mem_consumed_bytes"`
}
type JobPlan ¶
JobPlan contains intrinsic job data. Its position in a Jobs slice defines the initial status and next-job link when the store materializes the chain.
type ListAPITokensRow ¶
type ListAPITokensRow struct {
TokenID string `json:"token_id"`
Role string `json:"role"`
Username *string `json:"username"`
Description *string `json:"description"`
IssuedAt pgtype.Timestamptz `json:"issued_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
LastUsedAt pgtype.Timestamptz `json:"last_used_at"`
RevokedAt pgtype.Timestamptz `json:"revoked_at"`
CreatedBy *string `json:"created_by"`
}
type ListDistinctReposRow ¶
type ListDistinctReposRow struct {
RepoID types.RepoID `json:"repo_id"`
RepoUrl string `json:"repo_url"`
LastRunAt pgtype.Timestamptz `json:"last_run_at"`
LastStatus interface{} `json:"last_status"`
}
type ListJobsPageParams ¶
type ListJobsPageRow ¶
type ListJobsPageRow struct {
JobID types.JobID `json:"job_id"`
Name string `json:"name"`
JobType types.JobType `json:"job_type"`
Status types.JobStatus `json:"status"`
DurationMs int64 `json:"duration_ms"`
JobImage string `json:"job_image"`
NodeID *types.NodeID `json:"node_id"`
MigName string `json:"mig_name"`
RunID types.RunID `json:"run_id"`
RepoID types.RepoID `json:"repo_id"`
}
type ListMigsParams ¶
type ListRunsForRepoParams ¶
type ListRunsForRepoRow ¶
type ListRunsForRepoRow struct {
RunID types.RunID `json:"run_id"`
WaveID types.WaveID `json:"wave_id"`
MigID types.MigID `json:"mig_id"`
Status types.RunStatus `json:"status"`
RepoBaseRef string `json:"repo_base_ref"`
Attempt int32 `json:"attempt"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
}
type ListRunsParams ¶
type ListRunsWithMetadataRow ¶
type ListRunsWithMetadataRow struct {
ID types.RunID `json:"id"`
WaveID types.WaveID `json:"wave_id"`
MigID types.MigID `json:"mig_id"`
SpecID types.SpecID `json:"spec_id"`
RepoID types.RepoID `json:"repo_id"`
RepoBaseRef string `json:"repo_base_ref"`
SourceCommitSha string `json:"source_commit_sha"`
RepoSha0 string `json:"repo_sha0"`
CreatedBy *string `json:"created_by"`
Status types.RunStatus `json:"status"`
Attempt int32 `json:"attempt"`
LastError *string `json:"last_error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
Stats []byte `json:"stats"`
RepoUrl string `json:"repo_url"`
SpecName string `json:"spec_name"`
SpecSourceDomain string `json:"spec_source_domain"`
SpecSourceRepo string `json:"spec_source_repo"`
}
type ListRunsWithURLByWaveRow ¶
type ListRunsWithURLByWaveRow struct {
ID types.RunID `json:"id"`
WaveID types.WaveID `json:"wave_id"`
MigID types.MigID `json:"mig_id"`
SpecID types.SpecID `json:"spec_id"`
RepoID types.RepoID `json:"repo_id"`
RepoBaseRef string `json:"repo_base_ref"`
SourceCommitSha string `json:"source_commit_sha"`
RepoSha0 string `json:"repo_sha0"`
CreatedBy *string `json:"created_by"`
Status types.RunStatus `json:"status"`
Attempt int32 `json:"attempt"`
LastError *string `json:"last_error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
Stats []byte `json:"stats"`
RepoUrl string `json:"repo_url"`
}
type ListSpecBundlesParams ¶
type ListSpecsParams ¶
type ListStaleRunningJobsRow ¶
type Mig ¶
type Mig struct {
ID types.MigID `json:"id"`
Name string `json:"name"`
SpecID *types.SpecID `json:"spec_id"`
CreatedBy *string `json:"created_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
ArchivedAt pgtype.Timestamptz `json:"archived_at"`
}
type Node ¶
type Node struct {
ID types.NodeID `json:"id"`
Name string `json:"name"`
IpAddress netip.Addr `json:"ip_address"`
Version *string `json:"version"`
Concurrency int32 `json:"concurrency"`
CpuTotalMillis int32 `json:"cpu_total_millis"`
CpuFreeMillis int32 `json:"cpu_free_millis"`
MemTotalBytes int64 `json:"mem_total_bytes"`
MemFreeBytes int64 `json:"mem_free_bytes"`
DiskTotalBytes int64 `json:"disk_total_bytes"`
DiskFreeBytes int64 `json:"disk_free_bytes"`
Drained bool `json:"drained"`
CertSerial *string `json:"cert_serial"`
CertFingerprint *string `json:"cert_fingerprint"`
CertNotBefore pgtype.Timestamptz `json:"cert_not_before"`
CertNotAfter pgtype.Timestamptz `json:"cert_not_after"`
LastHeartbeat pgtype.Timestamptz `json:"last_heartbeat"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type NodeDaemonLog ¶
type NodeDiagnostic ¶
type NodeDiagnostic struct {
NodeID types.NodeID `json:"node_id"`
Component string `json:"component"`
Status string `json:"status"`
LastError *string `json:"last_error"`
Version *string `json:"version"`
ImageRef *string `json:"image_ref"`
LocalImageID *string `json:"local_image_id"`
RemoteImageID *string `json:"remote_image_id"`
Details []byte `json:"details"`
LastCheckedAt pgtype.Timestamptz `json:"last_checked_at"`
LastSuccessAt pgtype.Timestamptz `json:"last_success_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type NodeMetric ¶
type NodeMetric struct {
ID int64 `json:"id"`
NodeID types.NodeID `json:"node_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
CpuTotalMillis int32 `json:"cpu_total_millis"`
CpuFreeMillis int32 `json:"cpu_free_millis"`
MemTotalBytes int64 `json:"mem_total_bytes"`
MemFreeBytes int64 `json:"mem_free_bytes"`
DiskTotalBytes int64 `json:"disk_total_bytes"`
DiskFreeBytes int64 `json:"disk_free_bytes"`
}
type PgStore ¶
type PgStore struct {
*Queries
// contains filtered or unexported fields
}
PgStore wraps a pgxpool connection pool and implements Store.
func (*PgStore) CancelWave ¶
CancelWave atomically cancels one wave and all active child runs/jobs.
func (*PgStore) ClaimJob ¶
ClaimJob atomically claims the next claimable job for a node. Requires a non-empty nodeID; returns ErrEmptyNodeID if the nodeID is empty. This prevents jobs from entering Running state with node_id=NULL.
func (*PgStore) CompleteBootstrapEnrollment ¶
func (s *PgStore) CompleteBootstrapEnrollment(ctx context.Context, arg CompleteBootstrapEnrollmentParams) error
CompleteBootstrapEnrollment atomically consumes one bootstrap token and creates the node it was minted for.
func (*PgStore) CreateDiff ¶
CreateDiff validates the Summary JSONB field and creates a new diff.
func (*PgStore) CreateGitSpecSnapshot ¶
func (s *PgStore) CreateGitSpecSnapshot(ctx context.Context, arg CreateGitSpecSnapshotParams) (Spec, error)
CreateGitSpecSnapshot validates JSONB fields and creates an immutable snapshot.
func (*PgStore) CreateSpec ¶
CreateSpec validates the Spec JSONB field and creates a new spec.
func (*PgStore) CreateWaveWithRuns ¶
func (s *PgStore) CreateWaveWithRuns(ctx context.Context, arg CreateWaveWithRunsParams) (Wave, []RunMaterialization, error)
CreateWaveWithRuns atomically creates a wave and every selected run job chain.
func (*PgStore) Pool ¶
Pool returns the underlying connection pool. This is useful for operations that need direct pool access, such as partition management.
func (*PgStore) RestartRun ¶
RestartRun atomically starts a full attempt or retries the failed suffix in place.
func (*PgStore) UnclaimJob ¶
func (s *PgStore) UnclaimJob(ctx context.Context, arg UnclaimJobParams) error
UnclaimJob reverts a claimed Running job back to claimable Queued state. The update is guarded by both job ID and node ID to avoid stealing claims.
func (*PgStore) UpdateJobCompletionWithMeta ¶
func (s *PgStore) UpdateJobCompletionWithMeta(ctx context.Context, arg UpdateJobCompletionWithMetaParams) error
UpdateJobCompletionWithMeta validates the Meta JSONB field and completes a job with metadata.
func (*PgStore) UpdateJobMeta ¶
func (s *PgStore) UpdateJobMeta(ctx context.Context, arg UpdateJobMetaParams) error
UpdateJobMeta validates the Meta JSONB field and updates job metadata.
func (*PgStore) UpdateWaveCompletion ¶
func (s *PgStore) UpdateWaveCompletion(ctx context.Context, arg UpdateWaveCompletionParams) error
UpdateWaveCompletion validates the Stats JSONB field and completes a wave.
func (*PgStore) UpsertNodeDiagnostic ¶
func (s *PgStore) UpsertNodeDiagnostic(ctx context.Context, arg UpsertNodeDiagnosticParams) (NodeDiagnostic, error)
UpsertNodeDiagnostic validates the Details JSONB field and stores daemon state.
func (*PgStore) WithJobExecution ¶
func (s *PgStore) WithJobExecution(ctx context.Context, jobID types.JobID, resumeCount int, complete func(Store, Job) error) error
WithJobExecution fences completion against restart for the entire database transition, including successor promotion and run reconciliation. A delayed request must not complete a reused job ID after a retained-workspace retry.
type Querier ¶
type Querier interface {
// Archives a mig by setting archived_at to now().
// Archiving must be refused when the mig has any jobs in a running state.
// This query only sets the timestamp; validation logic must be in the caller.
ArchiveMig(ctx context.Context, id types.MigID) error
// Bulk-cancels active jobs for a run (Created/Queued/Running -> Cancelled).
// finished_at is set once; duration_ms is computed from started_at when present.
CancelActiveJobsByRun(ctx context.Context, runID types.RunID) (int64, error)
// Bulk-cancels active jobs for a specific run attempt.
// Targets Created/Queued/Running and preserves terminal jobs.
// finished_at is set once; duration_ms is computed from started_at when present.
CancelActiveJobsByRunAttempt(ctx context.Context, arg CancelActiveJobsByRunAttemptParams) (int64, error)
CancelActiveRunsByWave(ctx context.Context, waveID types.WaveID) (int64, error)
CheckAPITokenRevoked(ctx context.Context, tokenID string) (pgtype.Timestamptz, error)
CheckBootstrapTokenRevoked(ctx context.Context, tokenID string) (pgtype.Timestamptz, error)
// Atomically claim the next claimable job for a node.
ClaimJob(ctx context.Context, nodeID types.NodeID) (Job, error)
// Counts jobs matching the same optional filters as ListJobsPage.
CountJobsPage(ctx context.Context, arg CountJobsPageParams) (int64, error)
CountRunsByWaveStatus(ctx context.Context, waveID types.WaveID) ([]CountRunsByWaveStatusRow, error)
// Counts distinct stale nodes that currently have at least one running job.
// Excludes NULL node_id rows (orphaned running jobs) from node count.
CountStaleNodesWithRunningJobs(ctx context.Context, lastHeartbeat pgtype.Timestamptz) (int64, error)
// Creates a new artifact bundle metadata. Blob data is stored in object storage.
// Bundles are grouped at the job level only (build_id removed).
CreateArtifactBundle(ctx context.Context, arg CreateArtifactBundleParams) (ArtifactBundle, error)
// Creates a new diff entry associated with a job. Blob data is stored in object storage.
CreateDiff(ctx context.Context, arg CreateDiffParams) (Diff, error)
CreateEvent(ctx context.Context, arg CreateEventParams) (Event, error)
CreateGitSpecSnapshot(ctx context.Context, arg CreateGitSpecSnapshotParams) (Spec, error)
// Note: `id` is a required TEXT parameter (KSUID-backed); caller generates via types.NewJobID().
CreateJob(ctx context.Context, arg CreateJobParams) (Job, error)
// Creates a new log chunk metadata. Blob data is stored in object storage.
// Logs are grouped at the job level only (build_id removed).
CreateLog(ctx context.Context, arg CreateLogParams) (Log, error)
CreateMig(ctx context.Context, arg CreateMigParams) (Mig, error)
CreateMigRepo(ctx context.Context, arg CreateMigRepoParams) (MigRepo, error)
// Creates a new node with an application-supplied URL-safe ID as the primary key.
CreateNode(ctx context.Context, arg CreateNodeParams) (Node, error)
CreateNodeDaemonLog(ctx context.Context, arg CreateNodeDaemonLogParams) (NodeDaemonLog, error)
CreateSpec(ctx context.Context, arg CreateSpecParams) (Spec, error)
// Creates a new spec bundle metadata row. Blob data is stored in object storage.
CreateSpecBundle(ctx context.Context, arg CreateSpecBundleParams) (SpecBundle, error)
CreateWave(ctx context.Context, arg CreateWaveParams) (Wave, error)
DeleteArtifactBundle(ctx context.Context, id pgtype.UUID) error
DeleteDiff(ctx context.Context, id pgtype.UUID) error
// DeleteExpiredArtifactBundles removes artifact bundle rows older than the specified timestamp.
DeleteExpiredArtifactBundles(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
// DeleteExpiredDiffs removes diff rows older than the specified timestamp.
DeleteExpiredDiffs(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
// DeleteExpiredEvents removes event rows older than the specified timestamp.
DeleteExpiredEvents(ctx context.Context, time pgtype.Timestamptz) (int64, error)
// DeleteExpiredLogs removes log rows older than the specified timestamp.
DeleteExpiredLogs(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
// Removes an environment entry by key and target.
// No-op if the (key, target) pair does not exist (exec returns no error).
DeleteGlobalEnv(ctx context.Context, arg DeleteGlobalEnvParams) error
DeleteJob(ctx context.Context, id types.JobID) error
DeleteLog(ctx context.Context, id int64) error
// Deletes a mig. Use with caution; should only be called when safe to remove.
DeleteMig(ctx context.Context, id types.MigID) error
// Deletes a mig_repo by id.
// Note: mig_repos.id remains referenced by API-level repo membership records.
DeleteMigRepo(ctx context.Context, id types.MigRepoID) error
DeleteNode(ctx context.Context, id types.NodeID) error
DeleteRun(ctx context.Context, id types.RunID) error
DeleteSBOMRowsByJob(ctx context.Context, jobID types.JobID) error
// Deletes a spec bundle metadata row by ID.
// Called by blobpersist as rollback when object storage upload fails.
DeleteSpecBundle(ctx context.Context, id string) error
GetAPITokenByID(ctx context.Context, tokenID string) (GetAPITokenByIDRow, error)
// Returns artifact bundle metadata including object_key for object-storage retrieval.
GetArtifactBundle(ctx context.Context, id pgtype.UUID) (ArtifactBundle, error)
GetBootstrapToken(ctx context.Context, tokenID string) (GetBootstrapTokenRow, error)
GetGitSpecSnapshot(ctx context.Context, arg GetGitSpecSnapshotParams) (Spec, error)
// Retrieves a single environment entry by key and target.
// Returns pgx.ErrNoRows if the (key, target) pair does not exist.
GetGlobalEnv(ctx context.Context, arg GetGlobalEnvParams) (ConfigEnv, error)
GetJob(ctx context.Context, id types.JobID) (Job, error)
GetLatestDiffByJob(ctx context.Context, jobID *types.JobID) (Diff, error)
GetLatestRunByMigAndRepoStatus(ctx context.Context, arg GetLatestRunByMigAndRepoStatusParams) (GetLatestRunByMigAndRepoStatusRow, error)
GetMig(ctx context.Context, id types.MigID) (Mig, error)
GetMigByName(ctx context.Context, name string) (Mig, error)
GetMigRepo(ctx context.Context, id types.MigRepoID) (MigRepo, error)
// Gets a mig_repo by mig_id and repo_url (for uniqueness constraint enforcement).
GetMigRepoByURL(ctx context.Context, arg GetMigRepoByURLParams) (MigRepo, error)
GetNode(ctx context.Context, id types.NodeID) (Node, error)
GetRepo(ctx context.Context, id types.RepoID) (Repo, error)
GetRun(ctx context.Context, id types.RunID) (Run, error)
GetRunForUpdate(ctx context.Context, id types.RunID) (Run, error)
GetRunSnapshotMetadata(ctx context.Context, id types.RunID) (GetRunSnapshotMetadataRow, error)
GetSpec(ctx context.Context, id types.SpecID) (Spec, error)
// Returns spec bundle metadata including object_key for object-storage retrieval.
GetSpecBundle(ctx context.Context, id string) (SpecBundle, error)
// Returns the most recently created spec bundle for a given cid.
// Used for deduplication: callers should check by CID before uploading.
GetSpecBundleByCID(ctx context.Context, cid string) (SpecBundle, error)
GetWave(ctx context.Context, id types.WaveID) (Wave, error)
// Checks if a mig_repo has any historical executions.
// Returns true if the repo cannot be deleted due to history, false otherwise.
HasMigRepoHistory(ctx context.Context, repoID types.RepoID) (bool, error)
HasRunningJobForRunNode(ctx context.Context, arg HasRunningJobForRunNodeParams) (bool, error)
InsertAPIToken(ctx context.Context, arg InsertAPITokenParams) error
InsertBootstrapToken(ctx context.Context, arg InsertBootstrapTokenParams) error
ListAPITokens(ctx context.Context) ([]ListAPITokensRow, error)
// ListArtifactBundlePartitions retrieves all partition names for the artifact_bundles table.
ListArtifactBundlePartitions(ctx context.Context) ([]string, error)
// Returns artifact bundle metadata including object_key for object-storage retrieval.
ListArtifactBundlesByCID(ctx context.Context, cid *string) ([]ArtifactBundle, error)
// Returns artifact bundle metadata including object_key for object-storage retrieval.
ListArtifactBundlesByRunAndJob(ctx context.Context, arg ListArtifactBundlesByRunAndJobParams) ([]ArtifactBundle, error)
// config_bundle_map.sql — read queries for global bundle map entries (config_bundle_map table).
// Provides ListConfigBundleMap.
// Returns all bundle map entries ordered by hash for deterministic iteration.
ListConfigBundleMap(ctx context.Context) ([]ConfigBundleMap, error)
// config_in.sql — read queries for global in mount entries (config_in table).
// Provides ListConfigIn.
// Returns all in entries ordered by section then dst for deterministic iteration.
ListConfigIn(ctx context.Context) ([]ConfigIn, error)
// Returns diff metadata for a run.
ListDiffsByRun(ctx context.Context, runID types.RunID) ([]Diff, error)
// Lists distinct repos for a mig with last known run metadata,
// optionally filtered by repo_url substring.
ListDistinctRepos(ctx context.Context, filter string) ([]ListDistinctReposRow, error)
// ListEventPartitions retrieves all partition names for the events table.
ListEventPartitions(ctx context.Context) ([]string, error)
ListEventsByRun(ctx context.Context, runID types.RunID) ([]Event, error)
ListEventsByRunSince(ctx context.Context, arg ListEventsByRunSinceParams) ([]Event, error)
ListFailedRepoIDsByMig(ctx context.Context, migID types.MigID) ([]types.RepoID, error)
// config_env.sql — CRUD queries for global environment variables (config_env table).
// Provides ListGlobalEnv, GetGlobalEnv, UpsertGlobalEnv, DeleteGlobalEnv.
// Returns all global environment entries, ordered by key then target for consistent iteration.
// Used by ConfigHolder initialization and HTTP list endpoint.
ListGlobalEnv(ctx context.Context) ([]ConfigEnv, error)
ListJobsByRun(ctx context.Context, runID types.RunID) ([]Job, error)
ListJobsByRunAttempt(ctx context.Context, arg ListJobsByRunAttemptParams) ([]Job, error)
// Lists jobs with optional run, node, and status filters, ordered newest-to-oldest by job id.
// Joins runs and migs to surface mig_name for CLI and TUI consumers.
ListJobsPage(ctx context.Context, arg ListJobsPageParams) ([]ListJobsPageRow, error)
// ListLogPartitions retrieves all partition names for the logs table.
ListLogPartitions(ctx context.Context) ([]string, error)
// Returns log metadata including object_key for object-storage retrieval.
ListLogsByRun(ctx context.Context, runID types.RunID) ([]Log, error)
// Returns log metadata including object_key for object-storage retrieval.
ListLogsByRunSince(ctx context.Context, arg ListLogsByRunSinceParams) ([]Log, error)
ListMigReposByMig(ctx context.Context, migID types.MigID) ([]MigRepo, error)
// Lists migs with optional filtering by archived status and name substring.
// archived_only: if true, return only archived migs; if false, return only active migs; if null, return all.
// name_filter: if non-empty, filter by name substring (case-insensitive); if null/empty, no name filtering.
ListMigs(ctx context.Context, arg ListMigsParams) ([]Mig, error)
ListNodeDaemonLogs(ctx context.Context, arg ListNodeDaemonLogsParams) ([]NodeDaemonLog, error)
ListNodeDiagnostics(ctx context.Context, nodeID types.NodeID) ([]NodeDiagnostic, error)
// ListNodeMetricsPartitions retrieves all partition names for the node_metrics table.
ListNodeMetricsPartitions(ctx context.Context) ([]string, error)
ListNodes(ctx context.Context) ([]Node, error)
ListRunSBOMRowsByJobType(ctx context.Context, arg ListRunSBOMRowsByJobTypeParams) ([]ListRunSBOMRowsByJobTypeRow, error)
ListRuns(ctx context.Context, arg ListRunsParams) ([]Run, error)
ListRunsByWave(ctx context.Context, waveID types.WaveID) ([]Run, error)
ListRunsForRepo(ctx context.Context, arg ListRunsForRepoParams) ([]ListRunsForRepoRow, error)
ListRunsWithMetadata(ctx context.Context, arg ListRunsWithMetadataParams) ([]ListRunsWithMetadataRow, error)
ListRunsWithURLByWave(ctx context.Context, waveID types.WaveID) ([]ListRunsWithURLByWaveRow, error)
// Lists spec bundles ordered by created_at descending (most recent first).
ListSpecBundles(ctx context.Context, arg ListSpecBundlesParams) ([]SpecBundle, error)
// Lists spec bundles whose last_ref_at is before the given threshold.
// Used by GC to find bundles eligible for deletion.
ListSpecBundlesUnreferencedBefore(ctx context.Context, lastRefAt pgtype.Timestamptz) ([]SpecBundle, error)
// Lists specs ordered by created_at descending (most recent first).
// There is an index on created_at to optimize this query.
ListSpecs(ctx context.Context, arg ListSpecsParams) ([]Spec, error)
// Lists running jobs whose assigned node is stale at the provided cutoff.
// Rows are grouped by (run_id, attempt) for deterministic recovery processing.
ListStaleRunningJobs(ctx context.Context, lastHeartbeat pgtype.Timestamptz) ([]ListStaleRunningJobsRow, error)
// Atomically promote a specific linked successor job: Created -> Queued.
// The candidate is eligible only when every predecessor that points to it is Success.
PromoteJobByIDIfUnblocked(ctx context.Context, id types.JobID) (Job, error)
RevokeAPIToken(ctx context.Context, tokenID string) error
TrimNodeDaemonLogs(ctx context.Context, arg TrimNodeDaemonLogsParams) error
// Unarchives a mig by clearing archived_at.
UnarchiveMig(ctx context.Context, id types.MigID) error
// Revert a claimed Running job back to claimable Queued state.
// Guarded by both job id and node id so a foreign node cannot steal the slot.
UnclaimJob(ctx context.Context, arg UnclaimJobParams) error
UpdateAPITokenLastUsed(ctx context.Context, tokenID string) error
UpdateJobCompletion(ctx context.Context, arg UpdateJobCompletionParams) error
UpdateJobCompletionWithMeta(ctx context.Context, arg UpdateJobCompletionWithMetaParams) error
// Persist the container image name used to execute a job.
// This is set by the node immediately before job execution starts.
UpdateJobImageName(ctx context.Context, arg UpdateJobImageNameParams) error
UpdateJobMeta(ctx context.Context, arg UpdateJobMetaParams) error
UpdateJobReport(ctx context.Context, arg UpdateJobReportParams) (int64, error)
UpdateJobStatus(ctx context.Context, arg UpdateJobStatusParams) error
UpdateMigSpec(ctx context.Context, arg UpdateMigSpecParams) error
UpdateNodeCertMetadata(ctx context.Context, arg UpdateNodeCertMetadataParams) error
UpdateNodeDrained(ctx context.Context, arg UpdateNodeDrainedParams) error
UpdateNodeHeartbeat(ctx context.Context, arg UpdateNodeHeartbeatParams) error
UpdateRunError(ctx context.Context, arg UpdateRunErrorParams) error
UpdateRunStatus(ctx context.Context, arg UpdateRunStatusParams) error
// Updates last_ref_at to now() for the given spec bundle.
// Call this whenever a spec or run references the bundle to keep GC metadata fresh.
UpdateSpecBundleLastRefAt(ctx context.Context, id string) error
UpdateWaveCompletion(ctx context.Context, arg UpdateWaveCompletionParams) error
UpdateWaveStatus(ctx context.Context, arg UpdateWaveStatusParams) error
// Inserts or updates an environment entry (upsert on composite key (key, target)).
// Updates value, secret, and refreshes updated_at on conflict.
// This ensures idempotent set operations from the CLI or API.
UpsertGlobalEnv(ctx context.Context, arg UpsertGlobalEnvParams) error
UpsertJobMetric(ctx context.Context, arg UpsertJobMetricParams) error
// Bulk upsert a mig_repo by normalized repo_url.
// Uniqueness is on (mig_id, repo_id) to prevent duplicate repo membership per mig.
UpsertMigRepo(ctx context.Context, arg UpsertMigRepoParams) (MigRepo, error)
UpsertNodeDiagnostic(ctx context.Context, arg UpsertNodeDiagnosticParams) (NodeDiagnostic, error)
UpsertSBOMRow(ctx context.Context, arg UpsertSBOMRowParams) error
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) ArchiveMig ¶
Archives a mig by setting archived_at to now(). Archiving must be refused when the mig has any jobs in a running state. This query only sets the timestamp; validation logic must be in the caller.
func (*Queries) CancelActiveJobsByRun ¶
Bulk-cancels active jobs for a run (Created/Queued/Running -> Cancelled). finished_at is set once; duration_ms is computed from started_at when present.
func (*Queries) CancelActiveJobsByRunAttempt ¶
func (q *Queries) CancelActiveJobsByRunAttempt(ctx context.Context, arg CancelActiveJobsByRunAttemptParams) (int64, error)
Bulk-cancels active jobs for a specific run attempt. Targets Created/Queued/Running and preserves terminal jobs. finished_at is set once; duration_ms is computed from started_at when present.
func (*Queries) CancelActiveRunsByWave ¶
func (*Queries) CheckAPITokenRevoked ¶
func (*Queries) CheckBootstrapTokenRevoked ¶
func (*Queries) CountJobsPage ¶
Counts jobs matching the same optional filters as ListJobsPage.
func (*Queries) CountRunsByWaveStatus ¶
func (*Queries) CountStaleNodesWithRunningJobs ¶
func (q *Queries) CountStaleNodesWithRunningJobs(ctx context.Context, lastHeartbeat pgtype.Timestamptz) (int64, error)
Counts distinct stale nodes that currently have at least one running job. Excludes NULL node_id rows (orphaned running jobs) from node count.
func (*Queries) CreateArtifactBundle ¶
func (q *Queries) CreateArtifactBundle(ctx context.Context, arg CreateArtifactBundleParams) (ArtifactBundle, error)
Creates a new artifact bundle metadata. Blob data is stored in object storage. Bundles are grouped at the job level only (build_id removed).
func (*Queries) CreateDiff ¶
Creates a new diff entry associated with a job. Blob data is stored in object storage.
func (*Queries) CreateEvent ¶
func (*Queries) CreateGitSpecSnapshot ¶
func (*Queries) CreateJob ¶
Note: `id` is a required TEXT parameter (KSUID-backed); caller generates via types.NewJobID().
func (*Queries) CreateLog ¶
Creates a new log chunk metadata. Blob data is stored in object storage. Logs are grouped at the job level only (build_id removed).
func (*Queries) CreateMigRepo ¶
func (*Queries) CreateNode ¶
Creates a new node with an application-supplied URL-safe ID as the primary key.
func (*Queries) CreateNodeDaemonLog ¶
func (q *Queries) CreateNodeDaemonLog(ctx context.Context, arg CreateNodeDaemonLogParams) (NodeDaemonLog, error)
func (*Queries) CreateSpec ¶
func (*Queries) CreateSpecBundle ¶
func (q *Queries) CreateSpecBundle(ctx context.Context, arg CreateSpecBundleParams) (SpecBundle, error)
Creates a new spec bundle metadata row. Blob data is stored in object storage.
func (*Queries) CreateWave ¶
func (*Queries) DeleteArtifactBundle ¶
func (*Queries) DeleteDiff ¶
func (*Queries) DeleteExpiredArtifactBundles ¶
func (q *Queries) DeleteExpiredArtifactBundles(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
DeleteExpiredArtifactBundles removes artifact bundle rows older than the specified timestamp.
func (*Queries) DeleteExpiredDiffs ¶
func (q *Queries) DeleteExpiredDiffs(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
DeleteExpiredDiffs removes diff rows older than the specified timestamp.
func (*Queries) DeleteExpiredEvents ¶
DeleteExpiredEvents removes event rows older than the specified timestamp.
func (*Queries) DeleteExpiredLogs ¶
func (q *Queries) DeleteExpiredLogs(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
DeleteExpiredLogs removes log rows older than the specified timestamp.
func (*Queries) DeleteGlobalEnv ¶
func (q *Queries) DeleteGlobalEnv(ctx context.Context, arg DeleteGlobalEnvParams) error
Removes an environment entry by key and target. No-op if the (key, target) pair does not exist (exec returns no error).
func (*Queries) DeleteMig ¶
Deletes a mig. Use with caution; should only be called when safe to remove.
func (*Queries) DeleteMigRepo ¶
Deletes a mig_repo by id. Note: mig_repos.id remains referenced by API-level repo membership records.
func (*Queries) DeleteNode ¶
func (*Queries) DeleteSBOMRowsByJob ¶
func (*Queries) DeleteSpecBundle ¶
Deletes a spec bundle metadata row by ID. Called by blobpersist as rollback when object storage upload fails.
func (*Queries) GetAPITokenByID ¶
func (*Queries) GetArtifactBundle ¶
Returns artifact bundle metadata including object_key for object-storage retrieval.
func (*Queries) GetBootstrapToken ¶
func (*Queries) GetGitSpecSnapshot ¶
func (*Queries) GetGlobalEnv ¶
Retrieves a single environment entry by key and target. Returns pgx.ErrNoRows if the (key, target) pair does not exist.
func (*Queries) GetLatestDiffByJob ¶
func (*Queries) GetLatestRunByMigAndRepoStatus ¶
func (q *Queries) GetLatestRunByMigAndRepoStatus(ctx context.Context, arg GetLatestRunByMigAndRepoStatusParams) (GetLatestRunByMigAndRepoStatusRow, error)
func (*Queries) GetMigByName ¶
func (*Queries) GetMigRepo ¶
func (*Queries) GetMigRepoByURL ¶
Gets a mig_repo by mig_id and repo_url (for uniqueness constraint enforcement).
func (*Queries) GetRunForUpdate ¶
func (*Queries) GetRunSnapshotMetadata ¶
func (*Queries) GetSpecBundle ¶
Returns spec bundle metadata including object_key for object-storage retrieval.
func (*Queries) GetSpecBundleByCID ¶
Returns the most recently created spec bundle for a given cid. Used for deduplication: callers should check by CID before uploading.
func (*Queries) HasMigRepoHistory ¶
Checks if a mig_repo has any historical executions. Returns true if the repo cannot be deleted due to history, false otherwise.
func (*Queries) HasRunningJobForRunNode ¶
func (*Queries) InsertAPIToken ¶
func (q *Queries) InsertAPIToken(ctx context.Context, arg InsertAPITokenParams) error
func (*Queries) InsertBootstrapToken ¶
func (q *Queries) InsertBootstrapToken(ctx context.Context, arg InsertBootstrapTokenParams) error
func (*Queries) ListAPITokens ¶
func (q *Queries) ListAPITokens(ctx context.Context) ([]ListAPITokensRow, error)
func (*Queries) ListArtifactBundlePartitions ¶
ListArtifactBundlePartitions retrieves all partition names for the artifact_bundles table.
func (*Queries) ListArtifactBundlesByCID ¶
func (q *Queries) ListArtifactBundlesByCID(ctx context.Context, cid *string) ([]ArtifactBundle, error)
Returns artifact bundle metadata including object_key for object-storage retrieval.
func (*Queries) ListArtifactBundlesByRunAndJob ¶
func (q *Queries) ListArtifactBundlesByRunAndJob(ctx context.Context, arg ListArtifactBundlesByRunAndJobParams) ([]ArtifactBundle, error)
Returns artifact bundle metadata including object_key for object-storage retrieval.
func (*Queries) ListConfigBundleMap ¶
func (q *Queries) ListConfigBundleMap(ctx context.Context) ([]ConfigBundleMap, error)
config_bundle_map.sql — read queries for global bundle map entries (config_bundle_map table). Provides ListConfigBundleMap. Returns all bundle map entries ordered by hash for deterministic iteration.
func (*Queries) ListConfigIn ¶
config_in.sql — read queries for global in mount entries (config_in table). Provides ListConfigIn. Returns all in entries ordered by section then dst for deterministic iteration.
func (*Queries) ListDiffsByRun ¶
Returns diff metadata for a run.
func (*Queries) ListDistinctRepos ¶
func (q *Queries) ListDistinctRepos(ctx context.Context, filter string) ([]ListDistinctReposRow, error)
Lists distinct repos for a mig with last known run metadata, optionally filtered by repo_url substring.
func (*Queries) ListEventPartitions ¶
ListEventPartitions retrieves all partition names for the events table.
func (*Queries) ListEventsByRun ¶
func (*Queries) ListEventsByRunSince ¶
func (*Queries) ListFailedRepoIDsByMig ¶
func (*Queries) ListGlobalEnv ¶
config_env.sql — CRUD queries for global environment variables (config_env table). Provides ListGlobalEnv, GetGlobalEnv, UpsertGlobalEnv, DeleteGlobalEnv. Returns all global environment entries, ordered by key then target for consistent iteration. Used by ConfigHolder initialization and HTTP list endpoint.
func (*Queries) ListJobsByRun ¶
func (*Queries) ListJobsByRunAttempt ¶
func (*Queries) ListJobsPage ¶
func (q *Queries) ListJobsPage(ctx context.Context, arg ListJobsPageParams) ([]ListJobsPageRow, error)
Lists jobs with optional run, node, and status filters, ordered newest-to-oldest by job id. Joins runs and migs to surface mig_name for CLI and TUI consumers.
func (*Queries) ListLogPartitions ¶
ListLogPartitions retrieves all partition names for the logs table.
func (*Queries) ListLogsByRun ¶
Returns log metadata including object_key for object-storage retrieval.
func (*Queries) ListLogsByRunSince ¶
func (q *Queries) ListLogsByRunSince(ctx context.Context, arg ListLogsByRunSinceParams) ([]Log, error)
Returns log metadata including object_key for object-storage retrieval.
func (*Queries) ListMigReposByMig ¶
func (*Queries) ListMigs ¶
Lists migs with optional filtering by archived status and name substring. archived_only: if true, return only archived migs; if false, return only active migs; if null, return all. name_filter: if non-empty, filter by name substring (case-insensitive); if null/empty, no name filtering.
func (*Queries) ListNodeDaemonLogs ¶
func (q *Queries) ListNodeDaemonLogs(ctx context.Context, arg ListNodeDaemonLogsParams) ([]NodeDaemonLog, error)
func (*Queries) ListNodeDiagnostics ¶
func (*Queries) ListNodeMetricsPartitions ¶
ListNodeMetricsPartitions retrieves all partition names for the node_metrics table.
func (*Queries) ListRunSBOMRowsByJobType ¶
func (q *Queries) ListRunSBOMRowsByJobType(ctx context.Context, arg ListRunSBOMRowsByJobTypeParams) ([]ListRunSBOMRowsByJobTypeRow, error)
func (*Queries) ListRunsByWave ¶
func (*Queries) ListRunsForRepo ¶
func (q *Queries) ListRunsForRepo(ctx context.Context, arg ListRunsForRepoParams) ([]ListRunsForRepoRow, error)
func (*Queries) ListRunsWithMetadata ¶
func (q *Queries) ListRunsWithMetadata(ctx context.Context, arg ListRunsWithMetadataParams) ([]ListRunsWithMetadataRow, error)
func (*Queries) ListRunsWithURLByWave ¶
func (*Queries) ListSpecBundles ¶
func (q *Queries) ListSpecBundles(ctx context.Context, arg ListSpecBundlesParams) ([]SpecBundle, error)
Lists spec bundles ordered by created_at descending (most recent first).
func (*Queries) ListSpecBundlesUnreferencedBefore ¶
func (q *Queries) ListSpecBundlesUnreferencedBefore(ctx context.Context, lastRefAt pgtype.Timestamptz) ([]SpecBundle, error)
Lists spec bundles whose last_ref_at is before the given threshold. Used by GC to find bundles eligible for deletion.
func (*Queries) ListSpecs ¶
Lists specs ordered by created_at descending (most recent first). There is an index on created_at to optimize this query.
func (*Queries) ListStaleRunningJobs ¶
func (q *Queries) ListStaleRunningJobs(ctx context.Context, lastHeartbeat pgtype.Timestamptz) ([]ListStaleRunningJobsRow, error)
Lists running jobs whose assigned node is stale at the provided cutoff. Rows are grouped by (run_id, attempt) for deterministic recovery processing.
func (*Queries) PromoteJobByIDIfUnblocked ¶
Atomically promote a specific linked successor job: Created -> Queued. The candidate is eligible only when every predecessor that points to it is Success.
func (*Queries) RevokeAPIToken ¶
func (*Queries) TrimNodeDaemonLogs ¶
func (q *Queries) TrimNodeDaemonLogs(ctx context.Context, arg TrimNodeDaemonLogsParams) error
func (*Queries) UnarchiveMig ¶
Unarchives a mig by clearing archived_at.
func (*Queries) UnclaimJob ¶
func (q *Queries) UnclaimJob(ctx context.Context, arg UnclaimJobParams) error
Revert a claimed Running job back to claimable Queued state. Guarded by both job id and node id so a foreign node cannot steal the slot.
func (*Queries) UpdateAPITokenLastUsed ¶
func (*Queries) UpdateJobCompletion ¶
func (q *Queries) UpdateJobCompletion(ctx context.Context, arg UpdateJobCompletionParams) error
func (*Queries) UpdateJobCompletionWithMeta ¶
func (q *Queries) UpdateJobCompletionWithMeta(ctx context.Context, arg UpdateJobCompletionWithMetaParams) error
func (*Queries) UpdateJobImageName ¶
func (q *Queries) UpdateJobImageName(ctx context.Context, arg UpdateJobImageNameParams) error
Persist the container image name used to execute a job. This is set by the node immediately before job execution starts.
func (*Queries) UpdateJobMeta ¶
func (q *Queries) UpdateJobMeta(ctx context.Context, arg UpdateJobMetaParams) error
func (*Queries) UpdateJobReport ¶
func (*Queries) UpdateJobStatus ¶
func (q *Queries) UpdateJobStatus(ctx context.Context, arg UpdateJobStatusParams) error
func (*Queries) UpdateMigSpec ¶
func (q *Queries) UpdateMigSpec(ctx context.Context, arg UpdateMigSpecParams) error
func (*Queries) UpdateNodeCertMetadata ¶
func (q *Queries) UpdateNodeCertMetadata(ctx context.Context, arg UpdateNodeCertMetadataParams) error
func (*Queries) UpdateNodeDrained ¶
func (q *Queries) UpdateNodeDrained(ctx context.Context, arg UpdateNodeDrainedParams) error
func (*Queries) UpdateNodeHeartbeat ¶
func (q *Queries) UpdateNodeHeartbeat(ctx context.Context, arg UpdateNodeHeartbeatParams) error
func (*Queries) UpdateRunError ¶
func (q *Queries) UpdateRunError(ctx context.Context, arg UpdateRunErrorParams) error
func (*Queries) UpdateRunStatus ¶
func (q *Queries) UpdateRunStatus(ctx context.Context, arg UpdateRunStatusParams) error
func (*Queries) UpdateSpecBundleLastRefAt ¶
Updates last_ref_at to now() for the given spec bundle. Call this whenever a spec or run references the bundle to keep GC metadata fresh.
func (*Queries) UpdateWaveCompletion ¶
func (q *Queries) UpdateWaveCompletion(ctx context.Context, arg UpdateWaveCompletionParams) error
func (*Queries) UpdateWaveStatus ¶
func (q *Queries) UpdateWaveStatus(ctx context.Context, arg UpdateWaveStatusParams) error
func (*Queries) UpsertGlobalEnv ¶
func (q *Queries) UpsertGlobalEnv(ctx context.Context, arg UpsertGlobalEnvParams) error
Inserts or updates an environment entry (upsert on composite key (key, target)). Updates value, secret, and refreshes updated_at on conflict. This ensures idempotent set operations from the CLI or API.
func (*Queries) UpsertJobMetric ¶
func (q *Queries) UpsertJobMetric(ctx context.Context, arg UpsertJobMetricParams) error
func (*Queries) UpsertMigRepo ¶
Bulk upsert a mig_repo by normalized repo_url. Uniqueness is on (mig_id, repo_id) to prevent duplicate repo membership per mig.
func (*Queries) UpsertNodeDiagnostic ¶
func (q *Queries) UpsertNodeDiagnostic(ctx context.Context, arg UpsertNodeDiagnosticParams) (NodeDiagnostic, error)
func (*Queries) UpsertSBOMRow ¶
func (q *Queries) UpsertSBOMRow(ctx context.Context, arg UpsertSBOMRowParams) error
type Repo ¶
type Repo struct {
ID types.RepoID `json:"id"`
Url string `json:"url"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type RestartRunParams ¶ added in v0.1.16
type Run ¶
type Run struct {
ID types.RunID `json:"id"`
WaveID types.WaveID `json:"wave_id"`
MigID types.MigID `json:"mig_id"`
SpecID types.SpecID `json:"spec_id"`
RepoID types.RepoID `json:"repo_id"`
RepoBaseRef string `json:"repo_base_ref"`
SourceCommitSha string `json:"source_commit_sha"`
RepoSha0 string `json:"repo_sha0"`
CreatedBy *string `json:"created_by"`
Status types.RunStatus `json:"status"`
Attempt int32 `json:"attempt"`
LastError *string `json:"last_error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
Stats []byte `json:"stats"`
}
type RunMaterialization ¶
RunMaterialization contains the persisted run and its ordered job chain.
type RunPlan ¶
type RunPlan struct {
ID types.RunID
RepoID types.RepoID
RepoBaseRef string
SourceCommitSha string
RepoSha0 string
Stats []byte
Jobs []JobPlan
}
RunPlan contains repository-specific run data and its reusable job template. CreateWaveWithRuns supplies wave-wide fields and materializes job identities.
type RunsTiming ¶
type Spec ¶
type Spec struct {
ID types.SpecID `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Source []byte `json:"source"`
Sha string `json:"sha"`
SourceCommittedAt pgtype.Timestamptz `json:"source_committed_at"`
Spec []byte `json:"spec"`
CreatedBy *string `json:"created_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type SpecBundle ¶
type SpecBundle struct {
ID string `json:"id"`
Cid string `json:"cid"`
Digest string `json:"digest"`
Size int64 `json:"size"`
ObjectKey *string `json:"object_key"`
CreatedBy *string `json:"created_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
LastRefAt pgtype.Timestamptz `json:"last_ref_at"`
}
type Store ¶
type Store interface {
Querier
CancelRun(ctx context.Context, runID types.RunID) error
CancelWave(ctx context.Context, waveID types.WaveID) error
CompleteBootstrapEnrollment(ctx context.Context, arg CompleteBootstrapEnrollmentParams) error
CreateWaveWithRuns(ctx context.Context, arg CreateWaveWithRunsParams) (Wave, []RunMaterialization, error)
RestartRun(ctx context.Context, arg RestartRunParams) (Run, error)
WithJobExecution(ctx context.Context, jobID types.JobID, resumeCount int, complete func(Store, Job) error) error
Close()
Pool() *pgxpool.Pool
}
Store defines the interface for database operations. The sqlc-generated Queries type implements the query methods via Querier.
type UnclaimJobParams ¶
type UpdateJobMetaParams ¶
type UpdateJobReportParams ¶
type UpdateJobStatusParams ¶
type UpdateJobStatusParams struct {
ID types.JobID `json:"id"`
Status types.JobStatus `json:"status"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
DurationMs int64 `json:"duration_ms"`
}
type UpdateMigSpecParams ¶
type UpdateNodeCertMetadataParams ¶
type UpdateNodeCertMetadataParams struct {
ID types.NodeID `json:"id"`
CertSerial *string `json:"cert_serial"`
CertFingerprint *string `json:"cert_fingerprint"`
CertNotBefore pgtype.Timestamptz `json:"cert_not_before"`
CertNotAfter pgtype.Timestamptz `json:"cert_not_after"`
}
type UpdateNodeDrainedParams ¶
type UpdateNodeHeartbeatParams ¶
type UpdateNodeHeartbeatParams struct {
ID types.NodeID `json:"id"`
LastHeartbeat pgtype.Timestamptz `json:"last_heartbeat"`
CpuTotalMillis int32 `json:"cpu_total_millis"`
CpuFreeMillis int32 `json:"cpu_free_millis"`
MemTotalBytes int64 `json:"mem_total_bytes"`
MemFreeBytes int64 `json:"mem_free_bytes"`
DiskTotalBytes int64 `json:"disk_total_bytes"`
DiskFreeBytes int64 `json:"disk_free_bytes"`
Version string `json:"version"`
}
type UpdateRunErrorParams ¶
type UpdateRunStatusParams ¶
type UpdateWaveCompletionParams ¶
type UpdateWaveCompletionParams struct {
ID types.WaveID `json:"id"`
Status types.WaveStatus `json:"status"`
Stats []byte `json:"stats"`
}
type UpdateWaveStatusParams ¶
type UpdateWaveStatusParams struct {
ID types.WaveID `json:"id"`
Status types.WaveStatus `json:"status"`
}
type UpsertGlobalEnvParams ¶
type UpsertJobMetricParams ¶
type UpsertMigRepoParams ¶
type UpsertNodeDiagnosticParams ¶
type UpsertNodeDiagnosticParams struct {
NodeID types.NodeID `json:"node_id"`
Component string `json:"component"`
Status string `json:"status"`
LastError *string `json:"last_error"`
Version *string `json:"version"`
ImageRef *string `json:"image_ref"`
LocalImageID *string `json:"local_image_id"`
RemoteImageID *string `json:"remote_image_id"`
Details []byte `json:"details"`
LastCheckedAt pgtype.Timestamptz `json:"last_checked_at"`
LastSuccessAt pgtype.Timestamptz `json:"last_success_at"`
}
type UpsertSBOMRowParams ¶
type Wave ¶
type Wave struct {
ID types.WaveID `json:"id"`
MigID types.MigID `json:"mig_id"`
SpecID types.SpecID `json:"spec_id"`
CreatedBy *string `json:"created_by"`
Status types.WaveStatus `json:"status"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
StartedAt pgtype.Timestamptz `json:"started_at"`
FinishedAt pgtype.Timestamptz `json:"finished_at"`
Stats []byte `json:"stats"`
}
Source Files
¶
- artifact_bundles.sql.go
- config_bundle_map.sql.go
- config_env.sql.go
- config_in.sql.go
- db.go
- diffs.sql.go
- events.sql.go
- job_metrics.sql.go
- jobs.sql.go
- logs.sql.go
- mig_repos.sql.go
- migrations.go
- migs.sql.go
- models.go
- node_diagnostics.sql.go
- nodes.sql.go
- querier.go
- repos.sql.go
- resume_run.go
- run_repo_guard.go
- runs.sql.go
- sboms.sql.go
- schema_snapshot.go
- spec_bundles.sql.go
- specs.sql.go
- store.go
- tokens.sql.go
- ttl.sql.go
- waves.sql.go