Skip to main content

Module exercise_spec_uploads

Module exercise_spec_uploads 

Source
Expand description

Files uploaded through the exercise-service upload route, which is how a teacher’s CMS editor and the playground store files.

These are recorded so that abandoned ones can be reclaimed. Nothing else can: the host never reads a spec blob, so a stored file’s only reference may live inside content the host cannot parse. The counterpart is crate::exercise_task_spec_files, where an exercise service declares which files its spec actually names.

Structs§

ReapableUpload
An upload the reaper may remove: old enough, and named by no spec anywhere.
SpecUpload
The recorded upload for a file, if any. deleted marks one the reaper has retired.

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
Ages a recorded upload, so a test can reach the retention window without waiting a week.
get_by_file_upload_id
get_reapable
Uploads older than seven days that no live spec and no page-history version references, oldest first, at most REAP_BATCH_LIMIT of them.
insert_many
Records freshly uploaded files so the reaper can later tell an abandoned one from a file it knows nothing about.
mark_reaped
Retires an upload. Idempotent, so a run retrying a failed object delete can call it again.