Commit Graph
1 Commits
Author SHA1 Message Date
sneak a3a7eeddb8 On-disk content and thumbnail cache with per-photo fetch and prefetch (closes #46)
check / check (push) Successful in 25s
Add src/library/content.ts: a ContentCache keyed by fileID under
cacheDirectory (flat originals/ and thumbnails/, 0700/0600). It fetches
through the request pools (#45) and the streaming decrypt / atomic writer
(#40), so present-means-complete; it reaps orphan temp files at open and
records the record of what is cached. Photo.original/thumbnail return
{path,bytes} (one skipped event when present, in cache or downloadDirectory),
and lib.thumbnails.ensure drives the thumbnail pool with priority, dedup, and
abort. Cached paths are projected onto PhotoRecord.

Integrity: enforced by the reused streaming decrypt (every chunk
authenticated, renamed in only on TAG_FINAL) plus a non-empty check. The
metadata.hash / declared-fileSize comparison is deferred — the only in-repo
hash fixture is a placeholder, so the construction cannot be confirmed against
fixtures (the issue's own precondition), and FileBlob.size is the encrypted
object size, not the decrypted length. Raised as a question on the PR.

Judgement call: the three thumbnail priorities map onto the pool's two tiers
(visible -> on-demand; ahead and background -> background).

Model: opus-4-8
2026-09-22 15:47:32 +00:00