Expand description
v2 broker protocol module.
Houses the prost-generated types for the running_process.broker.v2
package — currently the ServiceDefinition envelope and the
HttpServerCapability optional sub-message introduced in #483.
v2 runs in parallel with v1 (super::protocol) through the broker
v2 rollout; v1’s types are FROZEN FOREVER (#228) so all new
capability fields land here instead.
Re-exports§
pub use crate::daemon_registration_v2::service_definition_dir_v2;pub use crate::daemon_registration_v2::service_definition_path_v2;pub use crate::daemon_registration_v2::write_service_definition_v2;pub use crate::daemon_registration_v2::ServiceDefinitionBuilder;pub use crate::daemon_registration_v2::SERVICE_DEF_V2_EXTENSION;
Modules§
- backend_
handle - v2 backend-handle namespace (slice 23-B of zccache#782).
- client_
compat - Source-compatible broker client backed by the v2 wire (#532 criterion 5).
- session_
frame - Nested message and enum types in
SessionFrame.
Structs§
- Backend
Http Ready - Notification frame sent from a daemon to its broker once the daemon’s
HTTP server has bound a port.
portisu16in Rust; proto’s narrowest integer isuint32so the wire type isuint32and the broker validates the range on receipt. - Cache
Manifest - v2 cache manifest envelope.
- Cache
Manifest Builder - Builder for
CacheManifest. Mirrors v1’ssuper::super::builders::CacheManifestBuilderAPI verbatim so the consumer-side migration is a literal s/v1::/v2::/ swap. - Cache
Root - One cache root the daemon exposes. v2 mirrors v1’s shape so the CacheManifestBuilder API is identical at the call site.
- GetBroker
Http Endpoint Request - CLI→broker request for the broker’s own HTTP endpoint. Empty marker — no fields are necessary; the broker fronts exactly one HTTP server.
- GetBroker
Http Endpoint Response - Broker→CLI response carrying the resolved HTTP endpoint.
portis the port the broker is currently bound on (after env-override / config resolution per #483 §3);pidis the broker’s process id, included so a mid-restart consumer can distinguish a stale answer from a live one without needing a separate liveness probe. - GetSession
Token Request - CLI→broker request for the current composite session token
(zackees/soldr#2360, #2361 Phase 2, #2363) of one daemon. A cooperative
liveness/revocation signal, NOT authentication – see
broker/server/session_token.rs’s module docs for the full model. This is how a client learns a token to present on a laterHello.auth_token: the broker mints and registers a daemon’s half when it launches that daemon (HelloRouter::launch_backend), and this RPC is the read-only lookup a client uses afterward, deliberately kept off the FROZEN FOREVER v1Hello/Negotiatedenvelope (per #228) since it evolves with v2. - GetSession
Token Response - Broker→CLI response.
found = falsemeansdaemon_idhas no registered token (never launched through this broker, or already invalidated) –session_tokenis empty in that case, not a zero-filled placeholder. - Http
Server Capability - Optional per-backend HTTP server capability.
- Service
Definition - v2 service definition envelope.
- Service
Definition Loader - Loader rooted at one v2 service-definition directory.
- Service
Definition Scan Entry - Result of scanning one v2 service-definition entry.
- Session
EnvVar - One ordered environment entry for
SessionStart.env. (Thebroker.v2package cannot reachdaemon.proto’sKeyValue, so it defines its own.) - Session
Exit - How a proxied compile session ended.
codeis the child’s exit code when it exited normally.signalis the terminating Unix signal number when the child was killed by a signal (0 when it exited normally, and always 0 on Windows). Consumers readsignalfirst: a non-zerosignalmeans signal death regardless ofcode. - Session
Frame - One frame on a proxied compile session’s stdio stream. Exactly one field is
set per frame (proto3 oneof). Directionality is by field, not a flag:
stdin/stdin_eofflow client -> daemon;stdout/stderr/exitflow daemon -> client. Frames are delivered in order within each direction. - Session
Start - The command a compile session runs, carried on the session’s opening
startframe.environment_policyselects the base;envis then applied in order (repeated, not a map) so key-case collisions resolve deterministically the waystd::process::Command::envdoes.
Enums§
- Broker
Isolation - Broker isolation mode for a service.
- Cache
Root Kind - Logical role classification for cache roots. Wire values mirror v1’s
broker_v1.CacheRootKindEXACTLY (seebroker_v1_manifest.proto). Keeping the integer values aligned avoids subtle bugs when consumers mix the two generations (e.g. viaas i32casts in test fixtures or in code that bridges between v1 and v2). New kinds land in the reserved range; v1’s enum is FROZEN so anything past 9 is v2-only. - Environment
Policy - Selects the base environment for the session child. AUTO is deliberately not a wire value: the client resolves lifetime-dependent defaults before opening the session.
Constants§
- BROKER_
ENVELOPE_ VERSION_ V2 - Constant carried in every v2 manifest’s
CacheManifest::broker_envelope_versionfield. Pins the schema generation from the proto side independently of the file name. - CENTRAL_
MANIFEST_ EXTENSION_ V2 - v2 file extension used for entries in the central manifest registry.
Mirrors v1’s
pbextension with av2.pbdistinguisher. - ROOT_
MANIFEST_ FILE_ V2 - v2 file name written inside
<cache_root>/. Distinct from v1’s.running-process-manifest.pbso a v1 broker never decodes a v2 file by accident (and vice versa).
Functions§
- central_
manifest_ path_ v2 - Compute the v2 central-registry file path for one (service, version)
pair. Mirrors v1’s
central_manifest_pathwith the.v2.pbsuffix. - central_
registry_ dir_ v2 - Return the platform central-registry directory (same path as v1).
- write_
to_ central_ in_ dir_ v2 - Testable variant of
write_to_central_v2with an explicit registry directory (tests, custom layouts). - write_
to_ central_ v2 - Write
<central_registry>/{service}-{version}.v2.pbatomically. - write_
to_ root_ v2 - Write
<cache_root>/.running-process-manifest.v2.pbatomically.