File
Blob: src/worker/webdav/gc.ts
| 1 | import type { SubjectRow } from "@/worker/db/d1/schema"; |
| 2 | import { blobGcMessage } from "@/worker/queues/blob-gc"; |
| 3 | import { enqueueBlobGc } from "@/worker/r2/gc"; |
| 4 | import type { AppContext } from "@/worker/types"; |
| 5 | |
| 6 | export async function enqueueGc( |
| 7 | c: AppContext, |
| 8 | subject: SubjectRow, |
| 9 | blobs: { blobId: string; blobKey: string }[], |
| 10 | ): Promise<void> { |
| 11 | await enqueueBlobGc( |
| 12 | c.env, |
| 13 | blobs.map((blob) => |
| 14 | blobGcMessage({ |
| 15 | subjectId: subject.id, |
| 16 | storageId: subject.storageId, |
| 17 | blobId: blob.blobId, |
| 18 | blobKey: blob.blobKey, |
| 19 | notBeforeMs: Date.now(), |
| 20 | }), |
| 21 | ), |
| 22 | ); |
| 23 | } |