Write each backed-up original once and skip the precache (closes #106) #124

Merged
clawbot merged 1 commits from issue-106-backup-double-write into next2 2026-09-23 08:48:03 +02:00
Collaborator

Fixes #106.

What changed

  • ContentCache.backupOriginal(fileID, destination): an original not present anywhere is fetched through the content pool and written by the download writer straight to destination (the backup's originals/<fileID>.<ext>), then recorded there, so the cache counts it as present without holding a copy. runBackup passes the destination; copyAtomic only runs when the original was already cached elsewhere (it already returns early when source and destination match).
  • quak backup opens its library with precacheThumbnails: false and precacheOriginals: false.
  • README backup text, the src/backup.ts header wrap, and TODO.md updated.

Worth knowing

  • A freshly downloaded original's temp file in the backup's originals/ is now the download writer's .quak-<pid>-<random>.tmp, not .quak-backup-…. The backup's leftover-temp cleanup already matches both.
  • If the same original is already being fetched into the cache when the backup asks for it, the backup joins that fetch and copies the result, as before.
  • The existing fsync-ordering test now primes the cache first, since only a copy from the cache goes through copyAtomic.
  • New tests: a backup of 3 files through a counting source makes 3 fetches, leaves the cache's originals/ empty, and has every original in the backup tree; quak backup leaves the cache's originals/ and thumbnails/ empty.

make check green.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/quak/issues/106. **What changed** - `ContentCache.backupOriginal(fileID, destination)`: an original not present anywhere is fetched through the content pool and written by the download writer straight to `destination` (the backup's `originals/<fileID>.<ext>`), then recorded there, so the cache counts it as present without holding a copy. `runBackup` passes the destination; `copyAtomic` only runs when the original was already cached elsewhere (it already returns early when source and destination match). - `quak backup` opens its library with `precacheThumbnails: false` and `precacheOriginals: false`. - README backup text, the `src/backup.ts` header wrap, and `TODO.md` updated. **Worth knowing** - A freshly downloaded original's temp file in the backup's `originals/` is now the download writer's `.quak-<pid>-<random>.tmp`, not `.quak-backup-…`. The backup's leftover-temp cleanup already matches both. - If the same original is already being fetched into the cache when the backup asks for it, the backup joins that fetch and copies the result, as before. - The existing fsync-ordering test now primes the cache first, since only a copy from the cache goes through `copyAtomic`. - New tests: a backup of 3 files through a counting source makes 3 fetches, leaves the cache's `originals/` empty, and has every original in the backup tree; `quak backup` leaves the cache's `originals/` and `thumbnails/` empty. `make check` green. Model: opus-5-5
clawbot added the needs-review label 2026-09-23 08:19:10 +02:00
clawbot self-assigned this 2026-09-23 08:19:10 +02:00
clawbot added 1 commit 2026-09-23 08:19:11 +02:00
An original fetched for a backup is now written by the download writer
straight into the backup's originals/, and the content cache records it
there instead of keeping its own copy. One the cache already held is
still copied. `quak backup` opens its library with the thumbnail and
originals precache off, as the one-shot commands do.

Model: opus-5-5
Author
Collaborator

PASS on cb981ea rebased onto next2 f52c77f.

Model: opus-5-5

PASS on `cb981ea` rebased onto `next2` `f52c77f`. Model: opus-5-5
clawbot merged commit ae76eb3f74 into next2 2026-09-23 08:48:03 +02:00
clawbot deleted branch issue-106-backup-double-write 2026-09-23 08:48:03 +02:00
Sign in to join this conversation.