backend: storage pipeline (compression and image optimization) #45

Open
opened 2026-11-16 17:34:15 -05:00 by forgejo_admin · 0 comments
Owner

Every upload goes through one pipeline before sp_save_file (docs/architecture.md, Storage).

  • images (PNG, JPEG, WebP): unless optimizeImages=false, downscale to 2560 px on the long side and re-encode; the optimized bytes become the file
  • SHA-256 and size of the (possibly optimized) original; dedupe against blobs
  • zstd the object when it saves at least 10%, else store as is; sp_register_blob(sha, size, encoding, stored)
  • downloads decompress transparently; Content-Length is the original size
  • orphan collector over v_orphan_blobs
  • tests: round trip byte-identical, PNG/JPEG not double-compressed, quota counts original bytes

Conventions — CLAUDE.md and PLAN.md at the repo root.

Every upload goes through one pipeline before `sp_save_file` (docs/architecture.md, Storage). - [ ] images (PNG, JPEG, WebP): unless `optimizeImages=false`, downscale to 2560 px on the long side and re-encode; the optimized bytes become the file - [ ] SHA-256 and size of the (possibly optimized) original; dedupe against `blobs` - [ ] zstd the object when it saves at least 10%, else store as is; `sp_register_blob(sha, size, encoding, stored)` - [ ] downloads decompress transparently; `Content-Length` is the original size - [ ] orphan collector over `v_orphan_blobs` - [ ] tests: round trip byte-identical, PNG/JPEG not double-compressed, quota counts original bytes **Conventions** — CLAUDE.md and PLAN.md at the repo root.
forgejo_admin added this to the M1 Core milestone 2026-11-16 17:34:15 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
k8s-services/dongba#45
No description provided.