♻️ Bind the snapshot loader through the fdata helper

`reduce-snapshots` hand-rolled the same `binding` that
`fdata/with-pointers` builds (it also loaded the function's own
pointer loader before entering the reduction). Use the macro so the
rule holds there too and the namespace no longer needs
`app.util.pointer-map`; the loader is identical (same cfg and file-id)
and snapshot walking behaves the same.

AI-assisted-by: deepseek-v4.1-flash
This commit is contained in:
Andrey Antukh 2026-10-29 15:33:27 +00:00
parent b3f9ed6289
commit 861634b986

View File

@ -22,7 +22,6 @@
[app.jobs :as jobs]
[app.storage :as sto]
[app.util.blob :as blob]
[app.util.pointer-map :as pmap]
[cuerdas.core :as str]))
(def sql:snapshots
@ -455,12 +454,11 @@
pointer ids never trigger a load."
[cfg file-id xform f init]
(let [conn (db/get-connection cfg)
load (partial fdata/load-pointer cfg file-id)
xform (comp
(map (partial fdata/resolve-file-data cfg))
(map (partial fdata/decode-file-data cfg))
xform)]
(binding [pmap/*load-fn* load]
(fdata/with-pointers cfg file-id
(->> (db/plan conn [sql:get-snapshots file-id] {:fetch-size 1})
(transduce xform f init)))))