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