Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions docs/ctx-exports-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down