The lifetime of one leaf loader: a disposed latch, the abort signal every
loader-owned read can ride, the one-shot (optionally prioritised)
initialization, and the per-call demand-load context its L0 proxies read.
A leaf loader's dispose() clears its arrays and resets its one-shot
initializer, but async work already in flight — above all an initialize()
awaiting its metadata opens — would otherwise finish afterwards and write its
results back into the disposed loader, and a later call would re-initialize
it from scratch. The latch makes disposal TERMINAL: work that started before
it bails as a cancellation (an AbortError, which run-loader-updates stages
as null quietly) and new work is refused the same way. The signal lets reads
that no caller owns (a speculative initialization) be cancelled by disposal.
A loader whose disposal is NOT terminal by design (the mesh whole-node
loader re-initializes after a dispose) replaces its lifetime instead:
this.lifetime.dispose(); this.lifetime = new LoaderLifetime(), and treats
"is the lifetime I started under still current?" as its generation check.
The lifetime of one leaf loader: a disposed latch, the abort signal every loader-owned read can ride, the one-shot (optionally prioritised) initialization, and the per-call demand-load context its L0 proxies read.
A leaf loader's
dispose()clears its arrays and resets its one-shot initializer, but async work already in flight — above all aninitialize()awaiting its metadata opens — would otherwise finish afterwards and write its results back into the disposed loader, and a later call would re-initialize it from scratch. The latch makes disposal TERMINAL: work that started before it bails as a cancellation (anAbortError, which run-loader-updates stages as null quietly) and new work is refused the same way. The signal lets reads that no caller owns (a speculative initialization) be cancelled by disposal.A loader whose disposal is NOT terminal by design (the mesh whole-node loader re-initializes after a dispose) replaces its lifetime instead:
this.lifetime.dispose(); this.lifetime = new LoaderLifetime(), and treats "is the lifetime I started under still current?" as its generation check.