feat(transcode): the local cache disables itself, and drains at boot

Completes the pattern the thumbnail migration established, for
`.transcoded/`.

`initialize` no longer creates the tree. Creating it at boot is exactly
what kept `.thumbnails/` alive across restarts — the import removed it,
the next boot put it back, and the absence the read path gates on was
unreachable by construction. The write path already calls
`create_dir_all` on the parent before writing, so eager creation
achieved nothing except defeating the drain.

It now probes instead: one `stat`, cached for the process lifetime, and
the local-cache reads short-circuit on a relaxed atomic load when the
tree is gone. Fails open, so a service built without `initialize`
behaves as before.

One difference from the thumbnail tiers, and it is not a stalled
migration: callers with no content hash — external mounts — cannot use
the content-keyed tier at all, so they still read and write here. On an
install without such mounts the directory drains once and stays gone;
on one with them it persists, correctly.

`transcode_import?repair=true` joins the startup defaults on the same
terms as the thumbnail imports, and with the weakest safety argument
needed of the three: a transcode is a pure function of its source, so
anything deleted in error is recomputed on the next request. The
`default_startup_jobs` test failed on the change rather than being
updated silently, which is what it is for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Edouard Vanbelle
2026-08-30 18:22:18 +02:00
parent 0e09cb81ff
commit 71f227b737
5 changed files with 74 additions and 13 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ OXICLOUD_SERVER_HOST=0.0.0.0
# storage).
#
# DEFAULT (applied when this variable is unset):
# thumb_derived_import?repair=true,thumb_attached_import?repair=true
# thumb_derived_import?repair=true,thumb_attached_import?repair=true,transcode_import?repair=true
#
# Those two migrate thumbnails out of the legacy .thumbnails/ directory
# into blob storage and then delete the originals, so the migration