@@ -17,6 +17,7 @@ type Querier interface { |
| 17 | 17 | ClaimQueuedWorkflowJob(ctx context.Context, db DBTX, arg ClaimQueuedWorkflowJobParams) (ClaimQueuedWorkflowJobRow, error) |
| 18 | 18 | CompleteWorkflowRun(ctx context.Context, db DBTX, arg CompleteWorkflowRunParams) (WorkflowRun, error) |
| 19 | 19 | CountRunningJobsForRunner(ctx context.Context, db DBTX, runnerID int64) (int32, error) |
| 20 | + CountWorkflowCachesForRepo(ctx context.Context, db DBTX, arg CountWorkflowCachesForRepoParams) (int64, error) |
| 20 | 21 | CountWorkflowRunsForRepo(ctx context.Context, db DBTX, arg CountWorkflowRunsForRepoParams) (int64, error) |
| 21 | 22 | DeleteOldRunnerJWTUsesForCleanup(ctx context.Context, db DBTX, expiresAt pgtype.Timestamptz) (int64, error) |
| 22 | 23 | DeleteOldWorkflowRunsForCleanup(ctx context.Context, db DBTX, completedAt pgtype.Timestamptz) (int64, error) |
@@ -28,6 +29,10 @@ type Querier interface { |
| 28 | 29 | DeleteStepLogChunks(ctx context.Context, db DBTX, stepID int64) error |
| 29 | 30 | DeleteWorkflowArtifactByID(ctx context.Context, db DBTX, id int64) (int64, error) |
| 30 | 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) |
| 31 | 36 | // Cascades to workflow_jobs → workflow_steps → workflow_step_log_chunks |
| 32 | 37 | // and workflow_artifacts via the on-delete-cascade FK chain. The |
| 33 | 38 | // S3-side artifact blobs are NOT removed here; the handler queries |
@@ -61,6 +66,7 @@ type Querier interface { |
| 61 | 66 | GetRunnerByTokenHash(ctx context.Context, db DBTX, tokenHash []byte) (GetRunnerByTokenHashRow, error) |
| 62 | 67 | GetStepLogChunkBefore(ctx context.Context, db DBTX, arg GetStepLogChunkBeforeParams) (WorkflowStepLogChunk, error) |
| 63 | 68 | GetStepLogChunkByStepSeq(ctx context.Context, db DBTX, arg GetStepLogChunkByStepSeqParams) (WorkflowStepLogChunk, error) |
| 69 | + GetWorkflowCacheByID(ctx context.Context, db DBTX, id int64) (WorkflowCache, error) |
| 64 | 70 | GetWorkflowJobByID(ctx context.Context, db DBTX, id int64) (WorkflowJob, error) |
| 65 | 71 | GetWorkflowJobSecretMask(ctx context.Context, db DBTX, jobID int64) (WorkflowJobSecretMask, error) |
| 66 | 72 | GetWorkflowRunByID(ctx context.Context, db DBTX, id int64) (WorkflowRun, error) |
@@ -73,6 +79,12 @@ type Querier interface { |
| 73 | 79 | InsertRunner(ctx context.Context, db DBTX, arg InsertRunnerParams) (WorkflowRunner, error) |
| 74 | 80 | InsertRunnerToken(ctx context.Context, db DBTX, arg InsertRunnerTokenParams) (RunnerToken, error) |
| 75 | 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 |
| 76 | 88 | InsertWorkflowJob(ctx context.Context, db DBTX, arg InsertWorkflowJobParams) (WorkflowJob, error) |
| 77 | 89 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 78 | 90 | InsertWorkflowRun(ctx context.Context, db DBTX, arg InsertWorkflowRunParams) (WorkflowRun, error) |
@@ -107,6 +119,10 @@ type Querier interface { |
| 107 | 119 | ListRunners(ctx context.Context, db DBTX) ([]ListRunnersRow, error) |
| 108 | 120 | ListStepLogChunks(ctx context.Context, db DBTX, arg ListStepLogChunksParams) ([]WorkflowStepLogChunk, error) |
| 109 | 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) |
| 110 | 126 | ListWorkflowRunWorkflowsForRepo(ctx context.Context, db DBTX, repoID int64) ([]ListWorkflowRunWorkflowsForRepoRow, error) |
| 111 | 127 | ListWorkflowRunsForRepo(ctx context.Context, db DBTX, arg ListWorkflowRunsForRepoParams) ([]ListWorkflowRunsForRepoRow, error) |
| 112 | 128 | LockRunnerByID(ctx context.Context, db DBTX, id int64) (WorkflowRunner, error) |
@@ -129,6 +145,9 @@ type Querier interface { |
| 129 | 145 | RevokeAllTokensForRunner(ctx context.Context, db DBTX, runnerID int64) error |
| 130 | 146 | StartWorkflowRun(ctx context.Context, db DBTX, id int64) (WorkflowRun, error) |
| 131 | 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 |
| 132 | 151 | UpdateStepLogChunk(ctx context.Context, db DBTX, arg UpdateStepLogChunkParams) error |
| 133 | 152 | UpdateWorkflowJobStatus(ctx context.Context, db DBTX, arg UpdateWorkflowJobStatusParams) (WorkflowJob, error) |
| 134 | 153 | UpdateWorkflowStepLogObject(ctx context.Context, db DBTX, arg UpdateWorkflowStepLogObjectParams) (WorkflowStep, error) |