Rindle.Ops.SweepOrphanedTempFiles (Rindle v0.1.10)

Copy Markdown View Source

Dedicated recursive sweeper for Rindle.tmp/ AV run directories.

This module is the shared service contract for the direct Elixir call, the on-demand Mix task, and the scheduled Oban worker lane.

tus/ regular-file aging (CR-03 safety net)

AV run dirs are aged out as whole directories. The tus backing files used by the resumable-upload path, however, live as individual regular files under a single shared <root>/tus/ subdirectory (S3 tails at <root>/tus/<id>.tail, Local parts at <root>/tus/<id>.part). That tus/ directory's mtime is refreshed on every write, so it never crosses the age threshold on any active system and is never reaped as a whole. To prevent unbounded accumulation, the sweeper recurses into tus/ specifically and ages out individual regular files there (per-file mtime older than the threshold). Deletion is confined strictly to <root>/tus/; no other directory's regular files are touched. This is a backstop behind the explicit end-of-life cleanup (the S3 best-effort File.rm, the tus DELETE handler, and the reaper) — not the primary cleanup path.

Summary

Types

report()

@type report() :: %{
  run_dirs_scanned: non_neg_integer(),
  orphan_count: non_neg_integer(),
  run_dirs_deleted: non_neg_integer(),
  errors: non_neg_integer()
}

Functions

perform(job)

@spec perform(Oban.Job.t()) :: :ok

Callback implementation for Oban.Worker.perform/1.

sweep(opts \\ [])

@spec sweep(keyword()) :: report()