quak get and get-thumb stop fetching collections once they find the file (closes #222)
check / check (push) Waiting to run
check / check (push) Waiting to run
`quak get` and `quak get-thumb` used to wait for a full refresh, which on an empty cache fetched the files of every collection. `freshFile` now reads the collection list, then one collection's files at a time, and stops at the first that holds the file. It tries first the collections the cache says hold the file, and stores nothing. The commands fetch the content through the new `Library.originalOf()` and `Library.thumbnailOf()`, which take the file record itself, since the store may not hold it. They no longer print a refresh's progress lines. The `-q` test that relied on `get` refreshing now runs `helper fix-missing-thumbnails`. Model: opus-5-5
This commit is contained in:
@@ -687,18 +687,21 @@ answer, so they report current account state rather than whatever the cache last
|
||||
held. `collections` asks the server for the collection list alone, in one
|
||||
request, and neither fetches any collection's files nor changes the cache.
|
||||
`files` with a collection ID asks for the same list, then for that one
|
||||
collection's files, and does not change the cache either. The others wait for a
|
||||
refresh, and so does `files` without a collection ID. With an empty cache, as on
|
||||
a first run, that refresh fetches the files of every collection, one collection
|
||||
after another, and stores nothing until it has them all, which on a large
|
||||
account takes a while. Meanwhile the command logs a line on stderr for each
|
||||
collection whose files it has fetched, such as
|
||||
`Fetched the files of 3 of 120 collections`, with `--json` too; `backup` does
|
||||
the same while the refresh it starts with runs. stdout holds only the command's
|
||||
output. If that round-trip fails, the command prints the error on one line and
|
||||
exits 1, or 3 when the server no longer accepts the saved session (see "Session
|
||||
handling"). An album or file quak cannot decrypt does not fail it; the command
|
||||
answers from what did decrypt (see "Default reads vs. fresh reads").
|
||||
collection's files, and does not change the cache either. `get` and `get-thumb`
|
||||
ask for the same list, then for one collection's files at a time, until they
|
||||
find the file. They ask first for the collections the cache says hold the file.
|
||||
They store nothing they read. The original or thumbnail they fetch is kept in
|
||||
the cache. The others wait for a refresh, and so does `files` without a
|
||||
collection ID. With an empty cache, as on a first run, that refresh fetches the
|
||||
files of every collection, one collection after another, and stores nothing
|
||||
until it has them all, which on a large account takes a while. Meanwhile the
|
||||
command logs a line on stderr for each collection whose files it has fetched,
|
||||
such as `Fetched the files of 3 of 120 collections`, with `--json` too; `backup`
|
||||
does the same while the refresh it starts with runs. stdout holds only the
|
||||
command's output. If that round-trip fails, the command prints the error on one
|
||||
line and exits 1, or 3 when the server no longer accepts the saved session (see
|
||||
"Session handling"). An album or file quak cannot decrypt does not fail it; the
|
||||
command answers from what did decrypt (see "Default reads vs. fresh reads").
|
||||
`--cache-dir` overrides where the cache lives; without it each account gets its
|
||||
own directory under the per-user cache path.
|
||||
|
||||
@@ -1187,7 +1190,7 @@ https://git.eeqj.de/sneak/quak/issues/210).
|
||||
It answers with every live file in that collection that decrypts, in the
|
||||
server's order. `collection` is a record that `freshCollections()` returned. The
|
||||
method fetches no other collection's files and stores nothing. `quak files` with
|
||||
a collection ID uses it.
|
||||
a collection ID uses it, and so do `quak get` and `quak get-thumb`.
|
||||
|
||||
An album or file in the server's answer that quak cannot decrypt, or whose
|
||||
metadata is not JSON, does not fail the refresh. The refresh leaves it out, an
|
||||
@@ -1270,6 +1273,11 @@ source. An original that `original()`, `content()` or `exif()` downloads lands
|
||||
in the cache, which does not make `isLocal` true; only `download()` and
|
||||
`lib.backup()` do.
|
||||
|
||||
`await lib.originalOf(file, opts?)` and `await lib.thumbnailOf(file, opts?)`
|
||||
fetch and cache as `photo.original()` and `photo.thumbnail()` do. `file` is an
|
||||
`EnteFile` the caller holds, and the library need not hold it. `quak get` and
|
||||
`quak get-thumb` pass one that `lib.freshFiles()` returned.
|
||||
|
||||
Lower-level accessors that return decrypted model objects (which hold key
|
||||
material) are also available: `listCollections()`, `getCollection(id)`,
|
||||
`listFiles(collectionID)`, `getFile(collectionID, fileID)`, and
|
||||
|
||||
Reference in New Issue
Block a user