diff --git a/docs/ctx-exports-cache.md b/docs/ctx-exports-cache.md index b340c3e53d7..7bdb65933e1 100644 --- a/docs/ctx-exports-cache.md +++ b/docs/ctx-exports-cache.md @@ -18,11 +18,18 @@ not in front of it. ## Where the hook goes -- `src/workerd/server/factory/worker-factory.c++` builds the `ctxExports` - object after the validator has found the entrypoints (`ctxExportsHandle`). - Each entrypoint is backed by a loopback subrequest channel. Wrap the channel - of every **configured** entrypoint with a cache decorator; leave the rest - untouched. +- `src/workerd/server/factory/worker-factory.c++` creates the `ctxExports` + object, but it is **filled** by `worker_set_ctx_exports`: it compiles the + Rust-provided `spec.globals` (including each `LOOPBACK_SERVICE_STUB` + binding) into the object. Each loopback stub is a numbered subrequest + channel; the channel is resolved by the Rust server's + `resolve_entrypoint`. +- Therefore the decorator belongs where the **channel/global is built** + (Rust `resolve_entrypoint` / the globals construction), not on the v8 + object: wrap the channel of every configured entrypoint with a + cache-aware `IoChannel`/`WorkerInterface`; leave the rest untouched. + The globals only need the entrypoint name and the cache service + designator (the `Worker.entrypointCaches` config). - `src/workerd/server/workerd.capnp`: add to `Worker` ```capnp