On-disk content and thumbnail cache with per-photo fetch and prefetch (closes #46)
check / check (push) Successful in 33s

Adds the on-disk content and thumbnail cache keyed by fileID: originals/ and thumbnails/ under cacheDirectory, present-means-complete (streaming atomic rename), orphan temp reaping on open. Photo.original/thumbnail return a cached path with no network when present, else fetch through the shared request pool; thumbnails.ensure drives the thumbnail pool with priority, dedup and AbortSignal. One shared RequestPools set serves both the ML fetch and the content cache. Content-hash integrity is deferred (#68); authenticated streaming decrypt guarantees integrity now.

Model: opus-4-8
This commit was merged in pull request #66.
This commit is contained in:
2026-09-22 18:38:22 +02:00
parent 61dfec8d38
commit 5db59a6e2b
9 changed files with 1179 additions and 19 deletions
+12
View File
@@ -13,6 +13,10 @@ import {
downloadFile as dlFile,
downloadThumbnail as dlThumb,
} from "./download/index.js";
import {
makeDownloadContentSource,
type ContentSource,
} from "./library/content.js";
import type {
Collection,
EnteFile,
@@ -141,6 +145,14 @@ export class Client {
return this.api;
}
// The content-cache byte source over this client's API: each fetch is the
// download layer's request + streaming decrypt + atomic write. `Library`
// calls this to enable the on-disk content cache.
contentSource(): ContentSource {
this.assertLoggedIn();
return makeDownloadContentSource(this.api);
}
private assertLoggedIn(): void {
if (this.loggedOut) throw new Error("Client has been logged out");
}