Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/workerd/server/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Bazel labels: `//src/workerd/server:workerd`, `//src/workerd/server:workerd-cli`
| `lib.rs` | Crate root: `main()`, the commands, the server's `Watch` future for `--watch` |
| `args.rs` | clap definitions |
| `help.rs` | The help pages, written by hand; `args-test.rs` checks them against the parser |
| `config.rs` | Config sources (schema file, compiled binary, embedded) and the synthesized Python config; for `serve`, in one pass (`with_cluster`), `--cluster-addr` joining a config without `cluster` to one, refused for a compiled binary's config and for one without a writable `do-storage` disk, and the cluster key and bucket taken from `WORKERD_CLUSTER_KEY` or `WORKERD_CLUSTER_KEY_FILE` and `WORKERD_CLUSTER_BUCKET` over the config's, an error if set nowhere |
| `config.rs` | Config sources (schema file, compiled binary, embedded) and the synthesized Python config; for `serve`, in one pass (`with_cluster`), `--cluster-addr` joining a config without `cluster` to one, refused for a compiled binary's config and for one without a writable `do-storage` disk, and the cluster key and bucket taken from `WORKERD_CLUSTER_KEY` or `WORKERD_CLUSTER_KEY_FILE` and `WORKERD_CLUSTER_BUCKET` over the config's, an error if set nowhere, and `stopTimeoutMs` taken from `WORKERD_CLUSTER_STOP_TIMEOUT_MS` over the config's; and `shutdownDelayMs` taken from `WORKERD_SHUTDOWN_DELAY_MS` over the config's (`with_shutdown_delay_environment`) |
| `deploy.rs` | Cluster mode: `workerd deploy`, a wrangler project (`wrangler.rs`) or Cap'n Proto config checked as a deployment, then published to the bucket `--bucket` names (`cluster::deploy`), with the instances' bucket client and environment fallbacks; each instance skips it if it does not compose with its own config |
| `deployments.rs` | Cluster mode: before `serve` starts the server, merges deployments from the bucket (`cluster::deploy`) into the config (`cluster::compose`), skips those that do not compose, and tells the server which services came from each deployment |
| `process.rs` | Executable discovery, the compiled-binary format, `Process` (the files to watch, re-exec) |
Expand All @@ -70,7 +70,7 @@ Bazel labels: `//src/workerd/server:workerd`, `//src/workerd/server:workerd-cli`
| `lib.rs` | Crate root: `Error` / `Result` |
| `bridge.rs` | The cxx bridge (`workerd::server`) to `factory/worker-factory.h` and `factory/bootstrap.h`. `extern "C++"`: the factory (compile, start request, bench, actors and storage, RPC, tokens, inspector, `factory_spawn`), the bootstrap, the process's logging and its exit; `extern "Rust"`: the channel objects, the channel factory, the pending command. Ownership rules in its `//!` |
| `entry.rs` | `serve` / `test` / `bench`: the process's schedule (`with_process_context`, the `kj_rs_tokio::Runtime`, `bootstrap`, `block_on`, exit), `server_serve` / `server_test` / `server_bench`, the `Watch` future the command line supplies, printing config errors and the exit status they make, SIGTERM drain, `--watch` reload, shutdown order (settle tasks, drop the factory and with it V8 and the perfetto session, then the Runtime) |
| `run.rs` | `run()` / `test()` / `bench()`: bind sockets, start the inspector (before any isolate exists), build the graph, start the listeners (not for a config the `Reporter` refuses), drain, control-fd events, the check that every `--directory-path` / `--external-addr` override named a service |
| `run.rs` | `run()` / `test()` / `bench()`: bind sockets, start the inspector (before any isolate exists), build the graph, start the listeners (not for a config the `Reporter` refuses), drain (after the config's `shutdownDelayMs`, which a second drain signal cuts short; at once for a signal that came while it started), control-fd events, the check that every `--directory-path` / `--external-addr` override named a service |
| `bench.rs` | `workerd bench`'s options and report (`io/bench.capnp`): a group for each `bench()` handler `run::bench` runs (through the factory's `worker_bench`), progress logged as `workerd test` logs it, the environment, and the report as a table or as JSON |
| `config.rs` | `Server`: the service graph from the config in three passes (actor configs, construction, link); `Factory`, the Rust owner of the C++ `WorkerFactory`; `Reporter`, which attributes a deployment's config errors to it; resolves channel tokens and debug-port requests |
| `channels.rs` | The handles C++ holds and the runtime reaches into the server through: `SubrequestChannel` (an `Rc<dyn Channel>`), `ActorClassChannel` (an `Rc<dyn ActorClass>`), `ChannelFactory` (a worker's `LinkedChannels`), `WorkerStub`, and the `Weak` back-pointers (`ServerHandle`, `ActorNamespaceHandle`, `ActorHooks`). Single-threaded |
Expand Down
Loading
Loading