Go · 14293 bytes Raw Blame History
1 // Code generated by sqlc. DO NOT EDIT.
2 // versions:
3 // sqlc v1.31.1
4
5 package actionsdb
6
7 import (
8 "context"
9
10 "github.com/jackc/pgx/v5/pgtype"
11 )
12
13 type Querier interface {
14 // SPDX-License-Identifier: AGPL-3.0-or-later
15 AppendStepLogChunk(ctx context.Context, db DBTX, arg AppendStepLogChunkParams) (AppendStepLogChunkRow, error)
16 ApproveWorkflowRun(ctx context.Context, db DBTX, arg ApproveWorkflowRunParams) (ApproveWorkflowRunRow, error)
17 CancelOpenWorkflowStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]WorkflowStep, error)
18 ClaimQueuedWorkflowJob(ctx context.Context, db DBTX, arg ClaimQueuedWorkflowJobParams) (ClaimQueuedWorkflowJobRow, error)
19 ClearRunnerDraining(ctx context.Context, db DBTX, id int64) (ClearRunnerDrainingRow, error)
20 CompleteWorkflowRun(ctx context.Context, db DBTX, arg CompleteWorkflowRunParams) (WorkflowRun, error)
21 CountQueuedWorkflowRunsForRepo(ctx context.Context, db DBTX, repoID int64) (int64, error)
22 CountRecentWorkflowRunsForActor(ctx context.Context, db DBTX, arg CountRecentWorkflowRunsForActorParams) (int64, error)
23 CountRunningJobsForRunner(ctx context.Context, db DBTX, runnerID int64) (int32, error)
24 CountRunningWorkflowJobsForOwner(ctx context.Context, db DBTX, repoID int64) (int64, error)
25 CountRunningWorkflowJobsForRepo(ctx context.Context, db DBTX, repoID int64) (int64, error)
26 CountWorkflowCachesForRepo(ctx context.Context, db DBTX, arg CountWorkflowCachesForRepoParams) (int64, error)
27 CountWorkflowRunsForRepo(ctx context.Context, db DBTX, arg CountWorkflowRunsForRepoParams) (int64, error)
28 DeleteOldRunnerJWTUsesForCleanup(ctx context.Context, db DBTX, expiresAt pgtype.Timestamptz) (int64, error)
29 DeleteOldWorkflowRunsForCleanup(ctx context.Context, db DBTX, completedAt pgtype.Timestamptz) (int64, error)
30 DeleteOrgSecret(ctx context.Context, db DBTX, arg DeleteOrgSecretParams) error
31 DeleteOrgVariable(ctx context.Context, db DBTX, arg DeleteOrgVariableParams) error
32 DeleteRepoSecret(ctx context.Context, db DBTX, arg DeleteRepoSecretParams) error
33 DeleteRepoVariable(ctx context.Context, db DBTX, arg DeleteRepoVariableParams) error
34 DeleteStaleStepLogChunksForCleanup(ctx context.Context, db DBTX, completedAt pgtype.Timestamptz) (int64, error)
35 DeleteStepLogChunks(ctx context.Context, db DBTX, stepID int64) error
36 DeleteWorkflowArtifactByID(ctx context.Context, db DBTX, id int64) (int64, error)
37 DeleteWorkflowArtifactsByIDs(ctx context.Context, db DBTX, dollar_1 []int64) (int64, error)
38 DeleteWorkflowCacheByID(ctx context.Context, db DBTX, arg DeleteWorkflowCacheByIDParams) (int64, error)
39 // Returns the deleted rows' object_keys so the handler can purge the
40 // backing tarballs from object storage.
41 DeleteWorkflowCachesByKey(ctx context.Context, db DBTX, arg DeleteWorkflowCachesByKeyParams) ([]string, error)
42 // Cascades to workflow_jobs → workflow_steps → workflow_step_log_chunks
43 // and workflow_artifacts via the on-delete-cascade FK chain. The
44 // S3-side artifact blobs are NOT removed here; the handler queries
45 // the artifact object_keys first and deletes them best-effort after
46 // the row is gone.
47 DeleteWorkflowRunByID(ctx context.Context, db DBTX, id int64) (int64, error)
48 // Idempotent: re-disabling an already-disabled workflow is a no-op
49 // and does not bump disabled_at.
50 DisableWorkflow(ctx context.Context, db DBTX, arg DisableWorkflowParams) error
51 // Returns affected-rows so the handler can distinguish 200 (re-enabled)
52 // from 404-ish no-op.
53 EnableWorkflow(ctx context.Context, db DBTX, arg EnableWorkflowParams) (int64, error)
54 // Idempotent insert: if a row with the same (repo_id, workflow_file,
55 // trigger_event_id) already exists, returns no rows (pgx.ErrNoRows in
56 // Go). The handler treats that as a successful no-op so worker
57 // retries and admin replays of the same triggering event don't
58 // duplicate runs.
59 //
60 // The ON CONFLICT predicate matches the partial unique index defined
61 // in migration 0051; both must agree for postgres to infer the
62 // target.
63 EnqueueWorkflowRun(ctx context.Context, db DBTX, arg EnqueueWorkflowRunParams) (WorkflowRun, error)
64 GetActionsRepoPolicy(ctx context.Context, db DBTX, repoID int64) (ActionsRepoPolicy, error)
65 GetArtifactByID(ctx context.Context, db DBTX, id int64) (WorkflowArtifact, error)
66 // SPDX-License-Identifier: AGPL-3.0-or-later
67 GetEffectiveActionsPolicyForRepo(ctx context.Context, db DBTX, id int64) (GetEffectiveActionsPolicyForRepoRow, error)
68 GetFirstStepForJob(ctx context.Context, db DBTX, jobID int64) (WorkflowStep, error)
69 GetOrgSecret(ctx context.Context, db DBTX, arg GetOrgSecretParams) (GetOrgSecretRow, error)
70 GetOrgVariable(ctx context.Context, db DBTX, arg GetOrgVariableParams) (GetOrgVariableRow, error)
71 GetRepoSecret(ctx context.Context, db DBTX, arg GetRepoSecretParams) (GetRepoSecretRow, error)
72 GetRepoVariable(ctx context.Context, db DBTX, arg GetRepoVariableParams) (GetRepoVariableRow, error)
73 GetRunnerByID(ctx context.Context, db DBTX, id int64) (GetRunnerByIDRow, error)
74 GetRunnerByName(ctx context.Context, db DBTX, name string) (GetRunnerByNameRow, error)
75 GetRunnerByTokenHash(ctx context.Context, db DBTX, tokenHash []byte) (GetRunnerByTokenHashRow, error)
76 GetStepLogChunkBefore(ctx context.Context, db DBTX, arg GetStepLogChunkBeforeParams) (WorkflowStepLogChunk, error)
77 GetStepLogChunkByStepSeq(ctx context.Context, db DBTX, arg GetStepLogChunkByStepSeqParams) (WorkflowStepLogChunk, error)
78 GetWorkflowCacheByID(ctx context.Context, db DBTX, id int64) (WorkflowCache, error)
79 GetWorkflowJobByID(ctx context.Context, db DBTX, id int64) (WorkflowJob, error)
80 GetWorkflowJobSecretMask(ctx context.Context, db DBTX, jobID int64) (WorkflowJobSecretMask, error)
81 GetWorkflowRunApproval(ctx context.Context, db DBTX, runID int64) (WorkflowRunApproval, error)
82 GetWorkflowRunByID(ctx context.Context, db DBTX, id int64) (WorkflowRun, error)
83 GetWorkflowRunForRepoByIndex(ctx context.Context, db DBTX, arg GetWorkflowRunForRepoByIndexParams) (GetWorkflowRunForRepoByIndexRow, error)
84 GetWorkflowStepByID(ctx context.Context, db DBTX, id int64) (WorkflowStep, error)
85 HeartbeatRunner(ctx context.Context, db DBTX, arg HeartbeatRunnerParams) (HeartbeatRunnerRow, error)
86 // SPDX-License-Identifier: AGPL-3.0-or-later
87 InsertArtifact(ctx context.Context, db DBTX, arg InsertArtifactParams) (WorkflowArtifact, error)
88 // SPDX-License-Identifier: AGPL-3.0-or-later
89 InsertRunner(ctx context.Context, db DBTX, arg InsertRunnerParams) (InsertRunnerRow, error)
90 InsertRunnerToken(ctx context.Context, db DBTX, arg InsertRunnerTokenParams) (RunnerToken, error)
91 // SPDX-License-Identifier: AGPL-3.0-or-later
92 // Called by the future runner-side upload handler when an
93 // actions/cache step completes its tarball upload. Idempotent on
94 // (repo_id, cache_key, cache_version, git_ref): a re-upload with the
95 // same coordinates updates size + last_accessed_at + object_key.
96 InsertWorkflowCache(ctx context.Context, db DBTX, arg InsertWorkflowCacheParams) (WorkflowCache, error)
97 // SPDX-License-Identifier: AGPL-3.0-or-later
98 InsertWorkflowJob(ctx context.Context, db DBTX, arg InsertWorkflowJobParams) (WorkflowJob, error)
99 // SPDX-License-Identifier: AGPL-3.0-or-later
100 InsertWorkflowRun(ctx context.Context, db DBTX, arg InsertWorkflowRunParams) (WorkflowRun, error)
101 // SPDX-License-Identifier: AGPL-3.0-or-later
102 InsertWorkflowRunApproval(ctx context.Context, db DBTX, arg InsertWorkflowRunApprovalParams) (WorkflowRunApproval, error)
103 // SPDX-License-Identifier: AGPL-3.0-or-later
104 InsertWorkflowStep(ctx context.Context, db DBTX, arg InsertWorkflowStepParams) (WorkflowStep, error)
105 // SPDX-License-Identifier: AGPL-3.0-or-later
106 // Hot path for trigger.Enqueue: skip enqueueing when the row exists.
107 IsWorkflowDisabled(ctx context.Context, db DBTX, arg IsWorkflowDisabledParams) (bool, error)
108 ListActiveWorkflowRunsForAdmin(ctx context.Context, db DBTX, arg ListActiveWorkflowRunsForAdminParams) ([]WorkflowRun, error)
109 ListAllStepLogChunksForStep(ctx context.Context, db DBTX, stepID int64) ([]WorkflowStepLogChunk, error)
110 // Used by the run-delete REST handler to drive a best-effort S3
111 // cleanup after the workflow_runs row (and its cascaded
112 // workflow_artifacts rows) have been removed.
113 ListArtifactObjectKeysForRun(ctx context.Context, db DBTX, runID int64) ([]string, error)
114 ListArtifactsForRun(ctx context.Context, db DBTX, runID int64) ([]ListArtifactsForRunRow, error)
115 // Older queued/running runs with the same group block the new run while they
116 // still have at least one queued/running job that has not already received a
117 // cancel request. cancel-in-progress releases the slot by flipping that job
118 // flag even if the runner is still draining the old container.
119 ListBlockingConcurrencyRunsForUpdate(ctx context.Context, db DBTX, arg ListBlockingConcurrencyRunsForUpdateParams) ([]WorkflowRun, error)
120 // Used by the workflows-list endpoint to mark `state: "disabled"`
121 // entries without round-tripping through Is for every file.
122 ListDisabledWorkflowsForRepo(ctx context.Context, db DBTX, repoID int64) ([]string, error)
123 ListExpiredWorkflowArtifactsForCleanup(ctx context.Context, db DBTX, arg ListExpiredWorkflowArtifactsForCleanupParams) ([]ListExpiredWorkflowArtifactsForCleanupRow, error)
124 ListJobsForRun(ctx context.Context, db DBTX, runID int64) ([]ListJobsForRunRow, error)
125 ListOrgSecrets(ctx context.Context, db DBTX, orgID pgtype.Int8) ([]ListOrgSecretsRow, error)
126 ListOrgVariables(ctx context.Context, db DBTX, orgID pgtype.Int8) ([]ListOrgVariablesRow, error)
127 ListQueuedWorkflowJobRunsOn(ctx context.Context, db DBTX) ([]ListQueuedWorkflowJobRunsOnRow, error)
128 ListRepoSecrets(ctx context.Context, db DBTX, repoID pgtype.Int8) ([]ListRepoSecretsRow, error)
129 ListRepoVariables(ctx context.Context, db DBTX, repoID pgtype.Int8) ([]ListRepoVariablesRow, error)
130 ListRunnerStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListRunnerStepsForJobRow, error)
131 ListRunners(ctx context.Context, db DBTX) ([]ListRunnersRow, error)
132 ListStepLogChunks(ctx context.Context, db DBTX, arg ListStepLogChunksParams) ([]WorkflowStepLogChunk, error)
133 ListStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListStepsForJobRow, error)
134 // Paginated list filtered optionally by ref + key. NULL params skip
135 // the filter. Sorted by last_accessed_at DESC so an operator sees the
136 // live caches first.
137 ListWorkflowCachesForRepo(ctx context.Context, db DBTX, arg ListWorkflowCachesForRepoParams) ([]WorkflowCache, error)
138 ListWorkflowRunWorkflowsForRepo(ctx context.Context, db DBTX, repoID int64) ([]ListWorkflowRunWorkflowsForRepoRow, error)
139 ListWorkflowRunsForRepo(ctx context.Context, db DBTX, arg ListWorkflowRunsForRepoParams) ([]ListWorkflowRunsForRepoRow, error)
140 LockRunnerByID(ctx context.Context, db DBTX, id int64) (LockRunnerByIDRow, error)
141 // Companion to EnqueueWorkflowRun for the conflict path: when an
142 // INSERT ... ON CONFLICT DO NOTHING returns no rows, the trigger
143 // handler uses this to find the existing row so it can surface a
144 // stable RunID. Matches the partial-unique index from migration 0051.
145 LookupWorkflowRunByTriggerEvent(ctx context.Context, db DBTX, arg LookupWorkflowRunByTriggerEventParams) (WorkflowRun, error)
146 // SPDX-License-Identifier: AGPL-3.0-or-later
147 MarkRunnerJWTUsed(ctx context.Context, db DBTX, arg MarkRunnerJWTUsedParams) (RunnerJwtUsed, error)
148 MarkStaleRunnersOffline(ctx context.Context, db DBTX, lastHeartbeatAt pgtype.Timestamptz) ([]MarkStaleRunnersOfflineRow, error)
149 MarkWorkflowJobsRejected(ctx context.Context, db DBTX, runID int64) ([]WorkflowJob, error)
150 MarkWorkflowRunRejected(ctx context.Context, db DBTX, id int64) (WorkflowRun, error)
151 MarkWorkflowRunRunning(ctx context.Context, db DBTX, id int64) error
152 // Atomic next-index emitter: take the max + 1 for this repo. Pairs
153 // with the (repo_id, run_index) UNIQUE so concurrent inserts that
154 // race here will catch a unique-violation and the caller retries.
155 // Cast to bigint so sqlc generates int64 (the column type) rather
156 // than int32 (the type the +1 literal would default to).
157 NextRunIndexForRepo(ctx context.Context, db DBTX, repoID int64) (int64, error)
158 RejectWorkflowRunApproval(ctx context.Context, db DBTX, arg RejectWorkflowRunApprovalParams) (WorkflowRunApproval, error)
159 RequestWorkflowJobCancel(ctx context.Context, db DBTX, id int64) (WorkflowJob, error)
160 RequestWorkflowRunCancel(ctx context.Context, db DBTX, runID int64) ([]WorkflowJob, error)
161 RevokeAllTokensForRunner(ctx context.Context, db DBTX, runnerID int64) error
162 RevokeRunner(ctx context.Context, db DBTX, arg RevokeRunnerParams) (RevokeRunnerRow, error)
163 SetRunnerDraining(ctx context.Context, db DBTX, arg SetRunnerDrainingParams) (SetRunnerDrainingRow, error)
164 StartWorkflowRun(ctx context.Context, db DBTX, id int64) (WorkflowRun, error)
165 TouchRunnerHeartbeat(ctx context.Context, db DBTX, arg TouchRunnerHeartbeatParams) error
166 // Bumps last_accessed_at on cache hit. Called by the future
167 // restore-side handler.
168 TouchWorkflowCache(ctx context.Context, db DBTX, id int64) error
169 UpdateStepLogChunk(ctx context.Context, db DBTX, arg UpdateStepLogChunkParams) error
170 UpdateWorkflowJobStatus(ctx context.Context, db DBTX, arg UpdateWorkflowJobStatusParams) (WorkflowJob, error)
171 UpdateWorkflowStepLogObject(ctx context.Context, db DBTX, arg UpdateWorkflowStepLogObjectParams) (WorkflowStep, error)
172 UpdateWorkflowStepStatus(ctx context.Context, db DBTX, arg UpdateWorkflowStepStatusParams) (WorkflowStep, error)
173 UpsertActionsRepoPolicy(ctx context.Context, db DBTX, arg UpsertActionsRepoPolicyParams) (ActionsRepoPolicy, error)
174 UpsertOrgSecret(ctx context.Context, db DBTX, arg UpsertOrgSecretParams) (WorkflowSecret, error)
175 UpsertOrgVariable(ctx context.Context, db DBTX, arg UpsertOrgVariableParams) (ActionsVariable, error)
176 // SPDX-License-Identifier: AGPL-3.0-or-later
177 UpsertRepoSecret(ctx context.Context, db DBTX, arg UpsertRepoSecretParams) (WorkflowSecret, error)
178 // SPDX-License-Identifier: AGPL-3.0-or-later
179 UpsertRepoVariable(ctx context.Context, db DBTX, arg UpsertRepoVariableParams) (ActionsVariable, error)
180 // SPDX-License-Identifier: AGPL-3.0-or-later
181 UpsertWorkflowJobSecretMask(ctx context.Context, db DBTX, arg UpsertWorkflowJobSecretMaskParams) error
182 }
183
184 var _ Querier = (*Queries)(nil)
185