Precache thumbnails for the whole account and originals for favorites and the latest week #48

Closed
opened 2026-09-22 09:11:08 +02:00 by clawbot · 1 comment
Collaborator

Cache/API implementation (#36), phase 3.
Depends on the content/thumbnail-store and eviction units.

Goal

Aggressive local precache (owner ruling 5): fill thumbnails for the whole
account and originals for favorites + the latest week, started inside open(),
needing nothing from the caller.

Scope

  • Thumbnails: every file in the account, newest first, through the thumbnail
    pool, until 100% on disk; never evicted. The queue is shared with
    thumbnails.ensure so visible/ahead always go ahead of the background
    fill. A file already cached costs one Set lookup from the open-time listing.
  • Originals (the pinned set), through the content pool, in order: every file in
    the favorites album (Collection.type === "favorites"), then every file whose
    takenAt is within the precacheOriginalsDays (default 7) ending at the
    newest takenAt in the account. When a refresh adds a favorite or a newer
    file it joins the queue; when the window moves or a favorite is removed the
    file leaves the pinned set and becomes an ordinary cached original (eligible
    for eviction).
  • open() options: precacheThumbnails? default true, precacheOriginals?
    default true, precacheOriginalsDays? default 7. Progress via the open()
    onProgress and status() (thumbnailsCached/Total, originalsCached,
    originalsPinned, ...).
  • "Latest week" = the 7 days ending at the newest takenAt in the account (not
    the last 7 calendar days), per the design's reading.

Definition of done

  • Both precaches start from open(), run through their pools, are preemptible by
    on-demand work, and update status(); pinned set integrates with eviction.
  • Tested against a fake library/pool; make check green.

Grounding

src/library/. Depends on content/thumbnail store + eviction (pinned set).

Dispatch notes: TDD; no scripted edits; no interactive questions; plain language.
Squash subject ends (closes #<this issue>). End every message with
Model: opus-4-8.

Model: opus-4-8

Cache/API implementation (https://git.eeqj.de/sneak/quak/issues/36), phase 3. Depends on the content/thumbnail-store and eviction units. ## Goal Aggressive local precache (owner ruling 5): fill thumbnails for the whole account and originals for favorites + the latest week, started inside `open()`, needing nothing from the caller. ## Scope - Thumbnails: every file in the account, newest first, through the thumbnail pool, until 100% on disk; never evicted. The queue is shared with `thumbnails.ensure` so `visible`/`ahead` always go ahead of the background fill. A file already cached costs one `Set` lookup from the open-time listing. - Originals (the pinned set), through the content pool, in order: every file in the favorites album (`Collection.type === "favorites"`), then every file whose `takenAt` is within the `precacheOriginalsDays` (default 7) ending at the newest `takenAt` in the account. When a refresh adds a favorite or a newer file it joins the queue; when the window moves or a favorite is removed the file leaves the pinned set and becomes an ordinary cached original (eligible for eviction). - `open()` options: `precacheThumbnails?` default true, `precacheOriginals?` default true, `precacheOriginalsDays?` default 7. Progress via the `open()` `onProgress` and `status()` (`thumbnailsCached/Total`, `originalsCached`, `originalsPinned`, ...). - "Latest week" = the 7 days ending at the newest `takenAt` in the account (not the last 7 calendar days), per the design's reading. ## Definition of done - Both precaches start from `open()`, run through their pools, are preemptible by on-demand work, and update `status()`; pinned set integrates with eviction. - Tested against a fake library/pool; `make check` green. ## Grounding `src/library/`. Depends on content/thumbnail store + eviction (pinned set). Dispatch notes: TDD; no scripted edits; no interactive questions; plain language. Squash subject ends ` (closes #<this issue>)`. End every message with `Model: opus-4-8`. Model: opus-4-8
Author
Collaborator

Implemented in #73.

Two background fills start inside Library.open() with no caller input, both through the shared pools at background priority so on-demand work preempts: every thumbnail newest-first until all are on disk (sharing the pool with thumbnails.ensure), and the pinned originals — favorites album, then the precacheOriginalsDays (default 7) window ending at the newest file — through the content pool. The pinned set is the eviction predicate, so a pinned original is never evicted and a file that leaves the set becomes an ordinary, evictable original.

open() options precacheThumbnails/precacheOriginals (default true) and precacheOriginalsDays (default 7); progress via onProgress and status() (thumbnailsCached/Total, originalsCached/Pinned).

Model: opus-4-8

Implemented in https://git.eeqj.de/sneak/quak/pulls/73. Two background fills start inside `Library.open()` with no caller input, both through the shared pools at background priority so on-demand work preempts: every thumbnail newest-first until all are on disk (sharing the pool with `thumbnails.ensure`), and the pinned originals — favorites album, then the `precacheOriginalsDays` (default 7) window ending at the newest file — through the content pool. The pinned set is the eviction predicate, so a pinned original is never evicted and a file that leaves the set becomes an ordinary, evictable original. `open()` options `precacheThumbnails`/`precacheOriginals` (default true) and `precacheOriginalsDays` (default 7); progress via `onProgress` and `status()` (`thumbnailsCached`/`Total`, `originalsCached`/`Pinned`). Model: opus-4-8
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/quak#48