Expand description
Files uploaded to be named in an exercise answer, bound to the exercise and user they were uploaded for.
The binding is what lets submit reject a file uploaded for a different exercise; ownership
alone would let any exercise’s submission name any of the user’s uploads. It lives in its own
table rather than as a nullable column on file_uploads because file_uploads is shared with
CMS media, organization images and certificates, and the reaper’s safety depends on the
distinction being structural.
Structs§
- Answer
Upload - An answer upload as seen by submit validation.
deleteddistinguishes a reaped upload (answerable withupload_expired) from one that was never recorded. - Answer
Upload Binding - What an upload route recorded for one uploaded file.
- Reapable
Upload - An upload the reaper may remove: old enough, and named by no submission.
Enums§
- Answer
Upload Origin - The channel a file was uploaded through. Selects the reaper’s retention window: a native client uploads seconds before submitting, while an iframe student may hold an upload for the length of an exam.
Constants§
- REAP_
BATCH_ 🔒LIMIT - Cap on one reaper run’s listing, bounding its object-store fan-out and its runtime under the CronJob deadline. A backlog is worked off over successive runs.
Functions§
- backdate
- Moves a binding’s creation time
ageinto the past, to bring it within a retention window. - delete_
by_ file_ upload_ id - Soft-deletes the binding rows for an uploaded file, whatever their state.
- get_
by_ file_ upload_ ids - The live bindings for the given uploaded files, in no particular order.
- get_
for_ exercise_ and_ user - The requested uploads that belong to this exercise and user, soft-deleted ones included.
- get_
id_ by_ file_ upload_ id - The binding row’s own id for an uploaded file.
- get_
reapable - Answer uploads past their origin’s retention window that no submission was ever made from,
oldest first, at most
REAP_BATCH_LIMITof them. - insert_
many - Binds freshly uploaded files to the exercise and user they were uploaded for.
- lock_
for_ exercise_ and_ user - Like
get_for_exercise_and_user, but takes a row lock on the bindings so the reaper cannot retire them between this check and the caller’sexercise_task_submission_filesinsert. - mark_
reaped - Retires an upload, keeping the row so a submit naming it answers
upload_expiredinstead of the misleadingunknown_upload. Idempotent, so a run retrying a failed object delete can call it again.